Go to learn more about the Activity Startup Process (I)-The summary process of Activity startup, go to activity
Author: Cloud Chou. Author: http://www.cloudchou.com/android/post-788.html
When an Activity is started in Android, the application where the Activity is located is started first. When an application starts, a process named process in the application package has a main thread, ActivityThread, or UI thread.
This series of blogs will elaborate on the Activity startup process. These blogs are based on Cm 10.1 source code research.
- In-depth understanding of the Activity Startup Process (2)-class diagrams of the Activity startup classes
- In-depth understanding of Activity initiation process (3)-detailed process of Activity initiation 1
- In-depth understanding of Activity initiation process (III)-detailed process of Activity initiation 2
- Deep understanding of Activity initiation process (4) -- Scheduling Algorithm of Activity Task
Brief interaction process at Activity startup
You can click the application icon from the Launcher program to start the entry Activity of the application. When the Activity starts, interaction between multiple processes is required, the Android system has a zygote process dedicated to incubating the Android framework layer and application layer programs. There is also a system_server process that runs many binder services, such as ActivityManagerService, PackageManagerService, and WindowManagerService. These binder services run in different threads respectively, and ActivityManagerService manages the Activity stack, application process, task.
The interaction process of the Activity at startup is as follows (click the picture to see the big picture ):
When you click the application icon in the Launcher program, ActivityManagerService is notified to start the Activity at the entry point of the application. If ActivityManagerService finds that the application has not been started, the Zygote process is notified to hatch the application, then, execute the main method of ActivityThread in the dalvik application process. The application process then notifies ActivityManagerService that the application process has been started. ActivityManagerService saves a proxy object of the application process, so that ActivityManagerService can control the application process through this proxy object, activityManagerService then notifies the application process to create the entry Activity instance and execute its lifecycle method.