Back out entire dd28759eba7b push (bug 739913 and bug 742226) due to OSX 10.7 and b2g bustage. r=shouldausedtry
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 12 Apr 2012 20:00:57 -0400
changeset 91540 1ae36c75ffb30796c21d4a3b822bbba55653681a
parent 91539 c7d6c4305f9397296eb0e97e99b6ea9aa8c9dc6b
child 91541 0209dfc83681b423cc41b3123312cb626f54bc70
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-esr52@357da346ceb7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshouldausedtry
bugs739913, 742226
milestone14.0a1
Back out entire dd28759eba7b push (bug 739913 and bug 742226) due to OSX 10.7 and b2g bustage. r=shouldausedtry
b2g/chrome/content/shell.js
dom/power/PowerManager.cpp
dom/power/nsIDOMPowerManager.idl
hal/Hal.cpp
hal/Hal.h
hal/Makefile.in
hal/android/AndroidHal.cpp
hal/gonk/GonkHal.cpp
hal/gonk/UeventPoller.cpp
hal/gonk/UeventPoller.h
hal/linux/LinuxHal.cpp
hal/sandbox/PHal.ipdl
hal/sandbox/SandboxHal.cpp
hal/windows/WindowsHal.cpp
toolkit/library/Makefile.in
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -313,20 +313,16 @@ var shell = {
       if (state != "locked-foreground") {
         if (Services.idle.idleTime > idleTimeout*1000) {
           navigator.mozPower.screenEnabled = false;
         }
       } else {
         navigator.mozPower.screenEnabled = true;
       }
     }
-    if (topic == "cpu") {
-      navigator.mozPower.cpuSleepAllowed = (state != "locked-foreground" &&
-                                            state != "locked-background");
-    }
   }
 
   let idleTimeout = Services.prefs.getIntPref("power.screen.timeout");
   if (!('mozSettings' in navigator))
     return;
 
   let request = navigator.mozSettings.getLock().get("power.screen.timeout");
   request.onsuccess = function onSuccess() {
--- a/dom/power/PowerManager.cpp
+++ b/dom/power/PowerManager.cpp
@@ -231,32 +231,11 @@ PowerManager::SetScreenBrightness(double
 {
   NS_ENSURE_TRUE(CheckPermission(), NS_ERROR_DOM_SECURITY_ERR);
 
   NS_ENSURE_TRUE(0 <= aBrightness && aBrightness <= 1, NS_ERROR_INVALID_ARG);
   hal::SetScreenBrightness(aBrightness);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-PowerManager::GetCpuSleepAllowed(bool *aEnabled)
-{
-  if (!CheckPermission()) {
-    *aEnabled = true;
-    return NS_OK;
-  }
-
-  *aEnabled = hal::GetCpuSleepAllowed();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-PowerManager::SetCpuSleepAllowed(bool aEnabled)
-{
-  NS_ENSURE_TRUE(CheckPermission(), NS_ERROR_DOM_SECURITY_ERR);
-
-  hal::SetCpuSleepAllowed(aEnabled);
-  return NS_OK;
-}
-
 } // power
 } // dom
 } // mozilla
--- a/dom/power/nsIDOMPowerManager.idl
+++ b/dom/power/nsIDOMPowerManager.idl
@@ -37,17 +37,17 @@
 
 #include "nsISupports.idl"
 
 interface nsIDOMMozWakeLockListener;
 
 /**
  * This interface implements navigator.mozPower
  */
-[scriptable, uuid(256a3287-f528-45b5-9ba8-2b3650c056e6)]
+[scriptable, uuid(4586bed1-cf78-4436-b503-88277d645b68)]
 interface nsIDOMMozPowerManager : nsISupports
 {
     void    powerOff();
     void    reboot();
 
     /**
      * The listeners are notified when a resource changes its lock state to:
      *  - unlocked
@@ -91,16 +91,9 @@ interface nsIDOMMozPowerManager : nsISup
      * If you write a value of X into this attribute, the attribute may not have
      * the same value X when you later read it.  Most screens don't support as
      * many different brightness levels as there are doubles between 0 and 1, so
      * we may reduce the value's precision before storing it.
      *
      * @throw NS_ERROR_INVALID_ARG if brightness is not in the range [0, 1].
      */
     attribute double screenBrightness;
-
-    /**
-     * Is it possible that the device's CPU will sleep after the screen is
-     * disabled?  Setting this attribute to false will prevent the device
-     * entering suspend state.
-     */
-    attribute boolean cpuSleepAllowed;
 };
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -358,32 +358,16 @@ bool GetScreenEnabled()
 }
 
 void SetScreenEnabled(bool enabled)
 {
   AssertMainThread();
   PROXY_IF_SANDBOXED(SetScreenEnabled(enabled));
 }
 
