mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 17:31:47 +09:00
parent
9195e9e4e3
commit
b586913598
53 changed files with 60 additions and 750 deletions
|
|
@ -12,28 +12,9 @@
|
|||
#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()
|
||||
{
|
||||
|
|
@ -44,14 +25,8 @@ Reboot()
|
|||
}
|
||||
}
|
||||
|
||||
#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
|
||||
|
|
@ -64,14 +39,8 @@ PowerOff()
|
|||
}
|
||||
}
|
||||
|
||||
#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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue