WEB开发网
开发学院手机开发Android 开发 Android 启动过程总结 阅读

Android 启动过程总结

 2010-06-01 18:42:00 来源:WEB开发网   
核心提示:and download firmwares.5. Initialize property system. Actually the property system is working as a share memory. Logically it looks like a registry under Window
and download firmwares.

5. Initialize property system. Actually the property system is working as a share memory. Logically it looks like a registry under Windows system.

6. Execute init action in the two files parsed in step 2.

7. Start property service.

8. Execute early-boot and boot actions in the two files parsed in step 2.

9. Execute property action in the two files parsed in step 2.

10. Enter into an indefinite loop to wait for device/property set/child process exit events. For example, if an SD card is plugined, init will receive a device add event, so it can make node for the device. Most of the important process is forked in init, so if any of them crashed, init will receive a SIGCHLD then translate it into a child process exit event, so in the loop init can handle the process exit event and execute the commands defined in *.rc(it will run command onrestart).

The .rc file is a script file defined by Android. The default is device/system/rootdir/init.rc. We can take a loot at the file format(device/system/init/readme.txt is a good overall introduction of the script). Basically the script file contains actions and services.

Actions

-------

Actions are named sequences of commands. Actions have a trigger which is used to determine when the action should occur. When an event occurs which matches an action's trigger, that action is added to the tail of a to-be-executed queue (unless it is already on the queue).

Each action in the queue is dequeued in sequence and each command in that action is executed in sequence. Init handles other activities (device creation/destruction, property setting, process restarting) "between" the execution of the commands in activities.

Actions take the form of:

on < trigger >

< command >

< command >

< command >

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:Android 启动 过程

编辑录入:coldstar [复制链接] [打 印]
赞助商链接