1. The activation process of the child activity component within the process
In the startup process of the Android activity component http://blog.csdn.net/jltxgcy/article/details/35984557, we have analyzed the activation process of the activity in detail, We only analyze the differences between the child activity components during the process startup process.
The main is 2, 1 is not required to create a new task stack, 2 is not required to create new processes and child threads.
1th, this is reflected in the following code:
~/android/frameworks/base/services/java/com/android/server/am
----Activitystack.java
public class Activitystack {... final int startactivityuncheckedlocked (Activityrecord R, Activityrecord Sourcerecord , uri[] granteduripermissions, int grantedmode, Boolean onlyifneeded, Boolean Doresume) {final Intent Intent = r.intent; Final int callinguid = R.launchedfromuid;int launchflags = Intent.getflags (), ... if (Sourcerecord = = null) {...} E LSE if (Sourcerecord.launchmode = = activityinfo.launch_single_instance) {...} else if (R.launchmode = = Activityinfo. Launch_single_instance ...} if (R.resultto! = null && (launchflags&intent.flag_activity_new_task)! = 0) {...} Boolean addingtotask = False;........boolean NewTask = false;//Should this is considered a new task?if (R.resultto = = nul L &&!addingtotask && (launchflags&intent.flag_activity_new_task)! = 0) {...} else if (Sourcereco Rd! = null) {...//an existing activity was starting this new activity, so we want//to keep the new one in the same TAS K as the one that is starting//it.r.task = Sourcerecord.task; ...} else {...} ... startactivitylocked (R, NewTask, Doresume); return start_success;} ......}
2nd, as shown in the code below, there is already a child activity process and its child threads.
Private final void startspecificactivitylocked (Activityrecord R, boolean Andresume, Boolean checkconfig) { // Is this activity ' s application already running? Processrecord app = mservice.getprocessrecordlocked (R.processname, r.info.applicationinfo.uid); ..... if (app = null && app.thread! = null) { try { realstartactivitylocked (r, App, Andresume, checkconfig);
return; } catch (RemoteException e) { ... } ..... } ......}
2. The activation process of the child activity component in the new process
and android the activation process of the activity component Http://blog.csdn.net/jltxgcy/article/details/35984557 The article, there is a difference, There is no need to create a new task stack. The code is as shown above. You also need to