diff options
author | Riley Andrews <riandrews@google.com> | 2014-06-23 15:20:51 -0700 |
---|---|---|
committer | Riley Andrews <riandrews@google.com> | 2014-06-23 15:20:51 -0700 |
commit | 6bd4588d65977956cadf2e5d384673c64329c8e8 (patch) | |
tree | f9f56e60e15c9b1a244e28e920acd064f70f44f2 | |
parent | 62ecd51f8a5435e925382ee1f0064655b75cc936 (diff) | |
parent | 079c637f3d269242bbc772b9207179b8cf56738a (diff) | |
download | system_core-6bd4588d65977956cadf2e5d384673c64329c8e8.zip system_core-6bd4588d65977956cadf2e5d384673c64329c8e8.tar.gz system_core-6bd4588d65977956cadf2e5d384673c64329c8e8.tar.bz2 |
resolved conflicts for merge of 079c637f to master
Change-Id: Iab9a857026de954d7497d6b0eaf3751d2d3904c7
-rw-r--r-- | healthd/healthd_mode_charger.cpp | 14 | ||||
-rw-r--r-- | init/builtins.c | 8 | ||||
-rw-r--r-- | init/init.c | 16 | ||||
-rw-r--r-- | init/init_parser.c | 1 | ||||
-rw-r--r-- | init/keywords.h | 2 | ||||
-rw-r--r-- | init/property_service.c | 9 | ||||
-rw-r--r-- | init/property_service.h | 1 | ||||
-rw-r--r-- | rootdir/init.rc | 25 |
8 files changed, 58 insertions, 18 deletions
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp index 86610b2..d11f609 100644 --- a/healthd/healthd_mode_charger.cpp +++ b/healthd/healthd_mode_charger.cpp @@ -37,6 +37,8 @@ #include <cutils/android_reboot.h> #include <cutils/klog.h> #include <cutils/misc.h> +#include <cutils/uevent.h> +#include <cutils/properties.h> #ifdef CHARGER_ENABLE_SUSPEND #include <suspend/autosuspend.h> @@ -498,8 +500,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("[%" PRId64 "] 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("[%" PRId64 "] booting from charger mode\n", now); + property_set("sys.boot_from_charger_mode", "1"); + } else { + LOGI("[%" PRId64 "] 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 diff --git a/init/builtins.c b/init/builtins.c index 37bbaa3..63a52c3 100644 --- a/init/builtins.c +++ b/init/builtins.c @@ -881,6 +881,14 @@ int do_load_persist_props(int nargs, char **args) { return -1; } +int do_load_all_props(int nargs, char **args) { + if (nargs == 1) { + load_all_props(); + return 0; + } + return -1; +} + int do_wait(int nargs, char **args) { if (nargs == 2) { diff --git a/init/init.c b/init/init.c index c79929b..97c33e4 100644 --- a/init/init.c +++ b/init/init.c @@ -1051,8 +1051,7 @@ int main(int argc, char **argv) is_charger = !strcmp(bootmode, "charger"); INFO("property init\n"); - if (!is_charger) - property_load_boot_defaults(); + property_load_boot_defaults(); INFO("reading config file\n"); init_parse_config_file("/init.rc"); @@ -1067,28 +1066,19 @@ int main(int argc, char **argv) /* execute all the boot actions to get us started */ action_for_each_trigger("init", action_add_queue_tail); - /* skip mounting filesystems in charger mode */ - if (!is_charger) { - action_for_each_trigger("early-fs", action_add_queue_tail); - action_for_each_trigger("fs", action_add_queue_tail); - action_for_each_trigger("post-fs", action_add_queue_tail); - action_for_each_trigger("post-fs-data", action_add_queue_tail); - } - /* Repeat mix_hwrng_into_linux_rng in case /dev/hw_random or /dev/random * wasn't ready immediately after wait_for_coldboot_done */ queue_builtin_action(mix_hwrng_into_linux_rng_action, "mix_hwrng_into_linux_rng"); - queue_builtin_action(property_service_init_action, "property_service_init"); queue_builtin_action(signal_init_action, "signal_init"); queue_builtin_action(check_startup_action, "check_startup"); + /* Don't mount filesystems or start core system services if in charger mode. */ if (is_charger) { action_for_each_trigger("charger", action_add_queue_tail); } else { - action_for_each_trigger("early-boot", action_add_queue_tail); - action_for_each_trigger("boot", action_add_queue_tail); + action_for_each_trigger("late-init", action_add_queue_tail); } /* run all property triggers based on current state of the properties */ diff --git a/init/init_parser.c b/init/init_parser.c index 7800082..289e759 100644 --- a/init/init_parser.c +++ b/init/init_parser.c @@ -120,6 +120,7 @@ static int lookup_keyword(const char *s) case 'l': if (!strcmp(s, "oglevel")) return K_loglevel; if (!strcmp(s, "oad_persist_props")) return K_load_persist_props; + if (!strcmp(s, "oad_all_props")) return K_load_all_props; break; case 'm': if (!strcmp(s, "kdir")) return K_mkdir; diff --git a/init/keywords.h b/init/keywords.h index 6625330..2d97e5b 100644 --- a/init/keywords.h +++ b/init/keywords.h @@ -39,6 +39,7 @@ int do_chown(int nargs, char **args); int do_chmod(int nargs, char **args); int do_loglevel(int nargs, char **args); int do_load_persist_props(int nargs, char **args); +int do_load_all_props(int nargs, char **args); int do_wait(int nargs, char **args); #define __MAKE_KEYWORD_ENUM__ #define KEYWORD(symbol, flags, nargs, func) K_##symbol, @@ -101,6 +102,7 @@ enum { KEYWORD(chmod, COMMAND, 2, do_chmod) KEYWORD(loglevel, COMMAND, 1, do_loglevel) KEYWORD(load_persist_props, COMMAND, 0, do_load_persist_props) + KEYWORD(load_all_props, COMMAND, 0, do_load_all_props) KEYWORD(ioprio, OPTION, 0, 0) #ifdef __MAKE_KEYWORD_ENUM__ KEYWORD_COUNT, diff --git a/init/property_service.c b/init/property_service.c index 97f281f..7b4814f 100644 --- a/init/property_service.c +++ b/init/property_service.c @@ -640,10 +640,8 @@ void load_persist_props(void) load_persistent_properties(); } -void start_property_service(void) +void load_all_props(void) { - int fd; - load_properties_from_file(PROP_PATH_SYSTEM_BUILD, NULL); load_properties_from_file(PROP_PATH_SYSTEM_DEFAULT, NULL); load_properties_from_file(PROP_PATH_FACTORY, "ro.*"); @@ -652,6 +650,11 @@ void start_property_service(void) /* Read persistent properties after all default values have been loaded. */ load_persistent_properties(); +} + +void start_property_service(void) +{ + int fd; fd = create_socket(PROP_SERVICE_NAME, SOCK_STREAM, 0666, 0, 0, NULL); if(fd < 0) return; diff --git a/init/property_service.h b/init/property_service.h index 46cbd8f..730495e 100644 --- a/init/property_service.h +++ b/init/property_service.h @@ -24,6 +24,7 @@ extern void handle_property_set_fd(void); extern void property_init(void); extern void property_load_boot_defaults(void); extern void load_persist_props(void); +extern void load_all_props(void); extern void start_property_service(void); void get_property_workspace(int *fd, int *sz); extern int __property_get(const char *name, char *value); diff --git a/rootdir/init.rc b/rootdir/init.rc index 8a4a37d..7d2addb 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -158,6 +158,31 @@ on init chown system log /sys/fs/pstore/console-ramoops chmod 0440 /sys/fs/pstore/console-ramoops +# Healthd can trigger a full boot from charger mode by signaling this +# property when the power button is held. +on property:sys.boot_from_charger_mode=1 + class_stop charger + trigger late-init + +# Load properties from /system/ + /factory after fs mount. +on load_all_props_action + load_all_props + +# Mount filesystems and start core system services. +on late-init + trigger early-fs + trigger fs + trigger post-fs + trigger post-fs-data + + # Load properties from /system/ + /factory after fs mount. Place + # this in another action so that the load will be scheduled after the prior + # issued fs triggers have completed. + trigger load_all_props_action + + trigger early-boot + trigger boot + on post-fs # once everything is setup, no need to modify / mount rootfs rootfs / ro remount |