Adapted from Jonathan Levin’s excellent Android Internals: A Confectioner’s Cookbook, chapter 4.
Programs can be started based on init stage triggers:
service my_service /bin/mysvc user system group system disabled on boot start my_service
But it is more common to assign a
class to a service, based on which it is started:
service my_service /bin/mysvc class core user system group system
The service will be started based on
class_start core which happens
TODO: Overview of classes
With the introduction of system-wide encryption into Android, the init process gains a few more tricks: - vold.decrypt triggers -
class early_hal for crucial services needed for decryption, e.g.
gatekeeper (TODO: Add link to AOSP
class_start) - restarting framework, reboot, minimal UI stuff -
nonencrypted trigger, which, despite its name, always gets triggered and which pulls in
class_start main and
on property:vold.decrypt=trigger_restart_min_framework class_start main on property:vold.decrypt=trigger_restart_framework stop surfaceflinger start surfaceflinger class_start main class_start late_start on property:vold.decrypt=trigger_shutdown_framework class_reset late_start class_reset main