Merge "Fixing last CL (uploaded the wrong patch)" into rvc-dev

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

View File

@@ -228,7 +228,6 @@ public class PipTaskOrganizer extends TaskOrganizer implements
PipAnimationController.PipTransitionAnimator animator = PipAnimationController.PipTransitionAnimator animator =
mPipAnimationController.getCurrentAnimator(); mPipAnimationController.getCurrentAnimator();
if (animator != null && animator.isRunning()) { if (animator != null && animator.isRunning()) {
System.out.println("RUNNING ANIM: anim=" + animator.getDestinationBounds() + " last=" + getLastReportedBounds());
return new Rect(animator.getDestinationBounds()); return new Rect(animator.getDestinationBounds());
} }
return getLastReportedBounds(); return getLastReportedBounds();
@@ -238,6 +237,10 @@ public class PipTaskOrganizer extends TaskOrganizer implements
return mInPip; return mInPip;
} }
public boolean isDeferringEnterPipAnimation() {
return mInPip && mShouldDeferEnteringPip;
}
/** /**
* Registers {@link PipTransitionCallback} to receive transition callbacks. * Registers {@link PipTransitionCallback} to receive transition callbacks.
*/ */
@@ -533,12 +536,16 @@ public class PipTaskOrganizer extends TaskOrganizer implements
// If we are rotating while there is a current animation, immediately cancel the // If we are rotating while there is a current animation, immediately cancel the
// animation (remove the listeners so we don't trigger the normal finish resize // animation (remove the listeners so we don't trigger the normal finish resize
// call that should only happen on the update thread) // call that should only happen on the update thread)
int direction = animator.getTransitionDirection(); int direction = TRANSITION_DIRECTION_NONE;
animator.removeAllUpdateListeners(); if (animator != null) {
animator.removeAllListeners(); direction = animator.getTransitionDirection();
animator.cancel(); animator.removeAllUpdateListeners();
// Do notify the listeners that this was canceled animator.removeAllListeners();
sendOnPipTransitionCancelled(direction); animator.cancel();
// Do notify the listeners that this was canceled
sendOnPipTransitionCancelled(direction);
sendOnPipTransitionFinished(direction);
}
mLastReportedBounds.set(destinationBoundsOut); mLastReportedBounds.set(destinationBoundsOut);
// Create a reset surface transaction for the new bounds and update the window // Create a reset surface transaction for the new bounds and update the window

View File

@@ -95,6 +95,10 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
*/ */
private final DisplayChangeController.OnDisplayChangingListener mRotationController = ( private final DisplayChangeController.OnDisplayChangingListener mRotationController = (
int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) -> { int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) -> {
if (!mPipTaskOrganizer.isInPip() || mPipTaskOrganizer.isDeferringEnterPipAnimation()) {
// Skip if we aren't in PIP or haven't actually entered PIP yet
return;
}
// If there is an animation running (ie. from a shelf offset), then ensure that we calculate // If there is an animation running (ie. from a shelf offset), then ensure that we calculate
// the bounds for the next orientation using the destination bounds of the animation // the bounds for the next orientation using the destination bounds of the animation
// TODO: Techincally this should account for movement animation bounds as well // TODO: Techincally this should account for movement animation bounds as well