Loading services/core/java/com/android/server/notification/NotificationManagerService.java +9 −9 Original line number Diff line number Diff line Loading @@ -4522,6 +4522,15 @@ public class NotificationManagerService extends SystemService { @GuardedBy("mNotificationLock") @VisibleForTesting protected boolean isVisuallyInterruptive(NotificationRecord old, NotificationRecord r) { // Ignore summary updates because we don't display most of the information. if (r.sbn.isGroup() && r.sbn.getNotification().isGroupSummary()) { if (DEBUG_INTERRUPTIVENESS) { Log.v(TAG, "INTERRUPTIVENESS: " + r.getKey() + " is not interruptive: summary"); } return false; } if (old == null) { if (DEBUG_INTERRUPTIVENESS) { Log.v(TAG, "INTERRUPTIVENESS: " Loading Loading @@ -4559,15 +4568,6 @@ public class NotificationManagerService extends SystemService { return false; } // Ignore summary updates because we don't display most of the information. if (r.sbn.isGroup() && r.sbn.getNotification().isGroupSummary()) { if (DEBUG_INTERRUPTIVENESS) { Log.v(TAG, "INTERRUPTIVENESS: " + r.getKey() + " is not interruptive: summary"); } return false; } final String oldTitle = String.valueOf(oldN.extras.get(Notification.EXTRA_TITLE)); final String newTitle = String.valueOf(newN.extras.get(Notification.EXTRA_TITLE)); if (!Objects.equals(oldTitle, newTitle)) { Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -2941,6 +2941,20 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { assertFalse(mService.isVisuallyInterruptive(r1, r2)); } @Test public void testVisualDifference_summaryNewNotification() { Notification.Builder nb2 = new Notification.Builder(mContext, "") .setGroup("bananas") .setFlag(Notification.FLAG_GROUP_SUMMARY, true) .setContentText("bar"); StatusBarNotification sbn2 = new StatusBarNotification(PKG, PKG, 0, "tag", mUid, 0, nb2.build(), new UserHandle(mUid), null, 0); NotificationRecord r2 = new NotificationRecord(mContext, sbn2, mock(NotificationChannel.class)); assertFalse(mService.isVisuallyInterruptive(null, r2)); } @Test public void testHideAndUnhideNotificationsOnSuspendedPackageBroadcast() { // post 2 notification from this package Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +9 −9 Original line number Diff line number Diff line Loading @@ -4522,6 +4522,15 @@ public class NotificationManagerService extends SystemService { @GuardedBy("mNotificationLock") @VisibleForTesting protected boolean isVisuallyInterruptive(NotificationRecord old, NotificationRecord r) { // Ignore summary updates because we don't display most of the information. if (r.sbn.isGroup() && r.sbn.getNotification().isGroupSummary()) { if (DEBUG_INTERRUPTIVENESS) { Log.v(TAG, "INTERRUPTIVENESS: " + r.getKey() + " is not interruptive: summary"); } return false; } if (old == null) { if (DEBUG_INTERRUPTIVENESS) { Log.v(TAG, "INTERRUPTIVENESS: " Loading Loading @@ -4559,15 +4568,6 @@ public class NotificationManagerService extends SystemService { return false; } // Ignore summary updates because we don't display most of the information. if (r.sbn.isGroup() && r.sbn.getNotification().isGroupSummary()) { if (DEBUG_INTERRUPTIVENESS) { Log.v(TAG, "INTERRUPTIVENESS: " + r.getKey() + " is not interruptive: summary"); } return false; } final String oldTitle = String.valueOf(oldN.extras.get(Notification.EXTRA_TITLE)); final String newTitle = String.valueOf(newN.extras.get(Notification.EXTRA_TITLE)); if (!Objects.equals(oldTitle, newTitle)) { Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -2941,6 +2941,20 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { assertFalse(mService.isVisuallyInterruptive(r1, r2)); } @Test public void testVisualDifference_summaryNewNotification() { Notification.Builder nb2 = new Notification.Builder(mContext, "") .setGroup("bananas") .setFlag(Notification.FLAG_GROUP_SUMMARY, true) .setContentText("bar"); StatusBarNotification sbn2 = new StatusBarNotification(PKG, PKG, 0, "tag", mUid, 0, nb2.build(), new UserHandle(mUid), null, 0); NotificationRecord r2 = new NotificationRecord(mContext, sbn2, mock(NotificationChannel.class)); assertFalse(mService.isVisuallyInterruptive(null, r2)); } @Test public void testHideAndUnhideNotificationsOnSuspendedPackageBroadcast() { // post 2 notification from this package Loading