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

Commit dc1d29f0 authored by Evan Rosky's avatar Evan Rosky
Browse files

Fix pip enter/expand from split-screen secondary.

Split up validateWindowingMode into a validity check and
the one that "resolves" split-screen. This way, calling
setWindowingMode on an ActivityStack won't assign a
random mode (it won't convert undefined into split-secondary).
Without this, the task itself was getting set to secondary
(when it should just be inheriting).

Then, piptaskorganizer will reparent to secondary if in
split-mode (thus using the same logic it used to get the
final animation bounds).

Upon enter, instead of changing root-task mode to pinned,
only the leaf task changes (this is because pinned is now
an alwaysCreateStack activity type). WM, unfortunately,
has to reparent to displayarea here so that it doesn't
mess-up the topActivityType reported via onTaskInfoChanged.

Also made pip params come directly from the top activity
rather than be stored on the task. Otherwise, nested
pip activities wouldn't properly report their params
because they would have been set on the root rather
than their direct parent which meant that once the
direct parent became root, it wouldn't have the params

Bug: 154515783
Bug: 144711770
Test: go to split with a pippable in secondary. go to home
      in secondary.
Change-Id: Ibfc1e7f6805bf2641cff676232c1040e2fa025f1
parent ddb28a55
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -552,6 +552,9 @@ public class PipTaskOrganizer extends TaskOrganizer {
                    ? null : destinationBounds;
            // As for the final windowing mode, simply reset it to undefined.
            wct.setWindowingMode(mToken, WINDOWING_MODE_UNDEFINED);
            if (mSplitDivider != null && direction == TRANSITION_DIRECTION_TO_SPLIT_SCREEN) {
                wct.reparent(mToken, mSplitDivider.getSecondaryRoot(), true /* onTop */);
            }
        } else {
            taskBounds = destinationBounds;
        }
+8 −0
Original line number Diff line number Diff line
@@ -813,4 +813,12 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
            updateVisibility(true /* visible */);
        }
    }

    /** @return the container token for the secondary split root task. */
    public WindowContainerToken getSecondaryRoot() {
        if (mSplits == null || mSplits.mSecondary == null) {
            return null;
        }
        return mSplits.mSecondary.token;
    }
}
+1 −7
Original line number Diff line number Diff line
@@ -1281,12 +1281,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }

        if (stack != null && stack.topRunningActivity() == this) {
            // carry over the PictureInPictureParams to the parent stack without calling
            // TaskOrganizerController#dispatchTaskInfoChanged.
            // this is to ensure the stack holding up-to-dated pinned stack information
            // when activity is re-parented to enter pip mode, see also
            // RootWindowContainer#moveActivityToPinnedStack
            stack.mPictureInPictureParams.copyOnlySet(pictureInPictureArgs);
            // make ensure the TaskOrganizer still works after re-parenting
            if (firstWindowDrawn) {
                stack.setHasBeenVisible(true);
@@ -7769,6 +7763,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    void setPictureInPictureParams(PictureInPictureParams p) {
        pictureInPictureArgs.copyOnlySet(p);
        getTask().getRootTask().setPictureInPictureParams(p);
        getTask().getRootTask().onPictureInPictureParamsChanged();
    }
}
+4 −2
Original line number Diff line number Diff line
@@ -708,8 +708,10 @@ class ActivityStack extends Task {
        // Need to make sure windowing mode is supported. If we in the process of creating the stack
        // no need to resolve the windowing mode again as it is already resolved to the right mode.
        if (!creating) {
            windowingMode = taskDisplayArea.validateWindowingMode(windowingMode,
                    null /* ActivityRecord */, topTask, getActivityType());
            if (!taskDisplayArea.isValidWindowingMode(windowingMode, null /* ActivityRecord */,
                    topTask, getActivityType())) {
                windowingMode = WINDOWING_MODE_UNDEFINED;
            }
        }
        if (taskDisplayArea.getRootSplitScreenPrimaryTask() == this
                && windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
+1 −0
Original line number Diff line number Diff line
@@ -1470,6 +1470,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
        mService.deferWindowLayout();
        try {
            stack.setWindowingMode(WINDOWING_MODE_UNDEFINED);
            stack.setBounds(null);
            if (toDisplay.getDisplayId() != stack.getDisplayId()) {
                stack.reparent(toDisplay.getDefaultTaskDisplayArea(), false /* onTop */);
            } else {
Loading