Loading services/core/java/com/android/server/notification/TimeToLiveHelper.java +5 −1 Original line number Diff line number Diff line Loading @@ -188,7 +188,11 @@ public class TimeToLiveHelper { timeoutKey = earliest.second; } } if (timeoutKey != null) { mNm.timeoutNotification(timeoutKey); } else { Slog.wtf(TAG, "Alarm triggered but should have been cleaned up already"); } } } }; Loading services/tests/uiservicestests/src/com/android/server/notification/TimeToLiveHelperTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import static com.android.server.notification.TimeToLiveHelper.EXTRA_KEY; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; Loading Loading @@ -107,6 +108,21 @@ public class TimeToLiveHelperTest extends UiServiceTestCase { assertThat(mHelper.mKeys).isEmpty(); } @Test public void testTimeoutExpiresButNotifEntryGone() { NotificationRecord r = getRecord("testTimeoutExpires", 1); mHelper.scheduleTimeoutLocked(r, 1); ArgumentCaptor<PendingIntent> captor = ArgumentCaptor.forClass(PendingIntent.class); verify(mAm).setExactAndAllowWhileIdle(anyInt(), eq(2L), captor.capture()); mHelper.mKeys.clear(); mHelper.mNotificationTimeoutReceiver.onReceive(mContext, captor.getValue().getIntent()); verify(mNm, never()).timeoutNotification(anyString()); } @Test public void testTimeoutExpires_twoEntries() { NotificationRecord first = getRecord("testTimeoutFirst", 1); Loading Loading
services/core/java/com/android/server/notification/TimeToLiveHelper.java +5 −1 Original line number Diff line number Diff line Loading @@ -188,7 +188,11 @@ public class TimeToLiveHelper { timeoutKey = earliest.second; } } if (timeoutKey != null) { mNm.timeoutNotification(timeoutKey); } else { Slog.wtf(TAG, "Alarm triggered but should have been cleaned up already"); } } } }; Loading
services/tests/uiservicestests/src/com/android/server/notification/TimeToLiveHelperTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import static com.android.server.notification.TimeToLiveHelper.EXTRA_KEY; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; Loading Loading @@ -107,6 +108,21 @@ public class TimeToLiveHelperTest extends UiServiceTestCase { assertThat(mHelper.mKeys).isEmpty(); } @Test public void testTimeoutExpiresButNotifEntryGone() { NotificationRecord r = getRecord("testTimeoutExpires", 1); mHelper.scheduleTimeoutLocked(r, 1); ArgumentCaptor<PendingIntent> captor = ArgumentCaptor.forClass(PendingIntent.class); verify(mAm).setExactAndAllowWhileIdle(anyInt(), eq(2L), captor.capture()); mHelper.mKeys.clear(); mHelper.mNotificationTimeoutReceiver.onReceive(mContext, captor.getValue().getIntent()); verify(mNm, never()).timeoutNotification(anyString()); } @Test public void testTimeoutExpires_twoEntries() { NotificationRecord first = getRecord("testTimeoutFirst", 1); Loading