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

Commit 70c65c8e authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Don't move task if it is already in the destination stack

When moving a task from one stack to another we detach the source
stack from the display if the stack is empty after the task move.
If the source and destination stack are the same we detach the
stack from the display when the task is removed, but it isn't
re-attached to the display when the task is add back since we
only attach stacks to displays when they are created.
We no longer try to move the task if it is already in the destination
stack.

Bug: 25671469
Change-Id: Idde54d362a35716223bc5f1143000111af380239
parent 9f1c3f09
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -3340,6 +3340,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
            return;
        }

        if (task.stack != null && task.stack.mStackId == stackId) {
            // You are already in the right stack silly...
            Slog.i(TAG, "moveTaskToStack: taskId=" + taskId + " already in stackId=" + stackId);
            return;
        }

        final ActivityRecord topActivity = task.getTopActivity();
        if (StackId.preserveWindowOnTaskMove(stackId) && topActivity != null) {
            // We are about to relaunch the activity because its configuration changed due to
@@ -3356,15 +3362,13 @@ public final class ActivityStackSupervisor implements DisplayListener {

        // Make sure the task has the appropriate bounds/size for the stack it is in.
        if (stackId == FULLSCREEN_WORKSPACE_STACK_ID && task.mBounds != null) {
            resizeTaskLocked(task, stack.mBounds,
                    RESIZE_MODE_SYSTEM, !PRESERVE_WINDOWS);
            resizeTaskLocked(task, stack.mBounds, RESIZE_MODE_SYSTEM, !PRESERVE_WINDOWS);
        } else if (stackId == FREEFORM_WORKSPACE_STACK_ID
                && task.mBounds == null && task.mLastNonFullscreenBounds != null) {
            resizeTaskLocked(task, task.mLastNonFullscreenBounds,
                    RESIZE_MODE_SYSTEM, !PRESERVE_WINDOWS);
        } else if (stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID) {
            resizeTaskLocked(task, stack.mBounds,
                    RESIZE_MODE_SYSTEM, !PRESERVE_WINDOWS);
            resizeTaskLocked(task, stack.mBounds, RESIZE_MODE_SYSTEM, !PRESERVE_WINDOWS);
        }

        // The task might have already been running and its visibility needs to be synchronized with