Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed5634d9 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Fix display fade-out animation

Display was not turning off animated in some occasions, due to a
wrong variable being used.

Test: atest DozeScreenStateTest
Fixes: 152246123
Change-Id: I5e6f32566d74f67476018b01013fc177702311a7
parent 25f8496e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+16 −0
Original line number Diff line number Diff line
@@ -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