Bug 1382955 (part 3) - Remove a bunch of unused HAL stuff. r=gsvelto,kanru.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 02 Aug 2017 10:09:32 +1000
changeset 413919 df3915693fa3bec56bacc17a4f2588f99ab635b4
parent 413918 2345ddc27945fb93f71de800f0cf79184c3c1550
child 413920 ec8efb7cf1d3dc1a473c32220ed40602174d01c4
push id67
push userfmarier@mozilla.com
push dateFri, 04 Aug 2017 23:53:21 +0000
reviewersgsvelto, kanru
bugs1382955
milestone56.0a1
Bug 1382955 (part 3) - Remove a bunch of unused HAL stuff. r=gsvelto,kanru.
hal/Hal.cpp
hal/Hal.h
hal/fallback/FallbackMemory.cpp
hal/fallback/FallbackScreenConfiguration.h
hal/fallback/FallbackScreenPower.cpp
hal/fallback/FallbackSwitch.cpp
hal/fallback/FallbackSystemService.cpp
hal/fallback/FallbackTime.cpp
hal/fallback/FallbackWakeLocks.cpp
hal/linux/LinuxMemory.cpp
hal/moz.build
hal/sandbox/PHal.ipdl
hal/sandbox/SandboxHal.cpp
ipc/ipdl/sync-messages.ini
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -383,68 +383,16 @@ GetCurrentBatteryInformation(BatteryInfo
 void
 NotifyBatteryChange(const BatteryInformation& aInfo)
 {
   AssertMainThread();
   BatteryObservers().CacheInformation(aInfo);
   BatteryObservers().BroadcastCachedInformation();
 }
 
-bool GetScreenEnabled()
-{
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetScreenEnabled(), false);
-}
-
-void SetScreenEnabled(bool aEnabled)
-{
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(SetScreenEnabled(aEnabled));
-}
-
-bool GetKeyLightEnabled()
-{
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetKeyLightEnabled(), false);
-}
-
-void SetKeyLightEnabled(bool aEnabled)
-{
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(SetKeyLightEnabled(aEnabled));
-}
-
-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(), true);
-}
-
-void SetCpuSleepAllowed(bool aAllowed)
-{
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(SetCpuSleepAllowed(aAllowed));
-}
-
-double GetScreenBrightness()
-{
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetScreenBrightness(), 0);
-}
-
-void SetScreenBrightness(double aBrightness)
-{
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(SetScreenBrightness(clamped(aBrightness, 0.0, 1.0)));
-}
-
 class SystemClockChangeObserversManager : public ObserversManager<int64_t>
 {
 protected:
   void EnableNotifications() override {
     PROXY_IF_SANDBOXED(EnableSystemClockChangeNotifications());
   }
 
   void DisableNotifications() override {
@@ -523,37 +471,16 @@ NotifySystemTimezoneChange(const SystemT
 void
 AdjustSystemClock(int64_t aDeltaMilliseconds)
 {
   AssertMainThread();
   PROXY_IF_SANDBOXED(AdjustSystemClock(aDeltaMilliseconds));
 }
 
 void
-SetTimezone(const nsCString& aTimezoneSpec)
-{
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(SetTimezone(aTimezoneSpec));
-}
-
-int32_t
-GetTimezoneOffset()
-{
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetTimezoneOffset(), 0);
-}
-
-nsCString
-GetTimezone()
-{
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetTimezone(), nsCString(""));
-}
-
-void
 EnableSensorNotifications(SensorType aSensor) {
   AssertMainThread();
   PROXY_IF_SANDBOXED(EnableSensorNotifications(aSensor));
 }
 
 void
 DisableSensorNotifications(SensorType aSensor) {
   AssertMainThread();
@@ -740,28 +667,16 @@ EnableSwitchNotifications(SwitchDevice a
 }
 
 void
 DisableSwitchNotifications(SwitchDevice aDevice) {
   AssertMainThread();
   PROXY_IF_SANDBOXED(DisableSwitchNotifications(aDevice));
 }
 
-SwitchState GetCurrentSwitchState(SwitchDevice aDevice)
-{
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetCurrentSwitchState(aDevice), SWITCH_STATE_UNKNOWN);
-}
-
-void NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState)
-{
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(NotifySwitchStateFromInputDevice(aDevice, aState));
-}
-
 typedef mozilla::ObserverList<SwitchEvent> SwitchObserverList;
 
 static SwitchObserverList *sSwitchObserverLists = nullptr;
 
 static SwitchObserverList&
 GetSwitchObserverList(SwitchDevice aDevice) {
   MOZ_ASSERT(0 <= aDevice && aDevice < NUM_SWITCH_DEVICE);
   if (sSwitchObserverLists == nullptr) {
@@ -900,40 +815,10 @@ StartDiskSpaceWatcher()
 void
 StopDiskSpaceWatcher()
 {
   AssertMainProcess();
   AssertMainThread();
   PROXY_IF_SANDBOXED(StopDiskSpaceWatcher());
 }
 
-uint32_t
-GetTotalSystemMemory()
-{
-  return hal_impl::GetTotalSystemMemory();
-}
-
-bool IsHeadphoneEventFromInputDev()
-{
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(IsHeadphoneEventFromInputDev(), false);
-}
-
-nsresult StartSystemService(const char* aSvcName, const char* aArgs)
-{
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(StartSystemService(aSvcName, aArgs), NS_ERROR_FAILURE);
-}
-
-void StopSystemService(const char* aSvcName)
-{
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(StopSystemService(aSvcName));
-}
-
-bool SystemServiceIsRunning(const char* aSvcName)
-{
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(SystemServiceIsRunning(aSvcName), false);
-}
-
 } // namespace hal
 } // namespace mozilla
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -104,70 +104,16 @@ void GetCurrentBatteryInformation(hal::B
 
 /**
  * Notify of a change in the battery state.
  * @param aBatteryInfo The new battery information.
  */
 void NotifyBatteryChange(const hal::BatteryInformation& aBatteryInfo);
 
 /**
- * Determine whether the device's screen is currently enabled.
- */
-bool GetScreenEnabled();
-
-/**
- * Enable or disable the device's screen.
- *
- * Note that it may take a few seconds for the screen to turn on or off.
- */
-void SetScreenEnabled(bool aEnabled);
-
-/**
- * Determine whether the device's keypad/button backlight is currently enabled.
- */
-bool GetKeyLightEnabled();
-
-/**
- * Enable or disable the device's keypad/button backlight.
- */
-void SetKeyLightEnabled(bool aEnabled);
-
-/**
- * Get the brightness of the device's screen's backlight, on a scale from 0
- * (very dim) to 1 (full blast).
- *
- * If the display is currently disabled, this returns the brightness the
- * backlight will have when the display is re-enabled.
- */
-double GetScreenBrightness();
-
-/**
- * Set the brightness of the device's screen's backlight, on a scale from 0
- * (very dimm) to 1 (full blast).  Values larger than 1 are treated like 1, and
- * values smaller than 0 are treated like 0.
- *
- * 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 aBrightness);
-
-/**
- * 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 aAllowed);
-
-/**
  * Register an observer for the sensor of given type.
  *
  * The observer will receive data whenever the data generated by the
  * sensor is avaiable.
  */
 void RegisterSensorObserver(hal::SensorType aSensor,
                             hal::ISensorObserver *aObserver);
 
@@ -226,35 +172,16 @@ void NotifyNetworkChange(const hal::Netw
 
 /**
  * Adjusting system clock.
  * @param aDeltaMilliseconds The difference compared with current system clock.
  */
 void AdjustSystemClock(int64_t aDeltaMilliseconds);
 
 /**
- * Set timezone
- * @param aTimezoneSpec The definition can be found in
- * http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
- */
-void SetTimezone(const nsCString& aTimezoneSpec);
-
-/**
- * Get timezone
- * http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
- */
-nsCString GetTimezone();
-
-/**
- * Get timezone offset
- * returns the timezone offset relative to UTC in minutes (DST effect included)
- */
-int32_t GetTimezoneOffset();
-
-/**
  * Register observer for system clock changed notification.
  * @param aObserver The observer that should be added.
  */
 void RegisterSystemClockChangeObserver(
   hal::SystemClockChangeObserver* aObserver);
 
 /**
  * Unregister the observer for system clock changed.
@@ -400,27 +327,16 @@ void UnregisterSwitchObserver(hal::Switc
 /**
  * Notify the state of the switch.
  *
  * This API is internal to hal; clients shouldn't call it directly.
  */
 void NotifySwitchChange(const hal::SwitchEvent& aEvent);
 
 /**
- * Get current switch information.
- */
-hal::SwitchState GetCurrentSwitchState(hal::SwitchDevice aDevice);
-
-/**
- * Notify switch status change from input device.
- */
-void NotifySwitchStateFromInputDevice(hal::SwitchDevice aDevice,
-                                      hal::SwitchState aState);
-
-/**
  * Return true if the current platform supports the setting of process
  * priority.
  */
 bool SetProcessPrioritySupported();
 
 /**
  * Set the priority of the given process.
  *
@@ -455,43 +371,16 @@ void StartDiskSpaceWatcher();
 
 /**
  * Stop monitoring disk space for low space situations.
  *
  * This API is currently only allowed to be used from the main process.
  */
 void StopDiskSpaceWatcher();
 
-/**
- * Get total system memory of device being run on in bytes.
- *
- * Returns 0 if we are unable to determine this information from /proc/meminfo.
- */
-uint32_t GetTotalSystemMemory();
-
-/**
- * Determine whether the headphone switch event is from input device
- */
-bool IsHeadphoneEventFromInputDev();
-
-/**
- * Start the system service with the specified name and arguments.
- */
-nsresult StartSystemService(const char* aSvcName, const char* aArgs);
-
-/**
- * Stop the system service with the specified name.
- */
-void StopSystemService(const char* aSvcName);
-
-/**
- * Determine whether the system service with the specified name is running.
- */
-bool SystemServiceIsRunning(const char* aSvcName);
-
 } // namespace MOZ_HAL_NAMESPACE
 } // namespace mozilla
 
 #ifdef MOZ_DEFINED_HAL_NAMESPACE
 # undef MOZ_DEFINED_HAL_NAMESPACE
 # undef MOZ_HAL_NAMESPACE
 #endif
 
