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

Commit a2a3b1d7 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Prevent cleaning up and resuming null activity when task is reparented."

parents ff4b0fdb 95f8f0ed
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -617,15 +617,15 @@ final class TaskRecord extends ConfigurationContainer implements TaskWindowConta
        boolean kept = true;
        boolean kept = true;
        try {
        try {
            final ActivityRecord r = topRunningActivityLocked();
            final ActivityRecord r = topRunningActivityLocked();
            final boolean wasFocused = supervisor.isFocusedStack(sourceStack)
            final boolean wasFocused = r != null && supervisor.isFocusedStack(sourceStack)
                    && (topRunningActivityLocked() == r);
                    && (topRunningActivityLocked() == r);
            final boolean wasResumed = sourceStack.mResumedActivity == r;
            final boolean wasResumed = r != null && sourceStack.mResumedActivity == r;
            final boolean wasPaused = sourceStack.mPausingActivity == r;
            final boolean wasPaused = r != null && sourceStack.mPausingActivity == r;


            // In some cases the focused stack isn't the front stack. E.g. pinned stack.
            // In some cases the focused stack isn't the front stack. E.g. pinned stack.
            // Whenever we are moving the top activity from the front stack we want to make sure to
            // Whenever we are moving the top activity from the front stack we want to make sure to
            // move the stack to the front.
            // move the stack to the front.
            final boolean wasFront = supervisor.isFrontStackOnDisplay(sourceStack)
            final boolean wasFront = r != null && supervisor.isFrontStackOnDisplay(sourceStack)
                    && (sourceStack.topRunningActivityLocked() == r);
                    && (sourceStack.topRunningActivityLocked() == r);


            // Adjust the position for the new parent stack as needed.
            // Adjust the position for the new parent stack as needed.
@@ -667,8 +667,10 @@ final class TaskRecord extends ConfigurationContainer implements TaskWindowConta
            // new stack by moving the stack to the front.
            // new stack by moving the stack to the front.
            final boolean moveStackToFront = moveStackMode == REPARENT_MOVE_STACK_TO_FRONT
            final boolean moveStackToFront = moveStackMode == REPARENT_MOVE_STACK_TO_FRONT
                    || (moveStackMode == REPARENT_KEEP_STACK_AT_FRONT && (wasFocused || wasFront));
                    || (moveStackMode == REPARENT_KEEP_STACK_AT_FRONT && (wasFocused || wasFront));
            toStack.moveToFrontAndResumeStateIfNeeded(r, moveStackToFront, wasResumed, wasPaused,
            if (r != null) {
                    reason);
                toStack.moveToFrontAndResumeStateIfNeeded(r, moveStackToFront, wasResumed,
                        wasPaused, reason);
            }
            if (!animate) {
            if (!animate) {
                toStack.mNoAnimActivities.add(topActivity);
                toStack.mNoAnimActivities.add(topActivity);
            }
            }