From d5842c2aaa896b2632248daa109dff04f07839ef Mon Sep 17 00:00:00 2001 From: Sergey Serokurov Date: Tue, 22 Feb 2022 18:33:51 -0800 Subject: [PATCH] Update stack position after a bubble is removed Bug: 218710452 Test: atest SystemUITests Change-Id: Ie6103bc85c9f6331ddbc7734f140f2b7b379c84c --- .../com/android/wm/shell/bubbles/BubbleStackView.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index c6a68dc98da6d..58f79f3600def 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -1608,7 +1608,9 @@ public class BubbleStackView extends FrameLayout Log.d(TAG, "addBubble: " + bubble); } - if (getBubbleCount() == 0 && shouldShowStackEdu()) { + final boolean firstBubble = getBubbleCount() == 0; + + if (firstBubble && shouldShowStackEdu()) { // Override the default stack position if we're showing user education. mStackAnimationController.setStackPosition(mPositioner.getDefaultStartPosition()); } @@ -1621,7 +1623,7 @@ public class BubbleStackView extends FrameLayout new FrameLayout.LayoutParams(mPositioner.getBubbleSize(), mPositioner.getBubbleSize())); - if (getBubbleCount() == 0) { + if (firstBubble) { mStackOnLeftOrWillBe = mStackAnimationController.isStackOnLeftSide(); } // Set the dot position to the opposite of the side the stack is resting on, since the stack @@ -1652,6 +1654,10 @@ public class BubbleStackView extends FrameLayout bubble.cleanupViews(); } updateExpandedView(); + if (getBubbleCount() == 0 && !isExpanded()) { + // This is the last bubble and the stack is collapsed + updateStackPosition(); + } logBubbleEvent(bubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED); return; }