From e51ee7ee009bc5d2d3efa51d551d7e8edb94ade9 Mon Sep 17 00:00:00 2001 From: Sergey Serokurov Date: Fri, 1 Apr 2022 15:57:59 -0700 Subject: [PATCH] Process only app initiated removals in onEntryRemoved callback Bug: 220066165 Test: atest SystemUITests Change-Id: Ica339c74c26e7a360749a3d23151ad701093b6aa --- .../src/com/android/systemui/wmshell/BubblesManager.java | 4 +++- .../android/systemui/wmshell/NewNotifPipelineBubblesTest.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java b/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java index 4d34aa38b3cd1..b70220d09749b 100644 --- a/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java +++ b/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java @@ -576,7 +576,9 @@ public class BubblesManager implements Dumpable { @Override public void onEntryRemoved(NotificationEntry entry, @NotifCollection.CancellationReason int reason) { - BubblesManager.this.onEntryRemoved(entry); + if (reason == REASON_APP_CANCEL || reason == REASON_APP_CANCEL_ALL) { + BubblesManager.this.onEntryRemoved(entry); + } } @Override diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java index 40657fb614124..ce7924a2a4a2f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/NewNotifPipelineBubblesTest.java @@ -807,7 +807,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { assertTrue(mBubbleController.hasBubbles()); // Removes the notification - mEntryListener.onEntryRemoved(mRow, 0); + mEntryListener.onEntryRemoved(mRow, REASON_APP_CANCEL); assertFalse(mBubbleController.hasBubbles()); } @@ -938,7 +938,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase { mBubblesManager.handleDismissalInterception(groupSummary.getEntry()); // WHEN the summary is cancelled by the app - mEntryListener.onEntryRemoved(groupSummary.getEntry(), 0); + mEntryListener.onEntryRemoved(groupSummary.getEntry(), REASON_APP_CANCEL); // THEN the summary and its children are removed from bubble data assertFalse(mBubbleData.hasBubbleInStackWithKey(groupedBubble.getEntry().getKey()));