From f44562b71385ed9e444ed5fb3d0935f5afdf6d25 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Mon, 30 Mar 2020 16:40:46 -0700 Subject: [PATCH] Reset target, update pointer [Part 1] Add bubbles, expand stack, select bubble. -> mMagnetizedBubbleDraggingOut = selected bubble Now add more bubbles -> ExpandedAnimationController#updateBubblePositions returns early at the selected bubble -> Bubbles to the right of the selected bubble don't animate to their places. Fixed by setting mMagnetizedBubbleDraggingOut to null in onGestureFinished -> BubbleTouchHandler calls this for every gesture -> Subsequent order animations apply to every bubble. [Part 2] Pointer updates once right after adding bubble and does not reflect final updated order. Fixed by moving updatePointerPosition from BubbleStackView#addBubble to #updatePointerPosition. (We don't need to update the pointer if adding a bubble does not change the order.) Fixes: 152696626 Test: manual: add bubbles, expand stack, select bubble, add more bubbles -> pointer stays with selected bubble (overflow flag on and off) Test: atest SystemUITests Change-Id: If5f34cf660a8d4b9ce50ad749ebdce5b87660407 --- .../src/com/android/systemui/bubbles/BubbleStackView.java | 8 +++++--- .../bubbles/animation/ExpandedAnimationController.java | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index 4b036812dbed7..eace5d035f9c7 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -947,7 +947,6 @@ public class BubbleStackView extends FrameLayout { new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); ViewClippingUtil.setClippingDeactivated(bubble.getIconView(), true, mClippingParameters); animateInFlyoutForBubble(bubble); - updatePointerPosition(); requestUpdate(); logBubbleEvent(bubble, SysUiStatsLog.BUBBLE_UICHANGED__ACTION__POSTED); } @@ -1006,8 +1005,8 @@ public class BubbleStackView extends FrameLayout { Bubble bubble = bubbles.get(i); mBubbleContainer.reorderView(bubble.getIconView(), i); } - updateBubbleZOrdersAndDotPosition(false /* animate */); + updatePointerPosition(); } void showOverflow() { @@ -1395,7 +1394,7 @@ public class BubbleStackView extends FrameLayout { /** Called when a drag operation on an individual bubble has started. */ public void onBubbleDragStart(View bubble) { if (DEBUG_BUBBLE_STACK_VIEW) { - Log.d(TAG, "onBubbleDragStart: bubble=" + bubble); + Log.d(TAG, "onBubbleDragStart: bubble=" + ((BadgedImageView) bubble).getKey()); } if (mBubbleOverflow != null && bubble.equals(mBubbleOverflow.getIconView())) { @@ -1910,6 +1909,9 @@ public class BubbleStackView extends FrameLayout { return; } int index = getBubbleIndex(mExpandedBubble); + if (index == -1) { + return; + } float bubbleLeftFromScreenLeft = mExpandedAnimationController.getBubbleLeft(index); float halfBubble = mBubbleSize / 2f; float bubbleCenter = bubbleLeftFromScreenLeft + halfBubble; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java b/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java index 9b5dc31eea2ff..ea1abf99a0f3d 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java @@ -364,6 +364,7 @@ public class ExpandedAnimationController /** Resets bubble drag out gesture flags. */ public void onGestureFinished() { mBubbleDraggedOutEnough = false; + mMagnetizedBubbleDraggingOut = null; updateBubblePositions(); }