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

Commit c3612c72 authored by Andrii Kulian's avatar Andrii Kulian Committed by android-build-merger
Browse files

Merge \\\"Compare intent filter when launching adjacent\\\" into nyc-dev am:...

Merge \\\"Compare intent filter when launching adjacent\\\" into nyc-dev am: 9980514e am: 4f47b392
am: 1f52fe8e

Change-Id: I6805746065578f044d33929b3bd4a5d1e19a69e1
parents 6874ced4 1f52fe8e
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
@@ -825,7 +825,8 @@ final class ActivityStack {
     * is the same as the given activity.  Returns null if no such activity
     * is the same as the given activity.  Returns null if no such activity
     * is found.
     * is found.
     */
     */
    ActivityRecord findActivityLocked(Intent intent, ActivityInfo info) {
    ActivityRecord findActivityLocked(Intent intent, ActivityInfo info,
                                      boolean compareIntentFilters) {
        ComponentName cls = intent.getComponent();
        ComponentName cls = intent.getComponent();
        if (info.targetActivity != null) {
        if (info.targetActivity != null) {
            cls = new ComponentName(info.packageName, info.targetActivity);
            cls = new ComponentName(info.packageName, info.targetActivity);
@@ -843,9 +844,17 @@ final class ActivityStack {
                if (notCurrentUserTask && (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0) {
                if (notCurrentUserTask && (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0) {
                    continue;
                    continue;
                }
                }
                if (!r.finishing && r.intent.getComponent().equals(cls) && r.userId == userId) {
                if (!r.finishing && r.userId == userId) {
                    if (compareIntentFilters) {
                        if (r.intent.filterEquals(intent)) {
                            return r;
                            return r;
                        }
                        }
                    } else {
                        if (r.intent.getComponent().equals(cls)) {
                            return r;
                        }
                    }
                }
            }
            }
        }
        }


+4 −2
Original line number Original line Diff line number Diff line
@@ -2621,11 +2621,13 @@ public final class ActivityStackSupervisor implements DisplayListener {
        return mTmpFindTaskResult.r;
        return mTmpFindTaskResult.r;
    }
    }


    ActivityRecord findActivityLocked(Intent intent, ActivityInfo info) {
    ActivityRecord findActivityLocked(Intent intent, ActivityInfo info,
                                      boolean compareIntentFilters) {
        for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
        for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
            final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks;
            final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks;
            for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
            for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
                final ActivityRecord ar = stacks.get(stackNdx).findActivityLocked(intent, info);
                final ActivityRecord ar = stacks.get(stackNdx)
                        .findActivityLocked(intent, info, compareIntentFilters);
                if (ar != null) {
                if (ar != null) {
                    return ar;
                    return ar;
                }
                }
+2 −2
Original line number Original line Diff line number Diff line
@@ -1438,11 +1438,11 @@ class ActivityStarter {
            if (mLaunchSingleInstance) {
            if (mLaunchSingleInstance) {
                // There can be one and only one instance of single instance activity in the
                // There can be one and only one instance of single instance activity in the
                // history, and it is always in its own unique task, so we do a special search.
                // history, and it is always in its own unique task, so we do a special search.
               intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info);
               intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info, false);
            } else if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0) {
            } else if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0) {
                // For the launch adjacent case we only want to put the activity in an existing
                // For the launch adjacent case we only want to put the activity in an existing
                // task if the activity already exists in the history.
                // task if the activity already exists in the history.
                intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info);
                intentActivity = mSupervisor.findActivityLocked(mIntent, mStartActivity.info, true);
            } else {
            } else {
                // Otherwise find the best task to put the activity in.
                // Otherwise find the best task to put the activity in.
                intentActivity = mSupervisor.findTaskLocked(mStartActivity);
                intentActivity = mSupervisor.findTaskLocked(mStartActivity);