-bool GetCpuSleepAllowed()
-{
-  // Generally for interfaces that are accessible by normal web content
-  // we should cache the result and be notified on state changes, like
-  // what the battery API does. But since this is only used by
-  // privileged interface, the synchronous getter is OK here.
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetCpuSleepAllowed());
-}
-
-void SetCpuSleepAllowed(bool enabled)
-{
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(SetCpuSleepAllowed(enabled));
-}
-
 double GetScreenBrightness()
 {
   AssertMainThread();
   RETURN_PROXY_IF_SANDBOXED(GetScreenBrightness());
 }
 
 void SetScreenBrightness(double brightness)
 {
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -144,27 +144,16 @@ double GetScreenBrightness();
  * Note that we may reduce the resolution of the given brightness value before
  * sending it to the screen.  Therefore if you call SetScreenBrightness(x)
  * followed by GetScreenBrightness(), the value returned by
  * GetScreenBrightness() may not be exactly x.
  */
 void SetScreenBrightness(double brightness);
 
 /**
- * Determine whether the device is allowed to sleep.
- */
-bool GetCpuSleepAllowed();
-
-/**
- * Set whether the device is allowed to suspend automatically after
- * the screen is disabled.
- */
-void SetCpuSleepAllowed(bool enabled);
-
-/**
  * Set the value of a light to a particular color, with a specific flash pattern.
  * light specifices which light.  See Hal.idl for the list of constants
  * mode specifies user set or based on ambient light sensor
  * flash specifies whether or how to flash the light
  * flashOnMS and flashOffMS specify the pattern for XXX flash mode
  * color specifies the color.  If the light doesn't support color, the given color is
  * transformed into a brightness, or just an on/off if that is all the light is capable of.
  * returns true if successful and false if failed.
--- a/hal/Makefile.in
+++ b/hal/Makefile.in
@@ -79,17 +79,16 @@ CPPSRCS += \
   AndroidHal.cpp \
   AndroidSensor.cpp \
   $(NULL)
 else ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
   GonkHal.cpp \
   Power.cpp \
   GonkSensor.cpp \
-  UeventPoller.cpp \
   $(NULL)
 else ifeq (Linux,$(OS_TARGET))
 CPPSRCS += \
   LinuxHal.cpp \
   FallbackSensor.cpp \
   Power.cpp \
   $(NULL)
 ifdef MOZ_ENABLE_DBUS
--- a/hal/android/AndroidHal.cpp
+++ b/hal/android/AndroidHal.cpp
@@ -136,26 +136,16 @@ GetScreenBrightness()
 {
   return 1;
 }
 
 void
 SetScreenBrightness(double brightness)
 {}
 
-bool
-GetCpuSleepAllowed()
-{
-  return true;
-}
-
-void
-SetCpuSleepAllowed(bool enabled)
-{}
-
 void
 EnableNetworkNotifications()
 {
   AndroidBridge* bridge = AndroidBridge::Bridge();
   if (!bridge) {
     return;
   }
 
--- a/hal/gonk/GonkHal.cpp
+++ b/hal/gonk/GonkHal.cpp
@@ -1,35 +1,32 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set sw=2 ts=8 et ft=cpp : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "base/message_loop.h"
 #include "hardware_legacy/uevent.h"
 #include "Hal.h"
 #include "HalImpl.h"
 #include "mozilla/dom/battery/Constants.h"
 #include "mozilla/FileUtils.h"
 #include "nsAlgorithm.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/Services.h"
 #include "mozilla/FileUtils.h"
 #include "nsThreadUtils.h"
 #include "nsIRunnable.h"
 #include "nsIThread.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
-#include "nsXULAppAPI.h"
 #include "hardware/lights.h"
 #include "hardware/hardware.h"
 #include "hardware_legacy/vibrator.h"
-#include "UeventPoller.h"
 #include <stdio.h>
 #include <math.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <time.h>
 #include <sys/syscall.h>
 #include <cutils/properties.h>
 #include "mozilla/dom/network/Constants.h"
@@ -194,84 +191,80 @@ public:
   {
     hal::BatteryInformation info;
     hal_impl::GetCurrentBatteryInformation(&info);
     hal::NotifyBatteryChange(info);
     return NS_OK;
   }
 };
 
-} // anonymous namespace
-
-class BatteryObserver : public IUeventObserver,
-                        public RefCounted<BatteryObserver>
-{
+class UEventWatcher : public nsRunnable {
 public:
-  BatteryObserver()
-    :mUpdater(new BatteryUpdater())
+  UEventWatcher()
+    : mUpdater(new BatteryUpdater())
+    , mRunning(false)
   {
   }
 
-  virtual void Notify(const NetlinkEvent &aEvent)
+  NS_IMETHOD Run()
   {
-    // this will run on IO thread
-    NetlinkEvent *event = const_cast<NetlinkEvent*>(&aEvent);
-    const char *subsystem = event->getSubsystem();
-    // e.g. DEVPATH=/devices/platform/sec-battery/power_supply/battery
-    const char *devpath = event->findParam("DEVPATH");
-    if (strcmp(subsystem, "power_supply") == 0 &&
-        strstr(devpath, "battery")) {
-      // aEvent will be valid only in this method.
-      NS_DispatchToMainThread(mUpdater);
+    while (mRunning) {
+      char buf[1024];
+      int count = uevent_next_event(buf, sizeof(buf) - 1);
+      if (!count) {
+        NS_WARNING("uevent_next_event() returned 0!");
+        continue;
+      }
+
+      buf[sizeof(buf) - 1] = 0;
+      if (strstr(buf, "battery"))
+        NS_DispatchToMainThread(mUpdater);
     }
+    return NS_OK;
   }
 
+  bool mRunning;
+
 private:
   nsRefPtr<BatteryUpdater> mUpdater;
 };
 
-// sBatteryObserver is owned by the IO thread. Only the IO thread may
-// create or destroy it.
-static BatteryObserver *sBatteryObserver = NULL;
+} // anonymous namespace
 
-static void
-RegisterBatteryObserverIOThread()
-{
-  MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
-  MOZ_ASSERT(!sBatteryObserver);
-
-  sBatteryObserver = new BatteryObserver();
-  RegisterUeventListener(sBatteryObserver);
-}
+static bool sUEventInitialized = false;
+static UEventWatcher *sWatcher = NULL;
+static nsIThread *sWatcherThread = NULL;
 
 void
 EnableBatteryNotifications()
 {
-  XRE_GetIOMessageLoop()->PostTask(
-      FROM_HERE,
-      NewRunnableFunction(RegisterBatteryObserverIOThread));
-}
+  if (!sUEventInitialized)
+    sUEventInitialized = uevent_init();
+  if (!sUEventInitialized) {
+    NS_WARNING("uevent_init() failed!");
+    return;
+  }
 
-static void
-UnregisterBatteryObserverIOThread()
-{
-  MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
-  MOZ_ASSERT(sBatteryObserver);
+  if (!sWatcher)
+    sWatcher = new UEventWatcher();
+  NS_ADDREF(sWatcher);
 
-  UnregisterUeventListener(sBatteryObserver);
-  delete sBatteryObserver;
-  sBatteryObserver = NULL;
+  sWatcher->mRunning = true;
+  nsresult rv = NS_NewThread(&sWatcherThread, sWatcher);
+  if (NS_FAILED(rv))
+    NS_WARNING("Failed to get new thread for uevent watching");
 }
 
 void
 DisableBatteryNotifications()
 {
-  XRE_GetIOMessageLoop()->PostTask(
-      FROM_HERE,
-      NewRunnableFunction(UnregisterBatteryObserverIOThread));
+  sWatcher->mRunning = false;
+  sWatcherThread->Shutdown();
+  NS_IF_RELEASE(sWatcherThread);
+  delete sWatcher;
 }
 
 void
 GetCurrentBatteryInformation(hal::BatteryInformation *aBatteryInfo)
 {
   static const int BATTERY_NOT_CHARGING = 0;
   static const int BATTERY_CHARGING_USB = 1;
   static const int BATTERY_CHARGING_AC  = 2;
@@ -324,18 +317,16 @@ GetCurrentBatteryInformation(hal::Batter
 }
 
 namespace {
 
 /**
  * RAII class to help us remember to close file descriptors.
  */
 const char *screenEnabledFilename = "/sys/power/state";
-const char *wakeLockFilename = "/sys/power/wake_lock";
-const char *wakeUnlockFilename = "/sys/power/wake_unlock";
 
 template<ssize_t n>
 bool ReadFromFile(const char *filename, char (&buf)[n])
 {
   int fd = open(filename, O_RDONLY);
   ScopedClose autoClose(fd);
   if (fd < 0) {
     HAL_LOG(("Unable to open file %s.", filename));
@@ -367,22 +358,16 @@ void WriteToFile(const char *filename, c
   }
 }
 
 // We can write to screenEnabledFilename to enable/disable the screen, but when
 // we read, we always get "mem"!  So we have to keep track ourselves whether
 // the screen is on or not.
 bool sScreenEnabled = true;
 
-// We can read wakeLockFilename to find out whether the cpu wake lock
-// is already acquired, but reading and parsing it is a lot more work
-// than tracking it ourselves, and it won't be accurate anyway (kernel
-// internal wake locks aren't counted here.)
-bool sCpuSleepAllowed = true;
-
 } // anonymous namespace
 
 bool
 GetScreenEnabled()
 {
   return sScreenEnabled;
 }
 
@@ -425,29 +410,16 @@ SetScreenBrightness(double brightness)
   aConfig.mode() = hal::eHalLightMode_User;
   aConfig.flash() = hal::eHalLightFlash_None;
   aConfig.flashOnMS() = aConfig.flashOffMS() = 0;
   aConfig.color() = color;
   hal::SetLight(hal::eHalLightID_Backlight, aConfig);
   hal::SetLight(hal::eHalLightID_Buttons, aConfig);
 }
 
