WEB开发网      婵傜晫鐝總钘夊瀻娴滎偓绱掓担鐘垫畱娑撯偓娴犺棄鍨庢禍顐fЦ閹存垳婊戦惃鍕娴犺棄濮╅崝娑崇幢鐠囧嘲鍨庢禍锟� ---閿曪拷
开发学院手机开发Android 开发 Android 启动过程汇总 阅读

Android 启动过程汇总

 2010-07-04 23:52:00 来源:WEB开发网 閵嗭拷閸戝繐鐨€涙ぞ缍�婢х偛銇囩€涙ぞ缍�閵嗭拷  閸忚櫕鏁炵拫閿嬪€嶉柨瀵告畱瀵邦喖宕�
核心提示: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
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>

...

Services

--------

Services are programs which init launches and (optionally) restarts when they exit. Services take the form of:

service < name> < pathname> [ < argument> ]*

< option>

...

Options

-------

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

Tags:Android 启动 过程

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