diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-04-13 12:49:14 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-04-13 17:35:22 -0700 |
commit | 53d9264de4f99a069dd7306f881d28ddd5956b35 (patch) | |
tree | 4d5e68203618529f03911a610052064826e25550 /services | |
parent | ba6339fe2ba2d7325a99201e82d951064efa31a2 (diff) | |
download | frameworks_base-53d9264de4f99a069dd7306f881d28ddd5956b35.zip frameworks_base-53d9264de4f99a069dd7306f881d28ddd5956b35.tar.gz frameworks_base-53d9264de4f99a069dd7306f881d28ddd5956b35.tar.bz2 |
Fix issue #2555171: Switching to app immediately after unmounting...
...SD card causes reboot.
Add option to not include temporarily unavailable recent tasks,
for the recent tasks UI to not display them.
Change-Id: I1495ca217b4292fd56f537459b44c0624262c292
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index bc26fa0..b6f323d 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -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--; } |