Loading core/java/android/service/notification/ScheduleCalendar.java +2 −2 Original line number Diff line number Diff line Loading @@ -70,10 +70,10 @@ public class ScheduleCalendar { } // only allow alarms in the future if (nextAlarm > now) { // store earliest alarm if (mSchedule.nextAlarm == 0) { if (mSchedule.nextAlarm == 0 || mSchedule.nextAlarm < now) { mSchedule.nextAlarm = nextAlarm; } else { // store earliest alarm mSchedule.nextAlarm = Math.min(mSchedule.nextAlarm, nextAlarm); } } else if (mSchedule.nextAlarm < now) { Loading services/tests/uiservicestests/src/com/android/server/notification/ScheduleCalendarTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -332,6 +332,17 @@ public class ScheduleCalendarTest extends UiServiceTestCase { assertEquals(0, mScheduleInfo.nextAlarm); } @Test public void testMaybeSetNextAlarm_expiredOldAlarm() { mScheduleInfo.exitAtAlarm = true; mScheduleInfo.nextAlarm = 998; mScheduleCalendar.setSchedule(mScheduleInfo); mScheduleCalendar.maybeSetNextAlarm(1000, 1001); assertEquals(1001, mScheduleInfo.nextAlarm); } @Test @FlakyTest public void testIsInSchedule_inScheduleOvernight() { Loading Loading
core/java/android/service/notification/ScheduleCalendar.java +2 −2 Original line number Diff line number Diff line Loading @@ -70,10 +70,10 @@ public class ScheduleCalendar { } // only allow alarms in the future if (nextAlarm > now) { // store earliest alarm if (mSchedule.nextAlarm == 0) { if (mSchedule.nextAlarm == 0 || mSchedule.nextAlarm < now) { mSchedule.nextAlarm = nextAlarm; } else { // store earliest alarm mSchedule.nextAlarm = Math.min(mSchedule.nextAlarm, nextAlarm); } } else if (mSchedule.nextAlarm < now) { Loading
services/tests/uiservicestests/src/com/android/server/notification/ScheduleCalendarTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -332,6 +332,17 @@ public class ScheduleCalendarTest extends UiServiceTestCase { assertEquals(0, mScheduleInfo.nextAlarm); } @Test public void testMaybeSetNextAlarm_expiredOldAlarm() { mScheduleInfo.exitAtAlarm = true; mScheduleInfo.nextAlarm = 998; mScheduleCalendar.setSchedule(mScheduleInfo); mScheduleCalendar.maybeSetNextAlarm(1000, 1001); assertEquals(1001, mScheduleInfo.nextAlarm); } @Test @FlakyTest public void testIsInSchedule_inScheduleOvernight() { Loading