am 8e1f2f88
: Merge "Fix issue #2555171: Switching to app immediately after unmounting..." into froyo
Merge commit '8e1f2f8804a1f63c7a03a3eeced9ffdf6e6c3293' into froyo-plus-aosp * commit '8e1f2f8804a1f63c7a03a3eeced9ffdf6e6c3293': Fix issue #2555171: Switching to app immediately after unmounting...
This commit is contained in:
@ -144,6 +144,13 @@ public class ActivityManager {
|
||||
*/
|
||||
public static final int RECENT_WITH_EXCLUDED = 0x0001;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* TODO: Make this public. Provides a list that does not contain any
|
||||
* recent tasks that currently are not available to the user.
|
||||
*/
|
||||
public static final int RECENT_IGNORE_UNAVAILABLE = 0x0002;
|
||||
|
||||
/**
|
||||
* Return a list of the tasks that the user has recently launched, with
|
||||
* the most recent being first and older ones after in order.
|
||||
|
@ -6867,6 +6867,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
enforceCallingPermission(android.Manifest.permission.GET_TASKS,
|
||||
"getRecentTasks()");
|
||||
|
||||
IPackageManager pm = ActivityThread.getPackageManager();
|
||||
|
||||
final int N = mRecentTasks.size();
|
||||
ArrayList<ActivityManager.RecentTaskInfo> res
|
||||
= new ArrayList<ActivityManager.RecentTaskInfo>(
|
||||
@ -6883,6 +6885,25 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
rti.baseIntent = new Intent(
|
||||
tr.intent != null ? tr.intent : tr.affinityIntent);
|
||||
rti.origActivity = tr.origActivity;
|
||||
|
||||
if ((flags&ActivityManager.RECENT_IGNORE_UNAVAILABLE) != 0) {
|
||||
// Check whether this activity is currently available.
|
||||
try {
|
||||
if (rti.origActivity != null) {
|
||||
if (pm.getActivityInfo(rti.origActivity, 0) == null) {
|
||||
continue;
|
||||
}
|
||||
} else if (rti.baseIntent != null) {
|
||||
if (pm.queryIntentActivities(rti.baseIntent,
|
||||
null, 0) == null) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// Will never happen.
|
||||
}
|
||||
}
|
||||
|
||||
res.add(rti);
|
||||
maxNum--;
|
||||
}
|
||||
|
Reference in New Issue
Block a user