The startup process of the Android child activity component in process && the child activity component during the startup process of the new process

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.