deleted file mode 100644
--- a/hal/fallback/FallbackMemory.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* 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 "Hal.h"
-
-namespace mozilla {
-namespace hal_impl {
-
-uint32_t
-GetTotalSystemMemory()
-{
-	return 0;
-}
-
-} // namespace hal_impl
-} // namespace mozilla
--- a/hal/fallback/FallbackScreenConfiguration.h
+++ b/hal/fallback/FallbackScreenConfiguration.h
@@ -1,12 +1,15 @@
 /* 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_fallback_FallbackScreenConfiguration_h
+#define mozilla_fallback_FallbackScreenConfiguration_h
+
 #include "Hal.h"
 #include "mozilla/dom/ScreenOrientation.h"
 #include "nsIScreenManager.h"
 #include "nsServiceManagerUtils.h"
 
 namespace mozilla {
 namespace fallback {
 
@@ -34,9 +37,11 @@ GetCurrentScreenConfiguration(hal::Scree
                 ? dom::eScreenOrientation_LandscapePrimary
                 : dom::eScreenOrientation_PortraitPrimary;
 
   *aScreenConfiguration =
       hal::ScreenConfiguration(rect, orientation, 0, colorDepth, pixelDepth);
 }
 
 }
-}
\ No newline at end of file
+}
+
+#endif // mozilla_fallback_FallbackScreenConfiguration_h
deleted file mode 100644
--- a/hal/fallback/FallbackScreenPower.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- 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/. */
-
-namespace mozilla {
-namespace hal_impl {
-
-bool
-GetScreenEnabled()
-{
-  return true;
-}
-
-void
-SetScreenEnabled(bool aEnabled)
-{}
-
-bool
-GetKeyLightEnabled()
-{
-  return true;
-}
-
-void
-SetKeyLightEnabled(bool aEnabled)
-{}
-
-double
-GetScreenBrightness()
-{
-  return 1;
-}
-
-void
-SetScreenBrightness(double aBrightness)
-{}
-
-} // namespace hal_impl
-} // namespace mozilla
--- a/hal/fallback/FallbackSwitch.cpp
+++ b/hal/fallback/FallbackSwitch.cpp
@@ -15,25 +15,10 @@ EnableSwitchNotifications(SwitchDevice a
 {
 }
 
 void
 DisableSwitchNotifications(SwitchDevice aDevice)
 {
 }
 
-SwitchState
-GetCurrentSwitchState(SwitchDevice aDevice) {
-  return SWITCH_STATE_UNKNOWN;
-}
-
-void
-NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState)
-{
-}
-
-bool IsHeadphoneEventFromInputDev()
-{
-  return false;
-}
-
 } // namespace hal_impl
 } // namespace mozilla
