[DO NOT MERGE] Fix DozeScreenBrightnessTest. am: 20d85a91d4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15994907

Change-Id: I674c6d8ccbce26a406bbe0a8e669de6c2174cd3b
This commit is contained in:
Josh Tsuji
2021-10-07 04:08:08 +00:00
committed by Automerger Merge Worker

View File

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