summaryrefslogtreecommitdiffstats
path: root/charger/charger.c
diff options
context:
space:
mode:
authorRiley Andrews <riandrews@google.com>2014-06-16 15:06:21 -0700
committerRiley Andrews <riandrews@google.com>2014-06-20 16:43:00 -0700
commite4b7b294f37d9b64d6b7c1931e2c9bfb1a500d68 (patch)
tree5a7481adbd875eaa1e74ef2e1dbc5f11c9323141 /charger/charger.c
parentdbb93515c9a1a60a6e824e789920f43d625a8c2a (diff)
downloadsystem_core-e4b7b294f37d9b64d6b7c1931e2c9bfb1a500d68.tar.gz
system_core-e4b7b294f37d9b64d6b7c1931e2c9bfb1a500d68.tar.bz2
system_core-e4b7b294f37d9b64d6b7c1931e2c9bfb1a500d68.zip
Add ability to boot from charger mode.
Add the ability to boot up directly from charger mode, instead of forcing charger mode to initiate a full restart to launch 'full' android. This should shave a few seconds off of boot time on supported devices (just manta for now). Change-Id: Ieec4494d929e92806e039f834d78b9002afd15c4
Diffstat (limited to 'charger/charger.c')
-rw-r--r--charger/charger.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/charger/charger.c b/charger/charger.c
index e3cadb1dd..15add87d0 100644
--- a/charger/charger.c
+++ b/charger/charger.c
@@ -40,6 +40,7 @@
#include <cutils/list.h>
#include <cutils/misc.h>
#include <cutils/uevent.h>
+#include <cutils/properties.h>
#ifdef CHARGER_ENABLE_SUSPEND
#include <suspend/autosuspend.h>
@@ -830,8 +831,16 @@ static void process_key(struct charger *charger, int code, int64_t now)
if (key->down) {
int64_t reboot_timeout = key->timestamp + POWER_ON_KEY_TIME;
if (now >= reboot_timeout) {
- LOGI("[%lld] rebooting\n", now);
- android_reboot(ANDROID_RB_RESTART, 0, 0);
+ /* We do not currently support booting from charger mode on
+ all devices. Check the property and continue booting or reboot
+ accordingly. */
+ if (property_get_bool("ro.enable_boot_charger_mode", false)) {
+ LOGI("[%lld] booting from charger mode\n", now);
+ property_set("sys.boot_from_charger_mode", "1");
+ } else {
+ LOGI("[%lld] rebooting\n", now);
+ android_reboot(ANDROID_RB_RESTART, 0, 0);
+ }
} else {
/* if the key is pressed but timeout hasn't expired,
* make sure we wake up at the right-ish time to check