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: I3d5460161415c4217b7899b9b02da3da9b770456
This commit is contained in:
@@ -619,7 +619,9 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
@PipAnimationController.TransitionDirection int direction, int durationMs,
|
@PipAnimationController.TransitionDirection int direction, int durationMs,
|
||||||
Consumer<Rect> updateBoundsCallback) {
|
Consumer<Rect> updateBoundsCallback) {
|
||||||
if (!mInPip) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,8 +677,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
private void scheduleFinishResizePip(Rect destinationBounds,
|
private void scheduleFinishResizePip(Rect destinationBounds,
|
||||||
@PipAnimationController.TransitionDirection int direction,
|
@PipAnimationController.TransitionDirection int direction,
|
||||||
Consumer<Rect> updateBoundsCallback) {
|
Consumer<Rect> updateBoundsCallback) {
|
||||||
if (!mInPip) {
|
if (shouldBlockResizeRequest()) {
|
||||||
// can be initiated in other component, ignore if we are no longer in PIP
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -704,8 +705,7 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
*/
|
*/
|
||||||
public void scheduleOffsetPip(Rect originalBounds, int offset, int duration,
|
public void scheduleOffsetPip(Rect originalBounds, int offset, int duration,
|
||||||
Consumer<Rect> updateBoundsCallback) {
|
Consumer<Rect> updateBoundsCallback) {
|
||||||
if (!mInPip) {
|
if (shouldBlockResizeRequest()) {
|
||||||
// can be initiated in other component, ignore if we are no longer in PIP
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mShouldDeferEnteringPip) {
|
if (mShouldDeferEnteringPip) {
|
||||||
@@ -876,6 +876,16 @@ public class PipTaskOrganizer extends TaskOrganizer implements
|
|||||||
: params.getAspectRatio();
|
: 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.
|
* 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
|
&& !mSpringingToTouch
|
||||||
&& !mMagnetizedPip.getObjectStuckToTarget()) {
|
&& !mMagnetizedPip.getObjectStuckToTarget()) {
|
||||||
mBounds.set(mTemporaryBounds);
|
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();
|
mTemporaryBounds.setEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user