summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2011-08-24 15:28:23 -0700
committerDima Zavin <dima@android.com>2011-09-02 12:11:18 -0700
commitca47cef7491caf6072984d9d64c768717baad09a (patch)
tree5006f6414601e21b1141746ea150f13bcdb1da00
parentda04c52ab1036048520fca265cf02b61dca789e0 (diff)
downloadsystem_core-ca47cef7491caf6072984d9d64c768717baad09a.zip
system_core-ca47cef7491caf6072984d9d64c768717baad09a.tar.gz
system_core-ca47cef7491caf6072984d9d64c768717baad09a.tar.bz2
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 <dima@android.com>
-rwxr-xr-xinit/init.c23
-rw-r--r--rootdir/init.rc3
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