From 40d313a0462a1d97a5d16ca3f40d3faeb62bc916 Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Thu, 25 Jun 2020 13:13:04 -0400 Subject: [PATCH] Fix issue where PIP jumps after being tapped after being dragged through the dismiss target. onBoundsAnimationEnd does not set the permanent bounds if mSpringingToTouch=true, since that indicates that PIP caught up with the touch location - and the touch location is a temporary position. We eventually set the permanent bounds after flingToSnapTarget's animation ends. However, if PIP was flung to a snap target while mSpringingToTouch=true, those permanent bounds were never set. Starting a drag gesture would have set the permanent bounds, which is why this is only visible if you tap immediately after doing all this. Bug: 159909223 Test: tap pip after dragging it through dismiss without moving it again Change-Id: I67a9c19bf8dafab4cee646539d9f5a4575a14ffd --- .../src/com/android/systemui/pip/phone/PipMotionHelper.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java index 26805050e8417..e60123e863a40 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java @@ -365,6 +365,10 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, void flingToSnapTarget( float velocityX, float velocityY, @Nullable Runnable updateAction, @Nullable Runnable endAction) { + // If we're flinging to a snap target now, we're not springing to catch up to the touch + // location now. + mSpringingToTouch = false; + mTemporaryBoundsPhysicsAnimator .spring(FloatProperties.RECT_WIDTH, mBounds.width(), mSpringConfig) .spring(FloatProperties.RECT_HEIGHT, mBounds.height(), mSpringConfig)