Loading packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL; 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.NotificationStats.DISMISSAL_BUBBLE; import static android.service.notification.NotificationStats.DISMISS_SENTIMENT_NEUTRAL; Loading Loading @@ -449,7 +450,8 @@ public class BubblesManager { @Override public void onEntryRemoved(NotificationEntry entry, @NotifCollection.CancellationReason int reason) { if (reason == REASON_APP_CANCEL || reason == REASON_APP_CANCEL_ALL) { if (reason == REASON_APP_CANCEL || reason == REASON_APP_CANCEL_ALL || reason == REASON_PACKAGE_BANNED) { BubblesManager.this.onEntryRemoved(entry); } } Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.service.notification.NotificationListenerService.NOTIFICAT import static android.service.notification.NotificationListenerService.NOTIFICATION_CHANNEL_OR_GROUP_UPDATED; 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 androidx.test.ext.truth.content.IntentSubject.assertThat; Loading Loading @@ -1099,6 +1100,18 @@ public class BubblesTest extends SysuiTestCase { assertFalse(mBubbleController.hasBubbles()); } @Test public void testNotifsBanned_entryListenerRemove() { mEntryListener.onEntryAdded(mRow); mBubbleController.updateBubble(mBubbleEntry); assertTrue(mBubbleController.hasBubbles()); // Removes the notification mEntryListener.onEntryRemoved(mRow, REASON_PACKAGE_BANNED); assertFalse(mBubbleController.hasBubbles()); } @Test public void removeBubble_intercepted() { mEntryListener.onEntryAdded(mRow); Loading Loading
packages/SystemUI/src/com/android/systemui/wmshell/BubblesManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES; import static android.service.notification.NotificationListenerService.REASON_APP_CANCEL; 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.NotificationStats.DISMISSAL_BUBBLE; import static android.service.notification.NotificationStats.DISMISS_SENTIMENT_NEUTRAL; Loading Loading @@ -449,7 +450,8 @@ public class BubblesManager { @Override public void onEntryRemoved(NotificationEntry entry, @NotifCollection.CancellationReason int reason) { if (reason == REASON_APP_CANCEL || reason == REASON_APP_CANCEL_ALL) { if (reason == REASON_APP_CANCEL || reason == REASON_APP_CANCEL_ALL || reason == REASON_PACKAGE_BANNED) { BubblesManager.this.onEntryRemoved(entry); } } Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.service.notification.NotificationListenerService.NOTIFICAT import static android.service.notification.NotificationListenerService.NOTIFICATION_CHANNEL_OR_GROUP_UPDATED; 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 androidx.test.ext.truth.content.IntentSubject.assertThat; Loading Loading @@ -1099,6 +1100,18 @@ public class BubblesTest extends SysuiTestCase { assertFalse(mBubbleController.hasBubbles()); } @Test public void testNotifsBanned_entryListenerRemove() { mEntryListener.onEntryAdded(mRow); mBubbleController.updateBubble(mBubbleEntry); assertTrue(mBubbleController.hasBubbles()); // Removes the notification mEntryListener.onEntryRemoved(mRow, REASON_PACKAGE_BANNED); assertFalse(mBubbleController.hasBubbles()); } @Test public void removeBubble_intercepted() { mEntryListener.onEntryAdded(mRow); Loading