Merge "Ignore resize request when exiting PiP" into rvc-dev am: 65c66bde19
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12004845 Change-Id: I3283b3d9bd4913fa59da9e1d33a2156c0c9f1430
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user