Android AMS - APP startup process (3)

         There are two main ways to start Android applications, cold start and warm start.

  • Cold start: There is no application process in the background, you need to create the process first, and then start the Activity;
  • Hot start: There is an application process in the background, no process is created, and the Activity is started directly;

        In fact, there is another method of warm start, that is, the user presses the return key to exit the application, and then restarts it, but the active process resides in the background. In order to analyze the complete startup process here, we mainly analyze the cold start process.

1. Start the process

        The first process hatched by the Zygote process in the App layer is the Launcher process, which is the desktop APP of the mobile phone. Zygote will also incubate APP processes such as Browser, Email, and Phone. Each APP runs on at least one process. All APP processes are forked from the Zygote process.

1. Start the APP process

        Click the APP icon of the Launcher desktop program, the Launcher program will call the startActivity() function, communicate across processes through Binder, and send messages to the system_server process. In the system_server process, AMS notifies the Zygote process to fork out a child process (APP process) through socket communication.

2. Start the APP main thread

Guess you like

Origin blog.csdn.net/c19344881x/article/details/133269478