diff options
| author | 2025-02-20 15:23:05 -0800 | |
|---|---|---|
| committer | 2025-02-20 15:23:25 -0800 | |
| commit | 0fd944658216fe434f628f0e52e6685c037fe92c (patch) | |
| tree | 6e0f91081a647f420edbcb5eb8b5ae5ef42156d1 | |
| parent | 32d0aba7574e2fd77f09e41d94c6b1f00da2b903 (diff) | |
Fix an issue where we wouldn't remove bubble notifications when we should
Flag: EXEMPT simple bug fix
Test: atest BubblesTest
Bug: 398032277
Change-Id: I72fbe85c18b8a64748b0703c484abc0d754a732d
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java | 4 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java b/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java index e76401528ff6..b23efcea1c2c 100644 --- a/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java +++ b/packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java @@ -23,6 +23,7 @@ import static android.service.notification.NotificationListenerService.REASON_AP import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL_ALL; import static android.service.notification.NotificationListenerService.REASON_GROUP_SUMMARY_CANCELED; import static android.service.notification.NotificationListenerService.REASON_PACKAGE_BANNED; +import static android.service.notification.NotificationListenerService.REASON_PACKAGE_CHANGED; import static android.service.notification.NotificationStats.DISMISSAL_BUBBLE; import static android.service.notification.NotificationStats.DISMISS_SENTIMENT_NEUTRAL; @@ -451,7 +452,8 @@ public class BubblesManager { public void onEntryRemoved(NotificationEntry entry, @NotifCollection.CancellationReason int reason) { if (reason == REASON_APP_CANCEL || reason == REASON_APP_CANCEL_ALL - || reason == REASON_PACKAGE_BANNED) { + || reason == REASON_PACKAGE_BANNED + || reason == REASON_PACKAGE_CHANGED) { BubblesManager.this.onEntryRemoved(entry); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java index a38d71b178e9..68d84ecaf4b1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java @@ -25,6 +25,7 @@ import static android.service.notification.NotificationListenerService.NOTIFICAT import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL; import static android.service.notification.NotificationListenerService.REASON_GROUP_SUMMARY_CANCELED; import static android.service.notification.NotificationListenerService.REASON_PACKAGE_BANNED; +import static android.service.notification.NotificationListenerService.REASON_PACKAGE_CHANGED; import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.server.notification.Flags.FLAG_SCREENSHARE_NOTIFICATION_HIDING; @@ -1126,6 +1127,18 @@ public class BubblesTest extends SysuiTestCase { } @Test + public void testNotifsPackageChanged_entryListenerRemove() { + mEntryListener.onEntryAdded(mRow); + mBubbleController.updateBubble(mBubbleEntry); + + assertTrue(mBubbleController.hasBubbles()); + + // Removes the notification + mEntryListener.onEntryRemoved(mRow, REASON_PACKAGE_CHANGED); + assertFalse(mBubbleController.hasBubbles()); + } + + @Test public void removeBubble_intercepted() { mEntryListener.onEntryAdded(mRow); mBubbleController.updateBubble(mBubbleEntry); |