How Activitymanagerservice launches the app

Source: Internet
Author: User

How Activitymanagerservice launches the app

A The start-up process of the previous Article app, explains that the Launcher launch app is through Binber, let Activitymanagerservice startactivity to start the app.

Two Code is no longer detailed, only important code is given

Tracked to Activitymanagerservice's startactivity, executed the Startactivityasuser method,----"

Activitystacksupervisor's Startactivitymaywait method, where appinfo is saved, Then call startactivitylocked further operations to save the process information of the launcher application in the Callerapp variable, Save the Launcher activity information in the Sourcerecord variable. Call startactivityuncheckedlocked.
Analyze the Startactivityuncheckedlocked method.

This is the method name and parameter.

There are four startup modes for activating the activity,

The need to start the app is to create a new task to start the activity.

This determines whether the top of the stack is the activity to start.

Note: mhomestack: Records only task,mfocusedstack that hold launcher and systemui (recently applied): records All tasks for non-launcher apps. Mstacks: This ArrayList only holds Mhomestack and Mfocusedstack, Mhomestack is placed in the No. 0 position.

After these preparations are completed, the final entry into startactivitylocked (R, NewTask, Doresume) is further processed, which does not affect the activation of the activity and then calls Resumetopactivitylocked. It first looks at whether the activity to be started is the activity that is currently dealing with the resumed state, and if so, then nothing is to be done, just return it, or see if the system is currently dormant, if so, Then see if the activity you want to start is the activity that is currently at the top of the stack, and if so, you don't have to do anything. Push the activity that is in the resumed state into the paused state before you can start a new activity. However, before pushing the activity of the current resumed state into the paused state, the first thing to look at is whether there is currently activity entering the pausing state, and if so, the current resumed The activity of the State must be later entered into the paused state, thus guaranteeing all activity serial processing that needs to enter the paused state.

Here the Schedulepauseactivity informs launcher to enter the paused state. Prev.app.thread is a remote interface to a Applicationthread object that notifies launcher to paused state by invoking the schedulepauseactivity of the remote interface.

Applicationthreadproxy.schedulepauseactivity this function. is the binder interprocess communication mechanism

Next go to applicationthread.schedulepauseactivity.

Activitymanagerservice the analysis here.

How Activitymanagerservice launches the app

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.