Update Z order and collapse animation destinations when bubbles reorder.
Bug: 137214359
Test: atest SystemUITests
Change-Id: I88169fd941853159235cabaf926e87b75f0aeb26
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index f3ad89f..3db13c9 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -759,6 +759,8 @@
Bubble bubble = bubbles.get(i);
mBubbleContainer.reorderView(bubble.getIconView(), i);
}
+
+ updateBubbleZOrdersAndDotPosition(false /* animate */);
}
/**
@@ -1078,7 +1080,7 @@
StatsLog.BUBBLE_UICHANGED__ACTION__STACK_MOVED);
mStackOnLeftOrWillBe = newStackX <= 0;
- updateBubbleShadowsAndDotPosition(true /* animate */);
+ updateBubbleZOrdersAndDotPosition(true /* animate */);
hideDismissTarget();
}
@@ -1555,11 +1557,11 @@
}
mStackOnLeftOrWillBe = mStackAnimationController.isStackOnLeftSide();
- updateBubbleShadowsAndDotPosition(false);
+ updateBubbleZOrdersAndDotPosition(false);
}
/** Sets the appropriate Z-order and dot position for each bubble in the stack. */
- private void updateBubbleShadowsAndDotPosition(boolean animate) {
+ private void updateBubbleZOrdersAndDotPosition(boolean animate) {
int bubbleCount = mBubbleContainer.getChildCount();
for (int i = 0; i < bubbleCount; i++) {
BubbleView bv = (BubbleView) mBubbleContainer.getChildAt(i);
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 20a05d2..8c2ab34 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java
@@ -456,6 +456,12 @@
@Override
void onChildReordered(View child, int oldIndex, int newIndex) {
updateBubblePositions();
+
+ // We expect reordering during collapse, since we'll put the last selected bubble on top.
+ // Update the collapse animation so they end up in the right stacked positions.
+ if (mAnimatingCollapse) {
+ startOrUpdatePathAnimation(false /* expanding */);
+ }
}
private void updateBubblePositions() {