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

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

Merge "Remove ActivityStack#moveHomeStackToFrontIfNeeded"

parents 0ac7c69b 074cdf2d
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
@@ -3664,8 +3664,9 @@ class ActivityStack extends WindowContainer<WindowContainer> implements BoundsAn
        }

        final DisplayContent display = getDisplay();
        final boolean topFocused = mRootActivityContainer.isTopDisplayFocusedStack(this);
        if (DEBUG_TASK_MOVEMENT) Slog.d(TAG_WM, "removeChild: task=" + child);
        if (DEBUG_TASK_MOVEMENT) {
            Slog.d(TAG_WM, "removeChild: task=" + child + " reason=" + reason);
        }

        super.removeChild(child);

@@ -3681,8 +3682,6 @@ class ActivityStack extends WindowContainer<WindowContainer> implements BoundsAn
            // Stack is now empty...
          removeIfPossible();
        }

        moveHomeStackToFrontIfNeeded(topFocused, display, reason);
    }

    @Override
@@ -3690,18 +3689,6 @@ class ActivityStack extends WindowContainer<WindowContainer> implements BoundsAn
        removeChild(child, "removeChild");
    }

    void moveHomeStackToFrontIfNeeded(
            boolean wasTopFocusedStack, DisplayContent display, String reason) {
        if (!hasChild() && wasTopFocusedStack) {
            // We only need to adjust focused stack if this stack is in focus and we are not in the
            // process of moving the task to the top of the stack that will be focused.
            String myReason = reason + " leftTaskHistoryEmpty";
            if (!inMultiWindowMode() || adjustFocusToNextFocusableStack(myReason) == null) {
                display.moveHomeStackToFront(myReason);
            }
        }
    }

    Task createTask(int taskId, ActivityInfo info, Intent intent,
            IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
            boolean toTop) {
+1 −11
Original line number Diff line number Diff line
@@ -2182,22 +2182,12 @@ class Task extends WindowContainer<WindowContainer> {
    void reparent(ActivityStack stack, int position, boolean moveParents, String reason) {
        if (DEBUG_STACK) Slog.i(TAG, "reParentTask: removing taskId=" + mTaskId
                + " from stack=" + getTaskStack());
        EventLogTags.writeWmTaskRemoved(mTaskId, "reParentTask");

        final ActivityStack prevStack = getTaskStack();
        final boolean wasTopFocusedStack =
                mAtmService.mRootActivityContainer.isTopDisplayFocusedStack(prevStack);
        final DisplayContent prevStackDisplay = prevStack.getDisplay();
        EventLogTags.writeWmTaskRemoved(mTaskId, "reParentTask:" + reason);

        position = stack.findPositionForTask(this, position, showForAllUsers());

        reparent(stack, position);

        if (!moveParents) {
            // Only move home stack forward if we are not going to move the new parent forward.
            prevStack.moveHomeStackToFrontIfNeeded(wasTopFocusedStack, prevStackDisplay, reason);
        }

        stack.positionChildAt(position, this, moveParents);

        // If we are moving from the fullscreen stack to the pinned stack then we want to preserve