From 62b56927365c9c8a973a71766a3c7d5cfcffb7a4 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 9 Jun 2021 22:25:51 -0700 Subject: [PATCH] Ignore source hint rect if it is too small - When the source hint rect is too small, we can't do a nice transition when going home (it would require scaling the surface up to fit the rect, which conflicts spatially with the crop down to launcher icon/pip), so in this case, just fallback to the overlay Bug: 190464560 Test: Enter YT Pip, play video, swipe it down to miniplayer then enter pip Change-Id: I44b253ca440f6d2ca0eb20eef3454c5d4e3ae3e9 --- .../android/quickstep/util/SwipePipToHomeAnimator.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java index 36311302bf..1062652ed4 100644 --- a/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java +++ b/quickstep/src/com/android/quickstep/util/SwipePipToHomeAnimator.java @@ -121,6 +121,15 @@ public class SwipePipToHomeAnimator extends ValueAnimator { mDestinationBoundsAnimation.set(mDestinationBounds); mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius); + if (sourceRectHint != null && (sourceRectHint.width() < destinationBounds.width() + || sourceRectHint.height() < destinationBounds.height())) { + // This is a situation in which the source hint rect on at least one axis is smaller + // than the destination bounds, which presents a problem because we would have to scale + // up that axis to fit the bounds. So instead, just fallback to the non-source hint + // animation in this case. + sourceRectHint = null; + } + if (sourceRectHint == null) { mSourceHintRectInsets = null;