Merge "Reparent PiP to split screen on exit" into rvc-dev

This commit is contained in:
Hongwei Wang
2020-06-23 21:18:34 +00:00
committed by Android (Google) Code Review

View File

@@ -273,8 +273,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
sendOnPipTransitionStarted(direction); sendOnPipTransitionStarted(direction);
// Don't bother doing an animation if the display rotation differs or if it's in // Don't bother doing an animation if the display rotation differs or if it's in
// a non-supported windowing mode // a non-supported windowing mode
wct.setWindowingMode(mToken, WINDOWING_MODE_UNDEFINED); applyWindowingModeChangeOnExit(wct, direction);
wct.setActivityWindowingMode(mToken, WINDOWING_MODE_UNDEFINED);
WindowOrganizer.applyTransaction(wct); WindowOrganizer.applyTransaction(wct);
// Send finished callback though animation is ignored. // Send finished callback though animation is ignored.
sendOnPipTransitionFinished(direction); sendOnPipTransitionFinished(direction);
@@ -303,6 +302,16 @@ public class PipTaskOrganizer extends TaskOrganizer implements
mExitingPip = true; mExitingPip = true;
} }
private void applyWindowingModeChangeOnExit(WindowContainerTransaction wct, int direction) {
// Reset the final windowing mode.
wct.setWindowingMode(mToken, getOutPipWindowingMode());
// Simply reset the activity mode set prior to the animation running.
wct.setActivityWindowingMode(mToken, WINDOWING_MODE_UNDEFINED);
if (mSplitDivider != null && direction == TRANSITION_DIRECTION_TO_SPLIT_SCREEN) {
wct.reparent(mToken, mSplitDivider.getSecondaryRoot(), true /* onTop */);
}
}
/** /**
* Removes PiP immediately. * Removes PiP immediately.
*/ */
@@ -745,13 +754,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
// on the task to ensure that the task "matches" the parent's bounds. // on the task to ensure that the task "matches" the parent's bounds.
taskBounds = (direction == TRANSITION_DIRECTION_TO_FULLSCREEN) taskBounds = (direction == TRANSITION_DIRECTION_TO_FULLSCREEN)
? null : destinationBounds; ? null : destinationBounds;
// Reset the final windowing mode. applyWindowingModeChangeOnExit(wct, direction);
wct.setWindowingMode(mToken, getOutPipWindowingMode());
// Simply reset the activity mode set prior to the animation running.
wct.setActivityWindowingMode(mToken, WINDOWING_MODE_UNDEFINED);
if (mSplitDivider != null && direction == TRANSITION_DIRECTION_TO_SPLIT_SCREEN) {
wct.reparent(mToken, mSplitDivider.getSecondaryRoot(), true /* onTop */);
}
} else { } else {
// Just a resize in PIP // Just a resize in PIP
taskBounds = destinationBounds; taskBounds = destinationBounds;