Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit baa0fd95 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 7b16f95c: am 8e1f2f88: Merge "Fix issue #2555171: Switching to app...

am 7b16f95c: am 8e1f2f88: Merge "Fix issue #2555171: Switching to app immediately after unmounting..." into froyo

Merge commit '7b16f95c' into kraken

* commit '7b16f95c':
  Fix issue #2555171: Switching to app immediately after unmounting...
parents 6d112722 7b16f95c
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -144,6 +144,13 @@ public class ActivityManager {
     */
     */
    public static final int RECENT_WITH_EXCLUDED = 0x0001;
    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
     * Return a list of the tasks that the user has recently launched, with
     * the most recent being first and older ones after in order.
     * the most recent being first and older ones after in order.
+21 −0
Original line number Original line Diff line number Diff line
@@ -6867,6 +6867,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
            enforceCallingPermission(android.Manifest.permission.GET_TASKS,
            enforceCallingPermission(android.Manifest.permission.GET_TASKS,
                    "getRecentTasks()");
                    "getRecentTasks()");
            IPackageManager pm = ActivityThread.getPackageManager();
            
            final int N = mRecentTasks.size();
            final int N = mRecentTasks.size();
            ArrayList<ActivityManager.RecentTaskInfo> res
            ArrayList<ActivityManager.RecentTaskInfo> res
                    = new ArrayList<ActivityManager.RecentTaskInfo>(
                    = new ArrayList<ActivityManager.RecentTaskInfo>(
@@ -6883,6 +6885,25 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
                    rti.baseIntent = new Intent(
                    rti.baseIntent = new Intent(
                            tr.intent != null ? tr.intent : tr.affinityIntent);
                            tr.intent != null ? tr.intent : tr.affinityIntent);
                    rti.origActivity = tr.origActivity;
                    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);
                    res.add(rti);
                    maxNum--;
                    maxNum--;
                }
                }