From e45ff865734a0457cdcbcf24eafb8feca3979a2c Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Tue, 24 Mar 2020 15:54:50 -0700 Subject: [PATCH] Don't update the bubble on ranking changes if it's already in the stack The only reason we should update/add a bubble in response to a ranking change is if that notification wasn't a bubble before and should be now. Also set the entry when retrieving from pending / overflow. Bug: 152322244 Test: manual - 1) add some bubbles, add one that auto expanded 2) collapse stack 3) trigger some notification in shade (e.g. start a timer) => notice the stack does not auto expand in the background Change-Id: I15877fabf07a402dade76904dc1481ab669776ff --- .../src/com/android/systemui/bubbles/BubbleController.java | 5 +++-- .../src/com/android/systemui/bubbles/BubbleData.java | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index c9ce8a10cca7d..31f90c6a86489 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -957,9 +957,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi String key = orderedKeys[i]; NotificationEntry entry = mNotificationEntryManager.getPendingOrActiveNotif(key); rankingMap.getRanking(key, mTmpRanking); - if (mBubbleData.hasBubbleWithKey(key) && !mTmpRanking.canBubble()) { + boolean isActiveBubble = mBubbleData.hasBubbleWithKey(key); + if (isActiveBubble && !mTmpRanking.canBubble()) { mBubbleData.notificationEntryRemoved(entry, BubbleController.DISMISS_BLOCKED); - } else if (entry != null && mTmpRanking.isBubble()) { + } else if (entry != null && mTmpRanking.isBubble() && !isActiveBubble) { entry.setFlagBubble(true); onEntryUpdated(entry); } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java index 077ffd3729e5b..8bc35f4058e9f 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java @@ -233,6 +233,7 @@ public class BubbleData { Bubble b = mOverflowBubbles.get(i); if (b.getKey().equals(entry.getKey())) { moveOverflowBubbleToPending(b); + b.setEntry(entry); return b; } } @@ -240,6 +241,7 @@ public class BubbleData { for (int i = 0; i < mPendingBubbles.size(); i++) { Bubble b = mPendingBubbles.get(i); if (b.getKey().equals(entry.getKey())) { + b.setEntry(entry); return b; } }