所有Android Init Language'触发器'的列表是什么?

Rib*_*ibo 12 android triggers init

在/init.rc和其他Android Init Language'.rc'文件中,可以有'actions'部分开始:'on'在init进程中发生事件时执行一系列命令.所有"触发器"的列表是什么?似乎看到了一些特定的关键字触发器,如'boot','init','fs','early-init'和'post-fs-data'.这是完整的清单吗?在代码的某个地方?(除了关键字触发器之外,还有一些表达式触发器,请参见下文.)

我见过一些关键字触发器,知道调用它们的时间和原因会很好:

boot
early-init
init
fs
post-fs-data
charger
nonencrypted  
Run Code Online (Sandbox Code Playgroud)

除关键字外,表达式的exmaples还包括:

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>
Run Code Online (Sandbox Code Playgroud)

pev*_*vik 17

您也可以使用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)
Run Code Online (Sandbox Code Playgroud)


MDM*_*wer 11

注意:在撰写本文时,所有链接都指向AOSP android-5.1.1_r18

触发器可以由开发人员(设备维护人员)定义,因此我们不希望找到完整的列表.但是,假设您最感兴趣的是默认情况下包含在AOSP中的那些,这里是流程:

操作中处理平台/系统/核心/初始化/ INIT.C通过action_for_each_trigger():

  1. early-init
  2. init
  3. charger 要么 late-init

如果charger遇到最后一个触发器,则这是AOSP定义列表的结束.制造商可以从这里补充随后的模式充电动作.

如果late-init是遇到的最后一个触发器,那么Android(platform/system/core/rootdir/init.rc)中包含的默认init.rc 开始运行以下触发器:

# Mount filesystems and start core system services.
on late-init
    trigger early-fs
    trigger fs
    trigger post-fs
    trigger post-fs-data

    # Load properties from /system/ + /factory after fs mount. Place
    # this in another action so that the load will be scheduled after the prior
    # issued fs triggers have completed.
    trigger load_all_props_action

    # Remove a file to wake up anything waiting for firmware.
    trigger firmware_mounts_complete

    trigger early-boot
    trigger boot
Run Code Online (Sandbox Code Playgroud)

  • 对于 [current master (android &gt; 6)](https://android.googlesource.com/platform/system/core/+/master/init/init.cpp) 它在方法 `am.QueueEventTrigger()` 中(init 是再次重写为 C++)。 (2认同)

Fai*_*l T -6

请参阅 AOSP 代码的 system/core/init 文件夹中的 README 文件。您可以在这里找到有关 android init 的所有详细信息。

Android O 操作系统自述文件链接:http://androidxref.com/8.0.0_r4/xref/system/core/init/README.md