Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12ae5f45 authored by Ats Jenk's avatar Ats Jenk Committed by Android (Google) Code Review
Browse files

Merge "Fix potential race issue with removing bubble" into main

parents 873dea16 f4da13ab
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -2004,6 +2004,7 @@ public class BubbleStackView extends FrameLayout
            // and then remove our views (removing the icon view triggers the removal of the
            // bubble window so do that at the end of the animation so we see the scrim animate).
            BadgedImageView iconView = bubble.getIconView();
            final BubbleViewProvider expandedBubbleBeforeScrim = mExpandedBubble;
            showScrim(false, () -> {
                mRemovingLastBubbleWhileExpanded = false;
                bubble.cleanupExpandedView();
@@ -2012,7 +2013,17 @@ public class BubbleStackView extends FrameLayout
                }
                bubble.cleanupViews(); // cleans up the icon view
                updateExpandedView(); // resets state for no expanded bubble
                // Bubble keys may not have changed if we receive an update to the same bubble.
                // Compare bubble object instances to see if the expanded bubble has changed.
                if (expandedBubbleBeforeScrim == mExpandedBubble) {
                    // Only clear expanded bubble if it has not changed since the scrim animation
                    // started.
                    // Scrim animation can take some time run and it is possible for a new bubble
                    // to be added while the animation is running. This causes the expanded
                    // bubble to change. Make sure we only clear the expanded bubble if it did
                    // not change between when the scrim animation started and completed.
                    mExpandedBubble = null;
                }
            });
            logBubbleEvent(bubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED);
            return;