Android4.4\frameworks\base\packages\systemui\src\com\android\systemui\recent\recentsactivity.java
This function is to open the nearest app click Idle Place jump
public void Dismissandgohome () {
if (Mrecentspanel! = null) {
Intent homeintent = new Intent (intent.action_main, NULL);
Homeintent.addcategory (Intent.category_home);
Homeintent.addflags (Intent.flag_activity_new_task
| intent.flag_activity_reset_task_if_needed);
Startactivityasuser (Homeintent, New Userhandle (userhandle.user_current));//This is the jump to the system up to launch inside
}
}
Record recently applied in this face
Android4.4\frameworks\base\packages\systemui\src\com\android\systemui\recent\recenttasksloader.java
protected void Doinbackground (void ... params) {
We load in both Stages:first, we update progress with just the first screenful
of items. We update with the rest of the items
Final int origpri = process.getthreadpriority (Process.mytid ());
Process.setthreadpriority (Process.thread_priority_background);
Final Packagemanager PM = Mcontext.getpackagemanager ();
Final Activitymanager am = (activitymanager)
Mcontext.getsystemservice (Context.activity_service);
Final list<activitymanager.recenttaskinfo> recenttasks =
Am.getrecenttasks (Max_tasks, activitymanager.recent_ignore_unavailable);
int numtasks = Recenttasks.size ();
Activityinfo homeinfo = new Intent (intent.action_main)
. Addcategory (Intent.category_home). Resolveactivityinfo (PM, 0);
Boolean firstscreenful = true;
arraylist<taskdescription> tasks = new arraylist<taskdescription> ();
Skip the first task-assume it ' s either the home screen or the current activity.
Final int first = 0;
for (int i = First, index = 0; i < numtasks && (Index < max_tasks); ++i) {
if (iscancelled ()) {
Break
}
Final Activitymanager.recenttaskinfo recentinfo = Recenttasks.get (i);
Intent Intent = new Intent (recentinfo.baseintent);
if (recentinfo.origactivity! = null) {
Intent.setcomponent (recentinfo.origactivity);
}
Key code
Don ' t load the current home activity.
if (Iscurrenthomeactivity (Intent.getcomponent (), homeinfo)) {//Here is shielded the system highest launch not recorded in the most recently applied stack
Continue
}
Don ' t load ourselves
if (Intent.getcomponent (). Getpackagename (). Equals (Mcontext.getpackagename ())) {
Continue
}
Taskdescription item = createtaskdescription (Recentinfo.id,
Recentinfo.persistentid, Recentinfo.baseintent,
Recentinfo.origactivity, recentinfo.description);
if (item! = NULL) {
while (true) {
try {
Taskswaitingforthumbnails.put (item);
Break
} catch (Interruptedexception e) {
}
}
Tasks.add (item);
if (firstscreenful && tasks.size () = = mnumtasksinfirstscreenful) {
Publishprogress (tasks);
tasks = new arraylist<taskdescription> ();
Firstscreenful = false;
Break
}
++index;
}
}
if (!iscancelled ()) {
Publishprogress (tasks);
if (firstscreenful) {
Always should publish and updates
Publishprogress (New arraylist<taskdescription> ());
}
}
while (true) {
try {
Taskswaitingforthumbnails.put (New Taskdescription ());
Break
} catch (Interruptedexception e) {
}
}
Process.setthreadpriority (ORIGPRI);
return null;
}
};
Mtaskloader.executeonexecutor (Asynctask.thread_pool_executor);
Loadthumbnailsandiconsinbackground (taskswaitingforthumbnails);
}
Android4.4 Recent Task List recentsactivity and Recenttasksloader