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

Commit b9f45a26 authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Fix an issue where we wouldn't remove bubble notifications when we should" into main

parents ea66d64c 0fd94465
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
                }
            }
+13 −0
Original line number Diff line number Diff line
@@ -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;
@@ -1125,6 +1126,18 @@ public class BubblesTest extends SysuiTestCase {
        assertFalse(mBubbleController.hasBubbles());
    }

    @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);