Bug 1382099 - Remove MOZ_WIDGET_GONK from hal/. r=gsvelto.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 24 Jul 2017 10:08:55 +1000
changeset 421617 c9b593e3e697f71dedf28c6a40e4db6a5b3462ab
parent 421616 7f8e505bfa44689c3025ef59f599917cbd9046c7
child 421618 f645062a665f4da4f1210776f794658a6b0ba858
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgsvelto
bugs1382099
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382099 - Remove MOZ_WIDGET_GONK from hal/. r=gsvelto.
hal/Hal.cpp
hal/linux/LinuxPower.cpp
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -84,29 +84,25 @@ InSandbox()
 }
 
 void
 AssertMainProcess()
 {
   MOZ_ASSERT(GeckoProcessType_Default == XRE_GetProcessType());
 }
 
-#if !defined(MOZ_WIDGET_GONK)
-
 bool
 WindowIsActive(nsPIDOMWindowInner* aWindow)
 {
   nsIDocument* document = aWindow->GetDoc();
   NS_ENSURE_TRUE(document, false);
 
   return !document->Hidden();
 }
 
-#endif // !defined(MOZ_WIDGET_GONK)
-
 StaticAutoPtr<WindowIdentifier::IDArrayType> gLastIDToVibrate;
 
 void InitLastIDToVibrate()
 {
   gLastIDToVibrate = new WindowIdentifier::IDArrayType();
   ClearOnShutdown(&gLastIDToVibrate);
 }
 
@@ -118,28 +114,26 @@ Vibrate(const nsTArray<uint32_t>& patter
   Vibrate(pattern, WindowIdentifier(window));
 }
 
 void
 Vibrate(const nsTArray<uint32_t>& pattern, const WindowIdentifier &id)
 {
   AssertMainThread();
 
-#if !defined(MOZ_WIDGET_GONK)
   // Only active windows may start vibrations.  If |id| hasn't gone
   // through the IPC layer -- that is, if our caller is the outside
   // world, not hal_proxy -- check whether the window is active.  If
   // |id| has gone through IPC, don't check the window's visibility;
   // only the window corresponding to the bottommost process has its
   // visibility state set correctly.
   if (!id.HasTraveledThroughIPC() && !WindowIsActive(id.GetWindow())) {
     HAL_LOG("Vibrate: Window is inactive, dropping vibrate.");
     return;
   }
-#endif // !defined(MOZ_WIDGET_GONK)
 
   if (!InSandbox()) {
     if (!gLastIDToVibrate) {
       InitLastIDToVibrate();
     }
     *gLastIDToVibrate = id.AsArray();
   }
 
--- a/hal/linux/LinuxPower.cpp
+++ b/hal/linux/LinuxPower.cpp
@@ -7,76 +7,45 @@
 #include "HalLog.h"
 
 #include <unistd.h>
 #include <sys/reboot.h>
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #include "MainThreadUtils.h"
 
-#if defined(MOZ_WIDGET_GONK)
-#include "cutils/android_reboot.h"
-#include "cutils/properties.h"
-#endif
-
 namespace mozilla {
 namespace hal_impl {
 
-#if (defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 19)
-static void
-PowerCtl(const char* aValue, int aCmd)
-{
-  // this invokes init's powerctl builtin via /init.rc
-  property_set("sys.powerctl", aValue);
-  // device should reboot in few moments, but if it doesn't - call
-  // android_reboot() to make sure that init isn't stuck somewhere
-  sleep(10);
-  HAL_LOG("Powerctl call takes too long, forcing %s.", aValue);
-  android_reboot(aCmd, 0, nullptr);
-}
-#endif
-
 void
 Reboot()
 {
   if (NS_IsMainThread()) {
     nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
     if (obsServ) {
       obsServ->NotifyObservers(nullptr, "system-reboot", nullptr);
     }
   }
 
-#if !defined(MOZ_WIDGET_GONK)
   sync();
   reboot(RB_AUTOBOOT);
-#elif (ANDROID_VERSION < 19)
-  android_reboot(ANDROID_RB_RESTART, 0, nullptr);
-#else
-  PowerCtl("reboot", ANDROID_RB_RESTART);
-#endif
 }
 
 void
 PowerOff()
 {
   if (NS_IsMainThread()) {
     nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
     if (obsServ) {
       obsServ->NotifyObservers(nullptr, "system-power-off", nullptr);
     }
   }
 
-#if !defined(MOZ_WIDGET_GONK)
   sync();
   reboot(RB_POWER_OFF);
-#elif (ANDROID_VERSION < 19)
-  android_reboot(ANDROID_RB_POWEROFF, 0, nullptr);
-#else
-  PowerCtl("shutdown", ANDROID_RB_POWEROFF);
-#endif
 }
 
 // Structure to specify how watchdog pthread is going to work.
 typedef struct watchdogParam
 {
   hal::ShutdownMode mode; // Specify how to shutdown the system.
   int32_t timeoutSecs;    // Specify the delayed seconds to shutdown the system.