Merge "Update bounds on shelf/ime adjustment during transition" into rvc-dev am: 5b8c53ff00

Change-Id: Ib4bbe90b3ad97eaa98d8b92548f8db36f37ed2c3
This commit is contained in:
Hongwei Wang
2020-04-07 05:22:50 +00:00
committed by Automerger Merge Worker
2 changed files with 21 additions and 15 deletions

View File

@@ -319,24 +319,30 @@ public class PipTaskOrganizer extends TaskOrganizer {
* TODO(b/152809058): consolidate the display info handling logic in SysUI * TODO(b/152809058): consolidate the display info handling logic in SysUI
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void mayUpdateCurrentAnimationOnRotationChange() { public void onMovementBoundsChanged(boolean fromImeAdjustment, boolean fromShelfAdjustment) {
final PipAnimationController.PipTransitionAnimator animator = final PipAnimationController.PipTransitionAnimator animator =
mPipAnimationController.getCurrentAnimator(); mPipAnimationController.getCurrentAnimator();
if (animator != null && animator.isRunning() if (animator == null || !animator.isRunning()
&& animator.getTransitionDirection() == TRANSITION_DIRECTION_TO_PIP) { || animator.getTransitionDirection() != TRANSITION_DIRECTION_TO_PIP) {
final Rect currentDestinationBounds = animator.getDestinationBounds();
if (mPipBoundsHandler.getDisplayBounds().contains(currentDestinationBounds)) {
return; return;
} }
final Rect currentDestinationBounds = animator.getDestinationBounds();
if (!fromImeAdjustment && !fromShelfAdjustment
&& mPipBoundsHandler.getDisplayBounds().contains(currentDestinationBounds)) {
// no need to update the destination bounds, bail early
return;
}
final Rect newDestinationBounds = mPipBoundsHandler.getDestinationBounds( final Rect newDestinationBounds = mPipBoundsHandler.getDestinationBounds(
getAspectRatioOrDefault(mTaskInfo.pictureInPictureParams), getAspectRatioOrDefault(mTaskInfo.pictureInPictureParams),
null /* bounds */, getMinimalSize(mTaskInfo.topActivityInfo)); null /* bounds */, getMinimalSize(mTaskInfo.topActivityInfo));
if (newDestinationBounds.equals(currentDestinationBounds)) return;
if (animator.getAnimationType() == ANIM_TYPE_BOUNDS) { if (animator.getAnimationType() == ANIM_TYPE_BOUNDS) {
animator.updateEndValue(newDestinationBounds); animator.updateEndValue(newDestinationBounds);
} }
animator.setDestinationBounds(newDestinationBounds); animator.setDestinationBounds(newDestinationBounds);
} }
}
/** /**
* @return {@code true} if the aspect ratio is changed since no other parameters within * @return {@code true} if the aspect ratio is changed since no other parameters within

View File

@@ -362,7 +362,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds,
animatingBounds, fromImeAdjustment, fromShelfAdjustment, animatingBounds, fromImeAdjustment, fromShelfAdjustment,
mTmpDisplayInfo.rotation); mTmpDisplayInfo.rotation);
mPipTaskOrganizer.mayUpdateCurrentAnimationOnRotationChange(); mPipTaskOrganizer.onMovementBoundsChanged(fromImeAdjustment, fromShelfAdjustment);
} }
public void dump(PrintWriter pw) { public void dump(PrintWriter pw) {