Minimize Boot Time of Android Device

knapsackyarnMobile - sans fil

14 déc. 2013 (il y a 3 années et 8 mois)

87 vue(s)

Minimize Boot Time of Android Device
ActivityManagerService:
Now, we will see how does process get started by Activity Manager. Broadcast

signal will goes to Activity Manager Service. HandleMessage() will handle all

broadcast message. To start any process, Activity Manager will receive an Intent

message. This Intent message contain two main part. One is act part which will give

you actor behind the Intent message, it means sender of Intent message. And other

part is cmp which represent component which is needed by actor or actor want to

start that component so service is available. On example of Intent is given below.
Intent { act = android.intent.action.BOOT_COMPLETE, cmp =

com.android.exchange, fig=0x10}
So, there is different Intent which is responsible to start different process

during the boot. There way of starting is common. Step for starting process during

boot is explained below.
1.
Intent will get broadcast as message and will get put in message queue handled

by Activity Manager.
2.
Activity Manager will execute
handleMessage()
function and will call

processNextBroadCast()
function.
3.
The purpose of
processNextBroadcast()
function is that it will read next

broadcast message from the message queue and it will give it to specific

process which is mentioned in cmp field of Intent message.
4.
If process is running for which broadcast message is sent then it will infrome

the process about message and send that message to it.
5.
If process is not running then startProcessLocked() is get called which will

call
Process.start()
function which will call
Zygote
to copy a new
dalvikvm

image and run the process code.
6.
Till know process is started not its service. So Once process is started, it will

do remote procedure call to
attachApplication()
function of Activity Manager.
7.
AttachApplication() will do remote procedure call
thread.bindApplication()

and then it will call
realStartServiceLocked()
function which will actually start

the service of process.
This way different processes get created during boot time. But creation of this

process is cost in-terms of boot time. Now, we know how does process is created so

we can think of avoiding of these process creation which can save boot time.