Android startup process
1. Boot power and system boot When the power is pressed boot chip code starts executing from a predefined location (solidified in ROM). Load the boot program Bootloader into RAM and execute. BootLoader BootLoader is a small program before the Android operating system starts to run. Its main function is to pull up the operating system and run it. 3.Linux kernel startup During kernel startup, set cache, protected storage, schedule list, and load driver. When the kernel is done setting up the system, it first looks for the init.rc file in the system files and starts the init process. 4. Init starts to initialize and start the property service, and start the Zygote process. 5.Zygote creates the JavaVM, registers the JNI for the JavaVM, creates the server Socket, and starts the SystemServer process. 6. The SystemServer process starts the Binder thread pool and SystemServiceManager and starts various system services. ActivityManagerService that is started by the SystemServer process starts the Launcher. After the Launcher is started, the shortcut icon of the installed application is displayed on the screen.
Excerpt from Liu Wangshu’s Blog
Android application startup process
The application can be launched in two ways:
- Click the appropriate application icon in the Launcher to launch
- Start with startActivity
Before a new application is started, the Activity of the previous application enters the onPause state, and then the new application is started
The figure below shows a more detailed Process for starting ActivityThread from Process
So there are a couple of things
- Process establishes a socket link to the Zygote Process and passes the startup parameters to Zygote
- The Zytote process starts when the system starts, creates the socket server, and waits for the client to create the application
- After receiving the request, ZygoteConnection calls Zygote’s forkAndSpecialize function to create the application
- Finally, in RuntimeInit, the reflection mechanism starts the ActivityThread, and the Loop is infinite, and the APP is running
Refer to “Liu Wangshu’s blog” refer to “In-depth Understanding of Android kernel Design ideas”