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

Commit 7dc8f81d authored by Josh Tsuji's avatar Josh Tsuji
Browse files

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
parent 5866d920
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -476,6 +476,9 @@ public class BubbleData {
                if (DEBUG_BUBBLE_DATA) {
                if (DEBUG_BUBBLE_DATA) {
                    Log.d(TAG, "Cancel overflow bubble: " + b);
                    Log.d(TAG, "Cancel overflow bubble: " + b);
                }
                }
                if (b != null) {
                    b.stopInflation();
                }
                mLogger.logOverflowRemove(b, reason);
                mLogger.logOverflowRemove(b, reason);
                mStateChange.bubbleRemoved(b, reason);
                mStateChange.bubbleRemoved(b, reason);
                mOverflowBubbles.remove(b);
                mOverflowBubbles.remove(b);
@@ -483,6 +486,7 @@ public class BubbleData {
            return;
            return;
        }
        }
        Bubble bubbleToRemove = mBubbles.get(indexToRemove);
        Bubble bubbleToRemove = mBubbles.get(indexToRemove);
        bubbleToRemove.stopInflation();
        if (mBubbles.size() == 1) {
        if (mBubbles.size() == 1) {
            // Going to become empty, handle specially.
            // Going to become empty, handle specially.
            setExpandedInternal(false);
            setExpandedInternal(false);