diff options
author | 2020-04-07 05:06:19 +0000 | |
---|---|---|
committer | 2020-04-07 05:06:19 +0000 | |
commit | 5b8c53ff0014bce719d24eaf1ed16c2aa4660bb0 (patch) | |
tree | cb6adaef85062d828b3abd08f6357f9674661559 | |
parent | bc60cca4ddfa3af614cab05ba40d6639c836b3ee (diff) | |
parent | 6e68af5e6b1d0936c93fbe32749efac5e31ffafa (diff) |
Merge "Update bounds on shelf/ime adjustment during transition" into rvc-dev
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java | 34 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java | 2 |
2 files changed, 21 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java b/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java index 8cff20ac31f7..d9872d7dcf17 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +++ b/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java @@ -319,23 +319,29 @@ public class PipTaskOrganizer extends TaskOrganizer { * TODO(b/152809058): consolidate the display info handling logic in SysUI */ @SuppressWarnings("unchecked") - public void mayUpdateCurrentAnimationOnRotationChange() { + public void onMovementBoundsChanged(boolean fromImeAdjustment, boolean fromShelfAdjustment) { final PipAnimationController.PipTransitionAnimator animator = mPipAnimationController.getCurrentAnimator(); - if (animator != null && animator.isRunning() - && animator.getTransitionDirection() == TRANSITION_DIRECTION_TO_PIP) { - final Rect currentDestinationBounds = animator.getDestinationBounds(); - if (mPipBoundsHandler.getDisplayBounds().contains(currentDestinationBounds)) { - return; - } - final Rect newDestinationBounds = mPipBoundsHandler.getDestinationBounds( - getAspectRatioOrDefault(mTaskInfo.pictureInPictureParams), - null /* bounds */, getMinimalSize(mTaskInfo.topActivityInfo)); - if (animator.getAnimationType() == ANIM_TYPE_BOUNDS) { - animator.updateEndValue(newDestinationBounds); - } - animator.setDestinationBounds(newDestinationBounds); + if (animator == null || !animator.isRunning() + || animator.getTransitionDirection() != TRANSITION_DIRECTION_TO_PIP) { + 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( + getAspectRatioOrDefault(mTaskInfo.pictureInPictureParams), + null /* bounds */, getMinimalSize(mTaskInfo.topActivityInfo)); + if (newDestinationBounds.equals(currentDestinationBounds)) return; + if (animator.getAnimationType() == ANIM_TYPE_BOUNDS) { + animator.updateEndValue(newDestinationBounds); } + animator.setDestinationBounds(newDestinationBounds); } /** diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java index 99d6df517224..918c45b52d61 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java @@ -362,7 +362,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, animatingBounds, fromImeAdjustment, fromShelfAdjustment, mTmpDisplayInfo.rotation); - mPipTaskOrganizer.mayUpdateCurrentAnimationOnRotationChange(); + mPipTaskOrganizer.onMovementBoundsChanged(fromImeAdjustment, fromShelfAdjustment); } public void dump(PrintWriter pw) { |