Well, using the tools described in the previous article, we tracked down the flow of startactivity in System_server, as follows:
The picture below are the flow chart for how the source activity start a target activity
Major includes four steps:
(1) Preparation, flow chart in Blue;
(2) Suspend the source activity, in yellow;
(3) Start the target application process once not yet created, also create the
Activity Thread, in aubergine;
(4) Attach the target activity thread to application, in Red, in this step,
Application OnCreate and Activity onCreate are invoked.
System_server in the activitystack is very heavy, which maintains the state of all the activity of the stack, due to the time relationship, no in-depth study. Application's oncreate is primarily to create a context that is rooted in the various components on this application.
A little bit of experience is that if you want to better understand, you must go to debug tracking, look at other people's blog is always a reference, and easy to doze.
Android start_activity Process