From 7dc8f81d1c38813b2bff9a3ee938abb6e37c7fae Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Sun, 28 Jun 2020 16:43:38 -0400 Subject: [PATCH] Call stopInflation() on bubbles we're removing. Bubbles that cancel themselves in onCreate (and less frequently, onResume) are sometimes removed before inflation finishes. Then, when inflation does finish, we call notificationEntryUpdated in the callback at BubbleController#1106 which re-adds the bubble while it's being removed. This resulted in unpredictably inconsistent states between BubbleData and BubbleStackView, causing a variety of pretty bad issues. Test: modified bubble test app to cancel its own notifications in onCreate/onResume Bug: 159861400 Change-Id: I9716dc60bd664b612437906af1d5c76f9f0755ff --- .../SystemUI/src/com/android/systemui/bubbles/BubbleData.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java index c170ee271e1db..ec4304f184f95 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java @@ -476,6 +476,9 @@ public class BubbleData { if (DEBUG_BUBBLE_DATA) { Log.d(TAG, "Cancel overflow bubble: " + b); } + if (b != null) { + b.stopInflation(); + } mLogger.logOverflowRemove(b, reason); mStateChange.bubbleRemoved(b, reason); mOverflowBubbles.remove(b); @@ -483,6 +486,7 @@ public class BubbleData { return; } Bubble bubbleToRemove = mBubbles.get(indexToRemove); + bubbleToRemove.stopInflation(); if (mBubbles.size() == 1) { // Going to become empty, handle specially. setExpandedInternal(false);