From ca47cef7491caf6072984d9d64c768717baad09a Mon Sep 17 00:00:00 2001 From: Dima Zavin Date: Wed, 24 Aug 2011 15:28:23 -0700 Subject: init: add charge mode handling Introduces a 'charger' section that is processed when androidboot.mode supplied on the kernel commandline is "charger". In this mode, sections such as fs, post-fs, etc are skipped. Only the 'early-init' and 'init' sections of the init rc files are processed before processing the 'charger' section. Change-Id: If9eb6334de18f04cbcf2aab784578e2993615242 Signed-off-by: Dima Zavin --- init/init.c | 23 +++++++++++++++-------- rootdir/init.rc | 3 +++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/init/init.c b/init/init.c index eab14f6..5058b17 100755 --- a/init/init.c +++ b/init/init.c @@ -744,20 +744,27 @@ int main(int argc, char **argv) queue_builtin_action(console_init_action, "console_init"); queue_builtin_action(set_init_properties_action, "set_init_properties"); - /* execute all the boot actions to get us started */ + /* execute all the boot actions to get us started */ action_for_each_trigger("init", action_add_queue_tail); - 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); + + /* skip mounting filesystems in charger mode */ + if (strcmp(bootmode, "charger") != 0) { + 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); + } 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"); - /* execute all the boot actions to get us started */ - action_for_each_trigger("early-boot", action_add_queue_tail); - action_for_each_trigger("boot", action_add_queue_tail); + if (!strcmp(bootmode, "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); + } /* run all property triggers based on current state of the properties */ queue_builtin_action(queue_property_triggers_action, "queue_propety_triggers"); diff --git a/rootdir/init.rc b/rootdir/init.rc index 8d6bf97..a5a0bc0 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -263,6 +263,9 @@ on boot on nonencrypted class_start late_start +on charger + class_start charger + on property:vold.decrypt=trigger_reset_main class_reset main -- cgit v1.1