From 2b1795f2afe11487eb3aa5cb69585af9ed8bc14b Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Wed, 1 Jun 2022 16:41:16 -0700 Subject: [PATCH] Fix selection after dismissal When dismissing a bubble, mIsBubbleSwitchingAnimating should only be true if it's the current bubble being dismissed. If a different bubble is selected, then no switching animation will need to be run. Bug: 234621652 Bug: 234069335 Test: manual - have multiple bubbles, expand the stack, dismiss a bubble that isn't currently selected => verify that you can select a different bubble after dismissing Change-Id: Ice4ade66d49e1bd302defab142ae367c4a889cfd --- .../src/com/android/wm/shell/bubbles/BubbleStackView.java | 7 +++++-- 1 file changed, 5 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 33a5fa12a4a16..7e218b7ea8148 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 @@ -96,6 +96,7 @@ import java.math.RoundingMode; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.function.Consumer; import java.util.stream.Collectors; @@ -2744,8 +2745,10 @@ public class BubbleStackView extends FrameLayout private void dismissBubbleIfExists(@Nullable BubbleViewProvider bubble) { if (bubble != null && mBubbleData.hasBubbleInStackWithKey(bubble.getKey())) { - if (mIsExpanded && mBubbleData.getBubbles().size() > 1) { - // If we have more than 1 bubble we will perform the switch animation + if (mIsExpanded && mBubbleData.getBubbles().size() > 1 + && Objects.equals(bubble, mExpandedBubble)) { + // If we have more than 1 bubble and it's the current bubble being dismissed, + // we will perform the switch animation mIsBubbleSwitchAnimating = true; } mBubbleData.dismissBubbleWithKey(bubble.getKey(), Bubbles.DISMISS_USER_GESTURE);