-bool
-GetCpuSleepAllowed()
-{
-  return sCpuSleepAllowed;
-}
-
-void
-SetCpuSleepAllowed(bool aAllowed)
-{
-  WriteToFile(aAllowed ? wakeUnlockFilename : wakeLockFilename, "gecko");
-  sCpuSleepAllowed = aAllowed;
-}
-
 static light_device_t* sLights[hal::eHalLightID_Count];	// will be initialized to NULL
 
 light_device_t* GetDevice(hw_module_t* module, char const* name)
 {
   int err;
   hw_device_t* device;
   err = module->methods->open(module, name, &device);
   if (err == 0) {
deleted file mode 100644
--- a/hal/gonk/UeventPoller.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <signal.h>
-#include <string.h>
-#include <strings.h>
-#include <unistd.h>
-
-#include <arpa/inet.h>
-#include <linux/types.h>
-#include <linux/netlink.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-#include "base/message_loop.h"
-#include "mozilla/FileUtils.h"
-#include "nsAutoPtr.h"
-#include "nsThreadUtils.h"
-#include "nsXULAppAPI.h"
-
-#include "UeventPoller.h"
-
-namespace mozilla {
-namespace hal_impl {
-
-static void ShutdownUevent();
-
-class NetlinkPoller : public MessageLoopForIO::Watcher
-{
-public:
-  NetlinkPoller() : mSocket(-1),
-                    mIOLoop(MessageLoopForIO::current())
-  {
-  }
-
-  virtual ~NetlinkPoller() {}
-
-  bool OpenSocket();
-
-  virtual void OnFileCanReadWithoutBlocking(int fd);
-
-  // no writing to the netlink socket
-  virtual void OnFileCanWriteWithoutBlocking(int fd)
-  {
-    MOZ_NOT_REACHED("Must not write to netlink socket");
-  }
-
-  MessageLoopForIO *GetIOLoop () const { return mIOLoop; }
-  void RegisterObserver(IUeventObserver *aObserver)
-  {
-    mUeventObserverList.AddObserver(aObserver);
-  }
-
-  void UnregisterObserver(IUeventObserver *aObserver)
-  {
-    mUeventObserverList.RemoveObserver(aObserver);
-    if (mUeventObserverList.Length() == 0)
-      ShutdownUevent();  // this will destroy self
-  }
-
-private:
-  ScopedClose mSocket;
-  MessageLoopForIO* mIOLoop;
-  MessageLoopForIO::FileDescriptorWatcher mReadWatcher;
-
-  NetlinkEvent mNetlinkEvent;
-  const static int kBuffsize = 64 * 1024;
-  uint8_t mBuffer [kBuffsize];
-
-  typedef ObserverList<NetlinkEvent> UeventObserverList;
-  UeventObserverList mUeventObserverList;
-};
-
-bool
-NetlinkPoller::OpenSocket()
-{
-  mSocket.mFd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
-  if (mSocket.mFd < 0)
-    return false;
-
-  int sz = kBuffsize;
-
-  if (setsockopt(mSocket.mFd, SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz)) < 0)
-    return false;
-
-  // add FD_CLOEXEC flag
-  int flags = fcntl(mSocket.mFd, F_GETFD);
-  if (flags == -1) {
-      return false;
-  }
-  flags |= FD_CLOEXEC;
-  if (fcntl(mSocket.mFd, F_SETFD, flags) == -1)
-    return false;
-
-  // set non-blocking
-  if (fcntl(mSocket.mFd, F_SETFL, O_NONBLOCK) == -1)
-    return false;
-
-  struct sockaddr_nl saddr;
-  bzero(&saddr, sizeof(saddr));
-  saddr.nl_family = AF_NETLINK;
-  saddr.nl_groups = 1;
-  saddr.nl_pid = getpid();
-
-  if (bind(mSocket.mFd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1)
-    return false;
-
-  if (!mIOLoop->WatchFileDescriptor(mSocket.mFd,
-                                    true,
-                                    MessageLoopForIO::WATCH_READ,
-                                    &mReadWatcher,
-                                    this)) {
-      return false;
-  }
-
-  return true;
-}
-
-static nsAutoPtr<NetlinkPoller> sPoller;
-
-class UeventInitTask : public Task
-{
-  virtual void Run()
-  {
-    if (!sPoller) {
-      return;
-    }
-    if (sPoller->OpenSocket()) {
-      return;
-    }
-    sPoller->GetIOLoop()->PostDelayedTask(FROM_HERE, new UeventInitTask(), 1000);
-  }
-};
-
-void
-NetlinkPoller::OnFileCanReadWithoutBlocking(int fd)
-{
-  MOZ_ASSERT(fd == mSocket.mFd);
-  while (true) {
-    int ret = read(fd, mBuffer, kBuffsize);
-    if (ret == -1) {
-      if (errno == EAGAIN || errno == EWOULDBLOCK) {
-        return;
-      }
-      if (errno == EINTR) {
-        continue;
-      }
-    }
-    if (ret <= 0) {
-      // fatal error on netlink socket which should not happen
-      _exit(1);
-    }
-    mNetlinkEvent.decode(reinterpret_cast<char*>(mBuffer), ret);
-    mUeventObserverList.Broadcast(mNetlinkEvent);
-  }
-}
-
-static void
-InitializeUevent()
-{
-  MOZ_ASSERT(!sPoller);
-  sPoller = new NetlinkPoller();
-  sPoller->GetIOLoop()->PostTask(FROM_HERE, new UeventInitTask());
-
-}
-
-static void
-ShutdownUevent()
-{
-  sPoller = NULL;
-}
-
-void
-RegisterUeventListener(IUeventObserver *aObserver)
-{
-  MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
-
-  if (!sPoller)
-    InitializeUevent();
-  sPoller->RegisterObserver(aObserver);
-}
-
-void
-UnregisterUeventListener(IUeventObserver *aObserver)
-{
-  MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
-
-  sPoller->UnregisterObserver(aObserver);
-}
-
-} // hal_impl
-} // mozilla
-
deleted file mode 100644
--- a/hal/gonk/UeventPoller.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef _mozilla_uevent_poller_h_
-#define _mozilla_uevent_poller_h_
-
-#include <sysutils/NetlinkEvent.h>
-#include "mozilla/Observer.h"
-
-class NetlinkEvent;
-
-namespace mozilla {
-namespace hal_impl {
-
-typedef mozilla::Observer<NetlinkEvent> IUeventObserver;
-
-/**
- * Register for uevent notification. Note that the method should run on the
- * <b> IO Thread </b>
- * @aObserver the observer to be added. The observer's Notify() is only called
- * on the <b> IO Thread </b>
- */
-void RegisterUeventListener(IUeventObserver *aObserver);
-
-/**
- * Unregister for uevent notification. Note that the method should run on the
- * <b> IO Thread </b>
- * @aObserver the observer to be removed
- */
-void UnregisterUeventListener(IUeventObserver *aObserver);
-
-}
-}
-
-#endif
-
--- a/hal/linux/LinuxHal.cpp
+++ b/hal/linux/LinuxHal.cpp
@@ -86,26 +86,16 @@ GetScreenBrightness()
 {
   return 1;
 }
 
 void
 SetScreenBrightness(double brightness)
 {}
 
-bool
-GetCpuSleepAllowed()
-{
-  return true;
-}
-
-void
-SetCpuSleepAllowed(bool enabled)
-{}
-
 void
 EnableNetworkNotifications()
 {}
 
 void
 DisableNetworkNotifications()
 {}
 
--- a/hal/sandbox/PHal.ipdl
+++ b/hal/sandbox/PHal.ipdl
@@ -115,19 +115,16 @@ parent:
     EnableNetworkNotifications();
     DisableNetworkNotifications();
     sync GetCurrentNetworkInformation()
       returns (NetworkInformation aNetworkInfo);
 
     sync GetScreenEnabled() returns (bool enabled);
     SetScreenEnabled(bool enabled);
 
-    sync GetCpuSleepAllowed() returns (bool enabled);
-    SetCpuSleepAllowed(bool enabled);
-
     sync GetScreenBrightness() returns (double brightness);
     SetScreenBrightness(double brightness);
     
     AdjustSystemClock(int32 aDeltaMilliseconds);
     SetTimezone(nsCString aTimezoneSpec);
 
     sync SetLight(LightType light, LightConfiguration aConfig)
       returns (bool status);
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -133,30 +133,16 @@ GetScreenEnabled()
 }
 
 void
 SetScreenEnabled(bool enabled)
 {
   Hal()->SendSetScreenEnabled(enabled);
 }
 
-bool
-GetCpuSleepAllowed()
-{
-  bool enabled = false;
-  Hal()->SendGetCpuSleepAllowed(&enabled);
-  return enabled;
-}
-
-void
-SetCpuSleepAllowed(bool enabled)
-{
-  Hal()->SendSetCpuSleepAllowed(enabled);
-}
-
 double
 GetScreenBrightness()
 {
   double brightness = 0;
   Hal()->SendGetScreenBrightness(&brightness);
   return brightness;
 }
 
@@ -377,30 +363,16 @@ public:
   NS_OVERRIDE virtual bool
   RecvSetScreenEnabled(const bool &enabled)
   {
     hal::SetScreenEnabled(enabled);
     return true;
   }
 
   NS_OVERRIDE virtual bool
-  RecvGetCpuSleepAllowed(bool *enabled)
-  {
-    *enabled = hal::GetCpuSleepAllowed();
-    return true;
-  }
-
-  NS_OVERRIDE virtual bool
-  RecvSetCpuSleepAllowed(const bool &enabled)
-  {
-    hal::SetCpuSleepAllowed(enabled);
-    return true;
-  }
-
-  NS_OVERRIDE virtual bool
   RecvGetScreenBrightness(double *brightness)
   {
     *brightness = hal::GetScreenBrightness();
     return true;
   }
 
   NS_OVERRIDE virtual bool
   RecvSetScreenBrightness(const double &brightness)
--- a/hal/windows/WindowsHal.cpp
+++ b/hal/windows/WindowsHal.cpp
@@ -64,26 +64,16 @@ GetScreenBrightness()
 {
   return 1;
 }
 
 void
 SetScreenBrightness(double brightness)
 {}
 
-bool
-GetCpuSleepAllowed()
-{
-  return true;
-}
-
-void
-SetCpuSleepAllowed(bool enabled)
-{}
-
 void
 EnableNetworkNotifications()
 {}
 
 void
 DisableNetworkNotifications()
 {}
 
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -390,17 +390,16 @@ endif
 ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
 OS_LIBS += \
   -lui \
   -lmedia \
   -lhardware_legacy \
   -lhardware \
   -lutils \
   -lcutils \
-  -lsysutils \
   -lcamera_client \
   -lbinder \
   -lsensorservice \
   $(NULL)
 endif
 
 EXTRA_DEPS += \
   $(topsrcdir)/intl/unicharutil/util/objs.mk \