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

Commit f70ee34f authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Avoid adjusting top focused root task while clear task"

parents 63963ebb 2caec7ba
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2549,7 +2549,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        final Task stack = getRootTask();
        final boolean mayAdjustTop = (isState(RESUMED) || stack.mResumedActivity == null)
                && stack.isFocusedStackOnDisplay();
                && stack.isFocusedStackOnDisplay()
                // Do not adjust focus task because the task will be reused to launch new activity.
                && !task.isClearingToReuseTask();
        final boolean shouldAdjustGlobalFocus = mayAdjustTop
                // It must be checked before {@link #makeFinishingLocked} is called, because a stack
                // is not visible if it only contains finishing activities.
+0 −2
Original line number Diff line number Diff line
@@ -2023,8 +2023,6 @@ class ActivityStarter {
            // of history or if it is finished immediately), thus disassociating the task. Also note
            // that mReuseTask is reset as a result of {@link Task#performClearTaskLocked}
            // launching another activity.
            // TODO(b/36119896):  We shouldn't trigger activity launches in this path since we are
            // already launching one.
            targetTask.performClearTaskLocked();
            targetTask.setIntent(mStartActivity);
            mAddingToTask = true;
+15 −4
Original line number Diff line number Diff line
@@ -1836,14 +1836,25 @@ class Task extends WindowContainer<WindowContainer> {
     */
    void performClearTaskLocked() {
        mReuseTask = true;
        mStackSupervisor.beginDeferResume();
        try {
            performClearTask("clear-task-all");
        } finally {
            mStackSupervisor.endDeferResume();
            mReuseTask = false;
        }
    }

    ActivityRecord performClearTaskForReuseLocked(ActivityRecord newR, int launchFlags) {
        mReuseTask = true;
        final ActivityRecord result = performClearTaskLocked(newR, launchFlags);
        mStackSupervisor.beginDeferResume();
        final ActivityRecord result;
        try {
            result = performClearTaskLocked(newR, launchFlags);
        } finally {
            mStackSupervisor.endDeferResume();
            mReuseTask = false;
        }
        return result;
    }