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

Commit 20c05fda authored by Jeff Chang's avatar Jeff Chang Committed by Automerger Merge Worker
Browse files

Merge "Find activity in task with same user" into tm-qpr-dev am: fc9ccbb8 am: a3e9c750

parents c77e3659 a3e9c750
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2107,7 +2107,8 @@ class ActivityStarter {
            // already be running somewhere in the history, and we want to shuffle it to
            // the front of the root task if so.
            final ActivityRecord act =
                    targetTask.findActivityInHistory(mStartActivity.mActivityComponent);
                    targetTask.findActivityInHistory(mStartActivity.mActivityComponent,
                            mStartActivity.mUserId);
            if (act != null) {
                final Task task = act.getTask();
                task.moveActivityToFrontLocked(act);
+6 −5
Original line number Diff line number Diff line
@@ -1634,7 +1634,7 @@ class Task extends TaskFragment {
     * or {@code null} if none was found.
     */
    private ActivityRecord clearTopActivities(ActivityRecord newR, int launchFlags) {
        final ActivityRecord r = findActivityInHistory(newR.mActivityComponent);
        final ActivityRecord r = findActivityInHistory(newR.mActivityComponent, newR.mUserId);
        if (r == null) return null;

        final PooledPredicate f = PooledLambda.obtainPredicate(Task::finishActivityAbove,
@@ -1750,17 +1750,18 @@ class Task extends TaskFragment {
     * Find the activity in the history task within the given task.  Returns
     * the index within the history at which it's found, or < 0 if not found.
     */
    ActivityRecord findActivityInHistory(ComponentName component) {
    ActivityRecord findActivityInHistory(ComponentName component, int userId) {
        final PooledPredicate p = PooledLambda.obtainPredicate(Task::matchesActivityInHistory,
                PooledLambda.__(ActivityRecord.class), component);
                PooledLambda.__(ActivityRecord.class), component, userId);
        final ActivityRecord r = getActivity(p);
        p.recycle();
        return r;
    }

    private static boolean matchesActivityInHistory(
            ActivityRecord r, ComponentName activityComponent) {
        return !r.finishing && r.mActivityComponent.equals(activityComponent);
            ActivityRecord r, ComponentName activityComponent, int userId) {
        return !r.finishing && r.mActivityComponent.equals(activityComponent)
                && r.mUserId == userId;
    }

    /** Updates the last task description values. */