https://sx.ix5.org/info/android-init-stages/

.

Stages

Untitled Database

Adapted from Jonathan Levin’s excellent Android Internals: A Confectioner’s Cookbook, chapter 4.

Classes

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 on boot.

TODO: Overview of classes

Untitled Database

Untitled Database

Keywords (selection)

Untitled Database

Changes with encryption

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. keymaster and gatekeeper (TODO: Add link to AOSP init.rc for 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 class_start late_start

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