Android Java code startup

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.