Merge "Fix display fade-out animation" into rvc-dev

This commit is contained in:
Lucas Dupin 2020-03-24 01:37:47 +00:00 committed by Android (Google) Code Review
commit a8dfb52c0f
2 changed files with 17 additions and 1 deletions

View File

@ -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) {

View File

@ -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);
}
}