What is the list of all Android Init Language 'triggers'?

Ribo picture Ribo · Mar 14, 2015 · Viewed 15.5k times · Source

In /init.rc and the other Android Init Language '.rc' files, there can be 'actions' sections that start: 'on ' to execute a sequence of commands when an event occurs in the init process. What is the list of all 'triggers'? There seem to see some specific keyword triggers, like 'boot', 'init', 'fs', 'early-init' and 'post-fs-data'. Is this a complete list of these? In the code somewhere? (In addition to the keyword triggers there are some expression triggers, see below.)

Some keyword triggers I've seen, it would be nice to know when and why they are called:

boot
early-init
init
fs
post-fs-data
charger
nonencrypted  

In addition to keywords, exmaples of expressions include:

property:ro.factory.tool=1     -- when a property is set to a value
device-added-<path>  -- Triggered when a node is added when the equipment
device-removed-<path>  -- When the device is removed to add nodes
service-exited-<name>

Answer

pevik picture pevik · Jan 7, 2016

You can also list it on connected phone / emulator with adb:

$ adb shell dmesg | grep "processing action"
[    4.376074] init: processing action 0x35480 (init)
[    4.440537] init: processing action 0x38c58 (init)
[    4.450009] init: processing action 0x35708 (early-fs)
[    5.531812] init: processing action 0x39c38 (console_init)
[    5.575831] init: processing action 0x2de70 (fs)
[    5.597799] init: processing action 0x35890 (fs)
[    7.089157] init: processing action 0x2df58 (post-fs)
[    7.091550] init: processing action 0x38cb8 (post-fs)
[    7.091818] init: processing action 0x2e288 (post-fs-data)
[    7.100189] init: processing action 0x39c80 (property_service_init)
[    7.110080] init: processing action 0x39cc8 (signal_init)
[    7.110177] init: processing action 0x39d10 (check_startup)
[    7.110248] init: processing action 0x2ea18 (boot)
[    7.126205] init: processing action 0x397e0 (boot)
[    8.183090] init: processing action 0x39d58 (queue_property_triggers)
[    8.183232] init: processing action 0x2f8f8 (nonencrypted)
[    8.183810] init: processing action 0x2fd98 (property:ro.debuggable=1)
[    8.184463] init: processing action 0x328f8 (property:sys.usb.config=none)
[   14.438626] init: processing action 0x2ffd0 (property:sys.sensors=1)
[   28.192393] init: processing action 0x31860 (property:sys.boot_completed=1)