This section describes how to start the Android system after kernel init. For more information, see froyo.
A) started in init. RC:
1) servicemanager (source code is in frameswork/base/cmds/servicemanager/service_manager.c)
2) app_process (source code in frameworks/base/cmds/app_process/app_main.cpp)
3) mediaserver (source code in frameworks/base/Media/mediaserver/main_mediaserver.cpp)
B) The main () of app_process calls appruntime (the source code is in frameworks/base/CORE/JNI/androidruntime. CPP. android. internal. OS. input zygoteinit.
C) The start () method of appruntime finally calls zygoteinit (source code in framewors/base/CORE/Java/COM/Android/Internal/OS/zygoteinit. java) Main () method. At the same time, this method registers the native method used by the android Virtual Machine (starregulatory ()).
D) Main () of zygoteinit calls startsystemserver (), startsystemserver () calls handlesystemserverprocess (), and handlesystemserverprocess () calls runtimeinit. zygoteinit (), runtimeinit. zygoteinit () calls invokestaticmain (). If this function is successfully executed, an exception zygoteinit will be thrown. methodandargscaller. This is an exception that implements runnable. It is captured by main () of zygoteinit and called run ().
E) The run () of methodandargscaller calls the mian () method of systemserver. init1 () and init2 () are executed in sequence, serverthread is started, and various services in the Java layer are initialized and started to run. Systemready () of activitymanagerservice is called.
F) systemready () of activitymanagerservice finally calls resumetopactivitylocked (). This method calls starthomeactivitylocked (). In this method, the intent called home is constructed and the home is started.