deleted file mode 100644
--- a/hal/fallback/FallbackSystemService.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- 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 "Hal.h"
-
-namespace mozilla {
-namespace hal_impl {
-
-nsresult
-StartSystemService(const char* aSvcName, const char* aArgs)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-void
-StopSystemService(const char* aSvcName)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-}
-
-bool
-SystemServiceIsRunning(const char* aSvcName)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  return false;
-}
-
-} // namespace hal_impl
-} // namespace mozilla
--- a/hal/fallback/FallbackTime.cpp
+++ b/hal/fallback/FallbackTime.cpp
@@ -10,32 +10,16 @@
 namespace mozilla {
 namespace hal_impl {
 
 void
 AdjustSystemClock(int64_t aDeltaMilliseconds)
 {}
 
 void
-SetTimezone(const nsCString& aTimezoneSpec)
-{}
-
-nsCString
-GetTimezone()
-{
-  return EmptyCString();
-}
-
-int32_t
-GetTimezoneOffset()
-{
-  return 0;
-}
-
-void
 EnableSystemClockChangeNotifications()
 {
 }
 
 void
 DisableSystemClockChangeNotifications()
 {
 }
deleted file mode 100644
--- a/hal/fallback/FallbackWakeLocks.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- 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 "Hal.h"
-
-namespace mozilla {
-namespace hal_impl {
-
-bool
-GetCpuSleepAllowed()
-{
-  return true;
-}
-
-void
-SetCpuSleepAllowed(bool allowed)
-{}
-
-} // namespace hal_impl
-} // namespace mozilla
deleted file mode 100644
--- a/hal/linux/LinuxMemory.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* 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 <stdio.h>
-#include "Hal.h"
-
-namespace mozilla {
-namespace hal_impl {
-
-uint32_t
-GetTotalSystemMemory()
-{
-  static uint32_t sTotalMemory;
-  static bool sTotalMemoryObtained = false;
-
-  if (!sTotalMemoryObtained) {
-    sTotalMemoryObtained = true;
-
-    FILE* fd = fopen("/proc/meminfo", "r");
-    if (!fd) {
-      return 0;
-    }
-
-    int rv = fscanf(fd, "MemTotal: %i kB", &sTotalMemory);
-
-    if (fclose(fd) || rv != 1) {
-      return 0;
-    }
-  }
-
-  return sTotalMemory * 1024;
-}
-
-} // namespace hal_impl
-} // namespace mozilla
--- a/hal/moz.build
+++ b/hal/moz.build
@@ -33,89 +33,80 @@ SOURCES += [
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     LOCAL_INCLUDES += [
         '/widget/android',
     ]
     UNIFIED_SOURCES += [
         'android/AndroidSensor.cpp',
-        'linux/LinuxMemory.cpp',
     ]
     # AndroidHal.cpp cannot be built in unified mode because it relies on HalImpl.h.
     SOURCES += [
         'android/AndroidHal.cpp',
     ]
 elif CONFIG['OS_TARGET'] == 'Linux':
     UNIFIED_SOURCES += [
         'fallback/FallbackScreenConfiguration.cpp',
         'fallback/FallbackSensor.cpp',
         'fallback/FallbackVibration.cpp',
-        'linux/LinuxMemory.cpp',
     ]
     if CONFIG['MOZ_ENABLE_DBUS']:
         UNIFIED_SOURCES += [
             'linux/UPowerClient.cpp',
         ]
     else:
         UNIFIED_SOURCES += [
             'fallback/FallbackBattery.cpp',
         ]
 elif CONFIG['OS_TARGET'] == 'WINNT':
     UNIFIED_SOURCES += [
-        'fallback/FallbackMemory.cpp',
         'fallback/FallbackScreenConfiguration.cpp',
         'fallback/FallbackVibration.cpp',
         'windows/WindowsSensor.cpp',
     ]
     # WindowsBattery.cpp cannot be built in unified mode because it relies on HalImpl.h.
     SOURCES += [
         'windows/WindowsBattery.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     UNIFIED_SOURCES += [
         'cocoa/CocoaBattery.cpp',
-        'fallback/FallbackMemory.cpp',
         'fallback/FallbackScreenConfiguration.cpp',
         'fallback/FallbackVibration.cpp',
     ]
 elif CONFIG['OS_TARGET'] in ('OpenBSD', 'NetBSD', 'FreeBSD', 'DragonFly'):
     UNIFIED_SOURCES += [
-        'fallback/FallbackMemory.cpp',
         'fallback/FallbackScreenConfiguration.cpp',
         'fallback/FallbackSensor.cpp',
         'fallback/FallbackVibration.cpp',
     ]
     if CONFIG['MOZ_ENABLE_DBUS']:
         UNIFIED_SOURCES += [
             'linux/UPowerClient.cpp',
         ]
     else:
         UNIFIED_SOURCES += [
             'fallback/FallbackBattery.cpp',
         ]
 else:
     UNIFIED_SOURCES += [
         'fallback/FallbackBattery.cpp',
-        'fallback/FallbackMemory.cpp',
         'fallback/FallbackScreenConfiguration.cpp',
         'fallback/FallbackSensor.cpp',
         'fallback/FallbackVibration.cpp',
     ]
 
 # Fallbacks for backends implemented on Gonk only.
 UNIFIED_SOURCES += [
     'fallback/FallbackDiskSpaceWatcher.cpp',
     'fallback/FallbackProcessPriority.cpp',
-    'fallback/FallbackScreenPower.cpp',
     'fallback/FallbackSwitch.cpp',
-    'fallback/FallbackSystemService.cpp',
     'fallback/FallbackThreadPriority.cpp',
     'fallback/FallbackTime.cpp',
-    'fallback/FallbackWakeLocks.cpp',
 ]
 
 # Fallbacks for backends implemented on Android only.
 if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
     UNIFIED_SOURCES += [
         'fallback/FallbackNetwork.cpp',
     ]
 
--- a/hal/sandbox/PHal.ipdl
+++ b/hal/sandbox/PHal.ipdl
@@ -93,34 +93,17 @@ parent:
     sync GetCurrentBatteryInformation()
       returns (BatteryInformation aBatteryInfo);
 
     async EnableNetworkNotifications();
     async DisableNetworkNotifications();
     sync GetCurrentNetworkInformation()
       returns (NetworkInformation aNetworkInfo);
 
-    sync GetScreenEnabled() returns (bool enabled);
-    async SetScreenEnabled(bool aEnabled);
-
-    sync GetKeyLightEnabled() returns (bool enabled);
-    async SetKeyLightEnabled(bool aEnabled);
-
-    sync GetCpuSleepAllowed() returns (bool allowed);
-    async SetCpuSleepAllowed(bool aAllowed);
-
-    sync GetScreenBrightness() returns (double brightness);
-    async SetScreenBrightness(double aBrightness);
-
     async AdjustSystemClock(int64_t aDeltaMilliseconds);
-    async SetTimezone(nsCString aTimezoneSpec);
-    sync GetTimezone()
-      returns (nsCString aTimezoneSpec);
-    sync GetTimezoneOffset()
-      returns (int32_t aTimezoneOffset);
     async EnableSystemClockChangeNotifications();
     async DisableSystemClockChangeNotifications();
     async EnableSystemTimezoneChangeNotifications();
     async DisableSystemTimezoneChangeNotifications();
 
     async ModifyWakeLock(nsString aTopic,
                          WakeLockControl aLockAdjust,
                          WakeLockControl aHiddenAdjust,
@@ -133,18 +116,16 @@ parent:
     async EnableScreenConfigurationNotifications();
     async DisableScreenConfigurationNotifications();
     sync LockScreenOrientation(ScreenOrientationInternal aOrientation)
       returns (bool allowed);
     async UnlockScreenOrientation();
  
     async EnableSwitchNotifications(SwitchDevice aDevice);
     async DisableSwitchNotifications(SwitchDevice aDevice);
-    sync GetCurrentSwitchState(SwitchDevice aDevice)
-      returns (SwitchState aState);
 
 child:
     async NotifySensorChange(SensorData aSensorData);
 
 parent:
     async EnableSensorNotifications(SensorType aSensor);
     async DisableSensorNotifications(SensorType aSensor);
 
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -131,101 +131,23 @@ LockScreenOrientation(const dom::ScreenO
 }
 
 void
 UnlockScreenOrientation()
 {
   Hal()->SendUnlockScreenOrientation();
 }
 
-bool
-GetScreenEnabled()
-{
-  bool enabled = false;
-  Hal()->SendGetScreenEnabled(&enabled);
-  return enabled;
-}
-
-void
-SetScreenEnabled(bool aEnabled)
-{
-  Hal()->SendSetScreenEnabled(aEnabled);
-}
-
-bool
-GetKeyLightEnabled()
-{
-  bool enabled = false;
-  Hal()->SendGetKeyLightEnabled(&enabled);
-  return enabled;
-}
-
-void
-SetKeyLightEnabled(bool aEnabled)
-{
-  Hal()->SendSetKeyLightEnabled(aEnabled);
-}
-
-bool
-GetCpuSleepAllowed()
-{
-  bool allowed = true;
-  Hal()->SendGetCpuSleepAllowed(&allowed);
-  return allowed;
-}
-
-void
-SetCpuSleepAllowed(bool aAllowed)
-{
-  Hal()->SendSetCpuSleepAllowed(aAllowed);
-}
-
-double
-GetScreenBrightness()
-{
-  double brightness = 0;
-  Hal()->SendGetScreenBrightness(&brightness);
-  return brightness;
-}
-
-void
-SetScreenBrightness(double aBrightness)
-{
-  Hal()->SendSetScreenBrightness(aBrightness);
-}
-
 void
 AdjustSystemClock(int64_t aDeltaMilliseconds)
 {
   Hal()->SendAdjustSystemClock(aDeltaMilliseconds);
 }
 
 void
-SetTimezone(const nsCString& aTimezoneSpec)
-{
-  Hal()->SendSetTimezone(nsCString(aTimezoneSpec));
-}
-
-nsCString
-GetTimezone()
-{
-  nsCString timezone;
-  Hal()->SendGetTimezone(&timezone);
-  return timezone;
-}
-
-int32_t
-GetTimezoneOffset()
-{
-  int32_t timezoneOffset;
-  Hal()->SendGetTimezoneOffset(&timezoneOffset);
-  return timezoneOffset;
-}
-
-void
 EnableSystemClockChangeNotifications()
 {
   Hal()->SendEnableSystemClockChangeNotifications();
 }
 
 void
 DisableSystemClockChangeNotifications()
 {
@@ -289,32 +211,16 @@ EnableSwitchNotifications(SwitchDevice a
 }
 
 void
 DisableSwitchNotifications(SwitchDevice aDevice)
 {
   Hal()->SendDisableSwitchNotifications(aDevice);
 }
 
-SwitchState
-GetCurrentSwitchState(SwitchDevice aDevice)
-{
-  SwitchState state;
-  Hal()->SendGetCurrentSwitchState(aDevice, &state);
-  return state;
-}
-
-void
-NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState)
-{
-  Unused << aDevice;
-  Unused << aState;
-  NS_RUNTIMEABORT("Only the main process may notify switch state change.");
-}
-
 bool
 EnableAlarm()
 {
   NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts.  Yet.");
   return false;
 }
 
 void
@@ -363,39 +269,16 @@ StartDiskSpaceWatcher()
 }
 
 void
 StopDiskSpaceWatcher()
 {
   MOZ_CRASH("StopDiskSpaceWatcher() can't be called from sandboxed contexts.");
 }
 
-bool IsHeadphoneEventFromInputDev()
-{
-  MOZ_CRASH("IsHeadphoneEventFromInputDev() cannot be called from sandboxed contexts.");
-  return false;
-}
-
-nsresult StartSystemService(const char* aSvcName, const char* aArgs)
-{
-  MOZ_CRASH("System services cannot be controlled from sandboxed contexts.");
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-void StopSystemService(const char* aSvcName)
-{
-  MOZ_CRASH("System services cannot be controlled from sandboxed contexts.");
-}
-
-bool SystemServiceIsRunning(const char* aSvcName)
-{
-  MOZ_CRASH("System services cannot be controlled from sandboxed contexts.");
-  return false;
-}
-
 class HalParent : public PHalParent
                 , public BatteryObserver
                 , public NetworkObserver
                 , public ISensorObserver
                 , public WakeLockObserver
                 , public ScreenConfigurationObserver
                 , public SwitchObserver
                 , public SystemClockChangeObserver
@@ -532,100 +415,23 @@ public:
     return IPC_OK();
   }
 
   void Notify(const ScreenConfiguration& aScreenConfiguration) override {
     Unused << SendNotifyScreenConfigurationChange(aScreenConfiguration);
   }
 
   virtual mozilla::ipc::IPCResult
-  RecvGetScreenEnabled(bool* aEnabled) override
-  {
-    *aEnabled = hal::GetScreenEnabled();
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
-  RecvSetScreenEnabled(const bool& aEnabled) override
-  {
-    hal::SetScreenEnabled(aEnabled);
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
-  RecvGetKeyLightEnabled(bool* aEnabled) override
-  {
-    *aEnabled = hal::GetKeyLightEnabled();
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
-  RecvSetKeyLightEnabled(const bool& aEnabled) override
-  {
-    hal::SetKeyLightEnabled(aEnabled);
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
-  RecvGetCpuSleepAllowed(bool* aAllowed) override
-  {
-    *aAllowed = hal::GetCpuSleepAllowed();
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
-  RecvSetCpuSleepAllowed(const bool& aAllowed) override
-  {
-    hal::SetCpuSleepAllowed(aAllowed);
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
-  RecvGetScreenBrightness(double* aBrightness) override
-  {
-    *aBrightness = hal::GetScreenBrightness();
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
-  RecvSetScreenBrightness(const double& aBrightness) override
-  {
-    hal::SetScreenBrightness(aBrightness);
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
   RecvAdjustSystemClock(const int64_t &aDeltaMilliseconds) override
   {
     hal::AdjustSystemClock(aDeltaMilliseconds);
     return IPC_OK();
   }
 
   virtual mozilla::ipc::IPCResult
-  RecvSetTimezone(const nsCString& aTimezoneSpec) override
-  {
-    hal::SetTimezone(aTimezoneSpec);
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
-  RecvGetTimezone(nsCString *aTimezoneSpec) override
-  {
-    *aTimezoneSpec = hal::GetTimezone();
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
-  RecvGetTimezoneOffset(int32_t *aTimezoneOffset) override
-  {
-    *aTimezoneOffset = hal::GetTimezoneOffset();
-    return IPC_OK();
-  }
-
-  virtual mozilla::ipc::IPCResult
   RecvEnableSystemClockChangeNotifications() override
   {
     hal::RegisterSystemClockChangeObserver(this);
     return IPC_OK();
   }
 
   virtual mozilla::ipc::IPCResult
   RecvDisableSystemClockChangeNotifications() override
@@ -721,24 +527,16 @@ public:
     return IPC_OK();
   }
 
   void Notify(const SwitchEvent& aSwitchEvent) override
   {
     Unused << SendNotifySwitchChange(aSwitchEvent);
   }
 
-  virtual mozilla::ipc::IPCResult
-  RecvGetCurrentSwitchState(const SwitchDevice& aDevice, hal::SwitchState *aState) override
-  {
-    // Content has no reason to listen to switch events currently.
-    *aState = hal::GetCurrentSwitchState(aDevice);
-    return IPC_OK();
-  }
-
   void Notify(const int64_t& aClockDeltaMS) override
   {
     Unused << SendNotifySystemClockChange(aClockDeltaMS);
   }
 
   void Notify(const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo) override
   {
     Unused << SendNotifySystemTimezoneChange(aSystemTimezoneChangeInfo);
--- a/ipc/ipdl/sync-messages.ini
+++ b/ipc/ipdl/sync-messages.ini
@@ -1048,34 +1048,20 @@ description = test only
 [PWebRenderBridge::GetAPZTestData]
 description = test only
 [PWebRenderBridge::ShutdownSync]
 description = bug 1377024
 [PHal::GetCurrentBatteryInformation]
 description =
 [PHal::GetCurrentNetworkInformation]
 description =
-[PHal::GetScreenEnabled]
-description =
-[PHal::GetKeyLightEnabled]
-description =
-[PHal::GetCpuSleepAllowed]
-description =
-[PHal::GetScreenBrightness]
-description =
-[PHal::GetTimezone]
-description =
-[PHal::GetTimezoneOffset]
-description =
 [PHal::GetWakeLockInfo]
 description =
 [PHal::LockScreenOrientation]
 description =
-[PHal::GetCurrentSwitchState]
-description =
 [PCookieService::GetCookieString]
 description =
 [PPrinting::SavePrintSettings]
 description =
 [PHandlerService::FillHandlerInfo]
 description =
 [PHandlerService::Exists]
 description =