Android boot sequence

Eric Lee
2 min readApr 5, 2021
Photo by Pathum Danthanarayana on Unsplash

What’s going on Android before we launch an application? Under the hood, the Android Linux kernel runs many daemon processes to manage the system. The first process is called the root process and it is an init process. You can check what the process does in /system/core/init/.

There are various daemons run in Android. Among of them, Zygote is a special daemon to launch applications. Its role is for launching apps quickly without a cold start. In other words, the process preloads and initializes core libraries that need to launch apps and it is forked based on copy-on-write policy. You can check what the process can do in /android/internal/os/ZygoteInit.java and what kind of arguments are used in /android/internal/os/ZygoteArguments.java.

The System Server that runs services of Android framework like ActivityManager is started by Zygote process. You can check what the server does in /server/SystemServer.java.

Let’s see the following figure.

Embedded Android: Porting, Extending, and Customizing Figure 2–6

You can check theZygote process that starts System Server. The ActivityManager starts to handle Intent on Android framework. You can check it with a green line on the figure.

After Zygote starts System Server, the user can click an application on the device home launcher. Then the click event sends Intent to launch the application, and the System Server initialized all kinds of service with a preloaded Zygote process that is ready to be used. You can also check it through the yellow line on the figure.

We can recheck how to Application is launched with the following figure:

  1. User clicks an app on Launcher.
  2. The Intent is sent to Activity Manager and Zygote is forked with pid (Zygote::forkAndSpecialize)
  3. Finally, launch the application with Activity Thread.
SSPFA: effective stack smashing protection for Android OS

Although there are lots of good articles relating to this topic online, I hope this article also possibly help someone.

Reference

--

--