Loading packages/SystemUI/src/com/android/systemui/doze/DozeScreenState.java +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ public class DozeScreenState implements DozeMachine.Part { final boolean pulseEnding = oldState == DOZE_PULSE_DONE && newState.isAlwaysOn(); final boolean turningOn = (oldState == DOZE_AOD_PAUSED || oldState == DOZE) && newState.isAlwaysOn(); final boolean turningOff = (newState.isAlwaysOn() && newState == DOZE) final boolean turningOff = (oldState.isAlwaysOn() && newState == DOZE) || (oldState == DOZE_AOD_PAUSING && newState == DOZE_AOD_PAUSED); final boolean justInitialized = oldState == DozeMachine.State.INITIALIZED; if (messagePending || justInitialized || pulseEnding || turningOn) { Loading packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenStateTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -217,4 +217,20 @@ public class DozeScreenStateTest extends SysuiTestCase { assertEquals(Display.STATE_OFF, mServiceFake.screenState); } @Test public void test_animatesOff() { ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class); doAnswer(invocation -> null).when(mDozeHost).prepareForGentleSleep(captor.capture()); mHandlerFake.setMode(QUEUEING); mScreen.transitionTo(UNINITIALIZED, INITIALIZED); mScreen.transitionTo(INITIALIZED, DOZE_AOD); mScreen.transitionTo(DOZE_AOD, DOZE); mHandlerFake.dispatchQueuedMessages(); verify(mDozeHost).prepareForGentleSleep(eq(captor.getValue())); captor.getValue().run(); assertEquals(Display.STATE_OFF, mServiceFake.screenState); } } No newline at end of file Loading
packages/SystemUI/src/com/android/systemui/doze/DozeScreenState.java +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ public class DozeScreenState implements DozeMachine.Part { final boolean pulseEnding = oldState == DOZE_PULSE_DONE && newState.isAlwaysOn(); final boolean turningOn = (oldState == DOZE_AOD_PAUSED || oldState == DOZE) && newState.isAlwaysOn(); final boolean turningOff = (newState.isAlwaysOn() && newState == DOZE) final boolean turningOff = (oldState.isAlwaysOn() && newState == DOZE) || (oldState == DOZE_AOD_PAUSING && newState == DOZE_AOD_PAUSED); final boolean justInitialized = oldState == DozeMachine.State.INITIALIZED; if (messagePending || justInitialized || pulseEnding || turningOn) { Loading
packages/SystemUI/tests/src/com/android/systemui/doze/DozeScreenStateTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -217,4 +217,20 @@ public class DozeScreenStateTest extends SysuiTestCase { assertEquals(Display.STATE_OFF, mServiceFake.screenState); } @Test public void test_animatesOff() { ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class); doAnswer(invocation -> null).when(mDozeHost).prepareForGentleSleep(captor.capture()); mHandlerFake.setMode(QUEUEING); mScreen.transitionTo(UNINITIALIZED, INITIALIZED); mScreen.transitionTo(INITIALIZED, DOZE_AOD); mScreen.transitionTo(DOZE_AOD, DOZE); mHandlerFake.dispatchQueuedMessages(); verify(mDozeHost).prepareForGentleSleep(eq(captor.getValue())); captor.getValue().run(); assertEquals(Display.STATE_OFF, mServiceFake.screenState); } } No newline at end of file