[DO NOT MERGE] Fix DozeScreenBrightnessTest.
This was broken by ag/15974634, but the presubmits did not catch that for some reason. That CL changed the brightness logic to be <= the dim value, so this failure (and fix) make sense. Test: atest SystemUITests, since apparently treehugger won't do that and will +2 this anyway Fixes: 202212576 Change-Id: Ibe18322fbe1e1fbae86c5274615ad0b6f727c8e2
This commit is contained in:
@@ -301,13 +301,14 @@ public class DozeScreenBrightnessTest extends SysuiTestCase {
|
|||||||
when(mWakefulnessLifecycle.getLastSleepReason()).thenReturn(
|
when(mWakefulnessLifecycle.getLastSleepReason()).thenReturn(
|
||||||
PowerManager.GO_TO_SLEEP_REASON_TIMEOUT);
|
PowerManager.GO_TO_SLEEP_REASON_TIMEOUT);
|
||||||
when(mDozeParameters.shouldControlUnlockedScreenOff()).thenReturn(true);
|
when(mDozeParameters.shouldControlUnlockedScreenOff()).thenReturn(true);
|
||||||
|
when(mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()).thenReturn(true);
|
||||||
|
|
||||||
mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
|
mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
|
||||||
mScreen.transitionTo(INITIALIZED, DOZE);
|
mScreen.transitionTo(INITIALIZED, DOZE);
|
||||||
|
|
||||||
// If we're dozing after a timeout, and playing the unlocked screen animation, we should
|
// If we're dozing after a timeout, and playing the unlocked screen animation, we should
|
||||||
// stay at dim brightness, because the screen dims just before timeout.
|
// stay at or below dim brightness, because the screen dims just before timeout.
|
||||||
assertEquals(mServiceFake.screenBrightness, DIM_BRIGHTNESS);
|
assertTrue(mServiceFake.screenBrightness <= DIM_BRIGHTNESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -315,6 +316,7 @@ public class DozeScreenBrightnessTest extends SysuiTestCase {
|
|||||||
when(mWakefulnessLifecycle.getLastSleepReason()).thenReturn(
|
when(mWakefulnessLifecycle.getLastSleepReason()).thenReturn(
|
||||||
PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON);
|
PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON);
|
||||||
when(mDozeParameters.shouldControlUnlockedScreenOff()).thenReturn(true);
|
when(mDozeParameters.shouldControlUnlockedScreenOff()).thenReturn(true);
|
||||||
|
when(mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()).thenReturn(true);
|
||||||
|
|
||||||
mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
|
mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
|
||||||
mScreen.transitionTo(INITIALIZED, DOZE);
|
mScreen.transitionTo(INITIALIZED, DOZE);
|
||||||
@@ -329,6 +331,7 @@ public class DozeScreenBrightnessTest extends SysuiTestCase {
|
|||||||
when(mWakefulnessLifecycle.getLastSleepReason()).thenReturn(
|
when(mWakefulnessLifecycle.getLastSleepReason()).thenReturn(
|
||||||
PowerManager.GO_TO_SLEEP_REASON_TIMEOUT);
|
PowerManager.GO_TO_SLEEP_REASON_TIMEOUT);
|
||||||
when(mDozeParameters.shouldControlUnlockedScreenOff()).thenReturn(false);
|
when(mDozeParameters.shouldControlUnlockedScreenOff()).thenReturn(false);
|
||||||
|
when(mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()).thenReturn(false);
|
||||||
|
|
||||||
mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
|
mScreen.transitionTo(UNINITIALIZED, INITIALIZED);
|
||||||
mScreen.transitionTo(INITIALIZED, DOZE);
|
mScreen.transitionTo(INITIALIZED, DOZE);
|
||||||
|
|||||||
Reference in New Issue
Block a user