"Goose Plant cultivation Diary 0.3" task and Backstack

Source: Internet
Author: User

The process of understanding Task and backstack

1. graphs obtained from demo test:

1. There can be more than one app activity in a task,

Because an app can correspond to one or more process,

2. So a task can also correspond to multiple process.

2. graphs obtained by the ADB shell Dumpsys activity test:

1.Android maintains all of the tasks in the main stack,

2. Each task is uniquely identified by TaskID, and the activity within the same task is included in the Hist.

3. Different process (with different PID) can contain different activity of the same app,

4. A package identifies a application.

3. graphs obtained through the learning Source:

1. In Activitymanagerservice, the fallback stack is maintained by a Activitystack object, and in Activitystack, the fallback stack is maintained by Mhistory (a ArrayList, not a stack).

2. Each task is a Taskrecord object,

3.TaskRecord does not maintain a stack or list of its own for each task,

4.mHistory, instead of managing the activity directly, maintain the Activityrecord object,

A 5.ActivityRecord object is associated with a task to which it belongs by Taskrecord.

A 6.ActivityRecord object is associated with a corresponding activity through the activity Info object.

7. Analyze the Code of Movetasktofrontlocked () and other tasks in activitystack, resulting in the activityrecord of the same task being put together in Mhistory (in first in, first out order). When a task is transferred to the foreground, the activityrecord belonging to the same task (TaskID consistent) is moved together to the top of the mhistory (in this ArrayList, the last element is in the position of top, mhistory. Top=size ()-1);

"Goose Plant cultivation Diary 0.3" task and Backstack

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.