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

Commit 8d079964 authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Corrects wrong activity sent for resume in canMoveTaskToBack

When evaluating moveTaskToBack, the resuming activity should be
searched from the next task, rather than the current task. Also there
can skip querying from controller if the task is already bottommost.

Flag: EXEMPT bugfix
Bug: 401518213
Test: monkey
Change-Id: Id9c73ab55b08af107f467b4274f87818ab182625
parent 440faf35
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -5764,15 +5764,16 @@ class Task extends TaskFragment {
            return false;
        }

        // If we have a watcher, preflight the move before committing to it.  First check
        // for *other* available tasks, but if none are available, then try again allowing the
        // current task to be selected.
        // If we have a watcher, preflight the move before committing to it.
        // Checks for other available tasks; however, if none are available, skips because this
        // is the bottommost task.
        if (mAtmService.mController != null && isTopRootTaskInDisplayArea()) {
            ActivityRecord next = topRunningActivity(null, task.mTaskId);
            if (next == null) {
                next = topRunningActivity(null, INVALID_TASK_ID);
            }
            final ActivityRecord next = getDisplayArea().getActivity(
                    a -> isTopRunning(a, task.mTaskId, null /* notTop */));
            if (next != null) {
                if (next.isState(RESUMED)) {
                    return true;
                }
                // ask watcher if this is allowed
                boolean moveOK = true;
                try {