From 4bc4e45714f3a20a18acc7b87e5654535e1c293f Mon Sep 17 00:00:00 2001 From: mpodolian Date: Thu, 19 Dec 2024 13:37:08 -0800 Subject: [PATCH] Fixed optional overflow crash by verifying the presence of bubbles. The scenario where "A bubble was added from the overflow (and now it's empty/not showing)" lacked a check to verify if bubbles are currently present. Its absence caused calls to removeOverflowAndAddBubble() of BubbleBarViewController for any first bubble matching the previously closed last bubble, not just those added from the overflow. This CL addresses the issue by adding the missing check. Test: Manual. Set enable_optional_bubble_overflow flag to true. Create one bubble, dismiss it, create the same bubble again. Create another bubble, dismiss it, open overflow and click on dismissed bubble. Observe the overflow icon disappears. Video: http://recall/-/gx8ASgewUeUS3QYohfrd1J/eYeyo6cNeUBw4mU6rrkXtN Flag: com.android.wm.shell.enable_bubble_bar Fixes: 373940143 Change-Id: I4085ce4e922e2b5d65466a00649dda086c14185f --- .../android/launcher3/taskbar/bubbles/BubbleBarController.java | 3 ++- .../com/android/launcher3/taskbar/bubbles/BubbleBarView.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 5b3c233a8f..e6e40d5731 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -324,7 +324,8 @@ public class BubbleBarController extends IBubblesListener.Stub { if (Flags.enableOptionalBubbleOverflow() && update.showOverflowChanged && !update.showOverflow && update.addedBubble != null - && update.removedBubbles.isEmpty()) { + && update.removedBubbles.isEmpty() + && !mBubbles.isEmpty()) { // A bubble was added from the overflow (& now it's empty / not showing) mBubbles.put(update.addedBubble.getKey(), update.addedBubble); mBubbleBarViewController.removeOverflowAndAddBubble(update.addedBubble); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index 37c619496d..0d0feffb40 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -729,7 +729,8 @@ public class BubbleBarView extends FrameLayout { Runnable onEndRunnable) { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams((int) mIconSize, (int) mIconSize, Gravity.LEFT); - boolean isOverflowSelected = mSelectedBubbleView.isOverflow(); + boolean isOverflowSelected = + mSelectedBubbleView != null && mSelectedBubbleView.isOverflow(); boolean removingOverflow = removedBubble.isOverflow(); boolean addingOverflow = addedBubble.isOverflow();