Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +6 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.bubbles; import static android.app.Notification.FLAG_BUBBLE; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK; Loading Loading @@ -547,8 +548,11 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mNotificationEntryManager.performRemoveNotification(bubble.entry.notification, UNDEFINED_DISMISS_REASON); } else { // The notification is still in the shade but we've removed the bubble so // lets make sure NoMan knows it's not a bubble anymore // Update the flag for SysUI bubble.entry.notification.getNotification().flags &= ~FLAG_BUBBLE; // Make sure NoMan knows it's not a bubble anymore so anyone querying it will // get right result back try { mBarService.onNotificationBubbleChanged(bubble.getKey(), false /* isBubble */); Loading services/core/java/com/android/server/notification/NotificationManagerService.java +0 −7 Original line number Diff line number Diff line Loading @@ -1036,19 +1036,12 @@ public class NotificationManagerService extends SystemService { final StatusBarNotification n = r.sbn; final int callingUid = n.getUid(); final String pkg = n.getPackageName(); final boolean wasBubble = r.getNotification().isBubbleNotification(); if (isBubble && isNotificationAppropriateToBubble(r, pkg, callingUid, null /* oldEntry */)) { r.getNotification().flags |= FLAG_BUBBLE; } else { r.getNotification().flags &= ~FLAG_BUBBLE; } if (wasBubble != r.getNotification().isBubbleNotification()) { // Add the "alert only once" flag so that the notification won't HUN // unnecessarily just because the bubble flag was changed. r.getNotification().flags |= FLAG_ONLY_ALERT_ONCE; mListeners.notifyPostedLocked(r, r); } } } } Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +8 −16 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_VISIB import static android.app.Notification.CATEGORY_CALL; import static android.app.Notification.FLAG_BUBBLE; import static android.app.Notification.FLAG_FOREGROUND_SERVICE; import static android.app.Notification.FLAG_ONLY_ALERT_ONCE; import static android.app.NotificationManager.EXTRA_BLOCKED_STATE; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_HIGH; Loading Loading @@ -4963,13 +4962,10 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mService.mNotificationDelegate.onNotificationBubbleChanged(nr.getKey(), false); waitForIdle(); // Make sure we are not a bubble / reported as such to listeners ArgumentCaptor<NotificationRecord> captor = ArgumentCaptor.forClass(NotificationRecord.class); verify(mListeners, times(1)).notifyPostedLocked(captor.capture(), any()); assertEquals((captor.getValue().getNotification().flags & FLAG_BUBBLE), 0); assertTrue((captor.getValue().getNotification().flags & FLAG_ONLY_ALERT_ONCE) != 0); // Make sure we are not a bubble StatusBarNotification[] notifsAfter = mBinderService.getActiveNotifications(PKG); assertEquals(1, notifsAfter.length); assertEquals((notifsAfter[0].getNotification().flags & FLAG_BUBBLE), 0); } @Test Loading Loading @@ -5000,13 +4996,10 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mService.mNotificationDelegate.onNotificationBubbleChanged(nr.getKey(), true); waitForIdle(); // Make sure we are a bubble / reported as such to listeners ArgumentCaptor<NotificationRecord> captor = ArgumentCaptor.forClass(NotificationRecord.class); verify(mListeners, times(1)).notifyPostedLocked(captor.capture(), any()); assertTrue((captor.getValue().getNotification().flags & FLAG_BUBBLE) != 0); assertTrue((captor.getValue().getNotification().flags & FLAG_ONLY_ALERT_ONCE) != 0); // Make sure we are a bubble StatusBarNotification[] notifsAfter = mBinderService.getActiveNotifications(PKG); assertEquals(1, notifsAfter.length); assertTrue((notifsAfter[0].getNotification().flags & FLAG_BUBBLE) != 0); } @Test Loading Loading @@ -5037,7 +5030,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { StatusBarNotification[] notifsAfter = mBinderService.getActiveNotifications(PKG); assertEquals(1, notifsAfter.length); assertEquals((notifsAfter[0].getNotification().flags & FLAG_BUBBLE), 0); verify(mListeners, times(0)).notifyPostedLocked(any(), any()); } @Test Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +6 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.bubbles; import static android.app.Notification.FLAG_BUBBLE; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST; import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK; Loading Loading @@ -547,8 +548,11 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mNotificationEntryManager.performRemoveNotification(bubble.entry.notification, UNDEFINED_DISMISS_REASON); } else { // The notification is still in the shade but we've removed the bubble so // lets make sure NoMan knows it's not a bubble anymore // Update the flag for SysUI bubble.entry.notification.getNotification().flags &= ~FLAG_BUBBLE; // Make sure NoMan knows it's not a bubble anymore so anyone querying it will // get right result back try { mBarService.onNotificationBubbleChanged(bubble.getKey(), false /* isBubble */); Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +0 −7 Original line number Diff line number Diff line Loading @@ -1036,19 +1036,12 @@ public class NotificationManagerService extends SystemService { final StatusBarNotification n = r.sbn; final int callingUid = n.getUid(); final String pkg = n.getPackageName(); final boolean wasBubble = r.getNotification().isBubbleNotification(); if (isBubble && isNotificationAppropriateToBubble(r, pkg, callingUid, null /* oldEntry */)) { r.getNotification().flags |= FLAG_BUBBLE; } else { r.getNotification().flags &= ~FLAG_BUBBLE; } if (wasBubble != r.getNotification().isBubbleNotification()) { // Add the "alert only once" flag so that the notification won't HUN // unnecessarily just because the bubble flag was changed. r.getNotification().flags |= FLAG_ONLY_ALERT_ONCE; mListeners.notifyPostedLocked(r, r); } } } } Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +8 −16 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_VISIB import static android.app.Notification.CATEGORY_CALL; import static android.app.Notification.FLAG_BUBBLE; import static android.app.Notification.FLAG_FOREGROUND_SERVICE; import static android.app.Notification.FLAG_ONLY_ALERT_ONCE; import static android.app.NotificationManager.EXTRA_BLOCKED_STATE; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_HIGH; Loading Loading @@ -4963,13 +4962,10 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mService.mNotificationDelegate.onNotificationBubbleChanged(nr.getKey(), false); waitForIdle(); // Make sure we are not a bubble / reported as such to listeners ArgumentCaptor<NotificationRecord> captor = ArgumentCaptor.forClass(NotificationRecord.class); verify(mListeners, times(1)).notifyPostedLocked(captor.capture(), any()); assertEquals((captor.getValue().getNotification().flags & FLAG_BUBBLE), 0); assertTrue((captor.getValue().getNotification().flags & FLAG_ONLY_ALERT_ONCE) != 0); // Make sure we are not a bubble StatusBarNotification[] notifsAfter = mBinderService.getActiveNotifications(PKG); assertEquals(1, notifsAfter.length); assertEquals((notifsAfter[0].getNotification().flags & FLAG_BUBBLE), 0); } @Test Loading Loading @@ -5000,13 +4996,10 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { mService.mNotificationDelegate.onNotificationBubbleChanged(nr.getKey(), true); waitForIdle(); // Make sure we are a bubble / reported as such to listeners ArgumentCaptor<NotificationRecord> captor = ArgumentCaptor.forClass(NotificationRecord.class); verify(mListeners, times(1)).notifyPostedLocked(captor.capture(), any()); assertTrue((captor.getValue().getNotification().flags & FLAG_BUBBLE) != 0); assertTrue((captor.getValue().getNotification().flags & FLAG_ONLY_ALERT_ONCE) != 0); // Make sure we are a bubble StatusBarNotification[] notifsAfter = mBinderService.getActiveNotifications(PKG); assertEquals(1, notifsAfter.length); assertTrue((notifsAfter[0].getNotification().flags & FLAG_BUBBLE) != 0); } @Test Loading Loading @@ -5037,7 +5030,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { StatusBarNotification[] notifsAfter = mBinderService.getActiveNotifications(PKG); assertEquals(1, notifsAfter.length); assertEquals((notifsAfter[0].getNotification().flags & FLAG_BUBBLE), 0); verify(mListeners, times(0)).notifyPostedLocked(any(), any()); } @Test Loading