Merge "Ignore resize request when exiting PiP" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-06-27 06:25:13 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 7 deletions

View File

@@ -619,7 +619,9 @@ public class PipTaskOrganizer extends TaskOrganizer implements
@PipAnimationController.TransitionDirection int direction, int durationMs,
Consumer<Rect> updateBoundsCallback) {
if (!mInPip) {
// can be initiated in other component, ignore if we are no longer in PIP
// TODO: tend to use shouldBlockResizeRequest here as well but need to consider
// the fact that when in exitPip, scheduleAnimateResizePip is executed in the window
// container transaction callback and we want to set the mExitingPip immediately.
return;
}
@@ -675,8 +677,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
private void scheduleFinishResizePip(Rect destinationBounds,
@PipAnimationController.TransitionDirection int direction,
Consumer<Rect> updateBoundsCallback) {
if (!mInPip) {
// can be initiated in other component, ignore if we are no longer in PIP
if (shouldBlockResizeRequest()) {
return;
}
@@ -704,8 +705,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
*/
public void scheduleOffsetPip(Rect originalBounds, int offset, int duration,
Consumer<Rect> updateBoundsCallback) {
if (!mInPip) {
// can be initiated in other component, ignore if we are no longer in PIP
if (shouldBlockResizeRequest()) {
return;
}
if (mShouldDeferEnteringPip) {
@@ -876,6 +876,16 @@ public class PipTaskOrganizer extends TaskOrganizer implements
: params.getAspectRatio();
}
/**
* Resize request can be initiated in other component, ignore if we are no longer in PIP
* or we're exiting from it.
*
* @return {@code true} if the resize request should be blocked/ignored.
*/
private boolean shouldBlockResizeRequest() {
return !mInPip || mExitingPip;
}
/**
* Sync with {@link #mSplitDivider} on destination bounds if PiP is going to split screen.
*

View File

@@ -533,8 +533,11 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
&& !mSpringingToTouch
&& !mMagnetizedPip.getObjectStuckToTarget()) {
mBounds.set(mTemporaryBounds);
mPipTaskOrganizer.scheduleFinishResizePip(mBounds);
if (!mDismissalPending) {
// do not schedule resize if PiP is dismissing, which may cause app re-open to
// mBounds instead of it's normal bounds.
mPipTaskOrganizer.scheduleFinishResizePip(mBounds);
}
mTemporaryBounds.setEmpty();
}