Loading services/core/java/com/android/server/notification/SnoozeHelper.java +0 −3 Original line number Diff line number Diff line Loading @@ -231,9 +231,6 @@ public class SnoozeHelper { return; } NotificationRecord existing = pkgRecords.get(record.getKey()); if (existing != null && existing.isCanceled) { return; } pkgRecords.put(record.getKey(), record); } Loading services/tests/uiservicestests/src/com/android/server/notification/SnoozeHelperTest.java +20 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,26 @@ public class SnoozeHelperTest extends UiServiceTestCase { verify(mCallback, times(1)).repost(UserHandle.USER_SYSTEM, r); } @Test public void testUpdateAfterCancel() throws Exception { // snooze a notification NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM); mSnoozeHelper.snooze(r , 1000); // cancel the notification mSnoozeHelper.cancel(UserHandle.USER_SYSTEM, false); // update the notification r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM); mSnoozeHelper.update(UserHandle.USER_SYSTEM, r); // verify callback is called when repost (snooze is expired) verify(mCallback, never()).repost(anyInt(), any(NotificationRecord.class)); mSnoozeHelper.repost(r.getKey(), UserHandle.USER_SYSTEM); verify(mCallback, times(1)).repost(UserHandle.USER_SYSTEM, r); assertFalse(r.isCanceled); } @Test public void testGetSnoozedByUser() throws Exception { NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM); Loading Loading
services/core/java/com/android/server/notification/SnoozeHelper.java +0 −3 Original line number Diff line number Diff line Loading @@ -231,9 +231,6 @@ public class SnoozeHelper { return; } NotificationRecord existing = pkgRecords.get(record.getKey()); if (existing != null && existing.isCanceled) { return; } pkgRecords.put(record.getKey(), record); } Loading
services/tests/uiservicestests/src/com/android/server/notification/SnoozeHelperTest.java +20 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,26 @@ public class SnoozeHelperTest extends UiServiceTestCase { verify(mCallback, times(1)).repost(UserHandle.USER_SYSTEM, r); } @Test public void testUpdateAfterCancel() throws Exception { // snooze a notification NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM); mSnoozeHelper.snooze(r , 1000); // cancel the notification mSnoozeHelper.cancel(UserHandle.USER_SYSTEM, false); // update the notification r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM); mSnoozeHelper.update(UserHandle.USER_SYSTEM, r); // verify callback is called when repost (snooze is expired) verify(mCallback, never()).repost(anyInt(), any(NotificationRecord.class)); mSnoozeHelper.repost(r.getKey(), UserHandle.USER_SYSTEM); verify(mCallback, times(1)).repost(UserHandle.USER_SYSTEM, r); assertFalse(r.isCanceled); } @Test public void testGetSnoozedByUser() throws Exception { NotificationRecord r = getNotificationRecord("pkg", 1, "one", UserHandle.SYSTEM); Loading