Loading packages/SystemUI/multivalentTests/src/com/android/systemui/lowlight/LowLightBehaviorCoreStartableTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -306,6 +306,25 @@ class LowLightBehaviorCoreStartableTest : SysuiTestCase() { assertThat(ambientLightModeMonitor.fake.started).isFalse() } @Test fun testDoNotSubscribeIfDozeForLowLightBehaviorPluggedIn() = kosmos.runTest { lowLightRepository.addAction(LowLightDisplayBehavior.LOW_LIGHT_DREAM, action) lowLightSettingsRepository.setLowLightDisplayBehavior( LowLightDisplayBehavior.LOW_LIGHT_DREAM ) setBatteryPluggedIn(true) setDisplayOn(true) fakeKeyguardRepository.setDozeTransitionModel( DozeTransitionModel(from = DozeStateModel.UNINITIALIZED, to = DozeStateModel.DOZE) ) underTest.start() assertThat(ambientLightModeMonitor.fake.started).isFalse() } private fun Kosmos.setLowLightFromSensor(lowlight: Boolean) { val lightMode = if (lowlight) { Loading packages/SystemUI/src/com/android/systemui/lowlight/LowLightBehaviorCoreStartable.kt +11 −13 Original line number Diff line number Diff line Loading @@ -158,6 +158,10 @@ constructor( anyOf(isScreenOn, flowOf(behavior.allowedInScreenState(ScreenState.OFF))), dreamSettingsInteractor.dreamingEnabled, isPluggedIn, anyOf( isDeviceIdleAndNotDozing, flowOf(behavior.allowedInScreenState(ScreenState.DOZE)), ), ) .flatMapLatestConflated { // The second set of conditions are separated from the above allOf flow combination Loading @@ -169,11 +173,6 @@ constructor( // Force lowlight only if idle and in either direct-boot // mode or in a lowlight environment. if (it) { allOf( anyOf( isDeviceIdleAndNotDozing, flowOf(behavior.allowedInScreenState(ScreenState.DOZE)), ), anyOf( isLowLight, if (lowLightSettingsInteractor.allowLowLightBehaviorWhenLocked) { Loading @@ -181,7 +180,6 @@ constructor( } else { flowOf(false) }, ), ) } else { flowOf(false) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/lowlight/LowLightBehaviorCoreStartableTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -306,6 +306,25 @@ class LowLightBehaviorCoreStartableTest : SysuiTestCase() { assertThat(ambientLightModeMonitor.fake.started).isFalse() } @Test fun testDoNotSubscribeIfDozeForLowLightBehaviorPluggedIn() = kosmos.runTest { lowLightRepository.addAction(LowLightDisplayBehavior.LOW_LIGHT_DREAM, action) lowLightSettingsRepository.setLowLightDisplayBehavior( LowLightDisplayBehavior.LOW_LIGHT_DREAM ) setBatteryPluggedIn(true) setDisplayOn(true) fakeKeyguardRepository.setDozeTransitionModel( DozeTransitionModel(from = DozeStateModel.UNINITIALIZED, to = DozeStateModel.DOZE) ) underTest.start() assertThat(ambientLightModeMonitor.fake.started).isFalse() } private fun Kosmos.setLowLightFromSensor(lowlight: Boolean) { val lightMode = if (lowlight) { Loading
packages/SystemUI/src/com/android/systemui/lowlight/LowLightBehaviorCoreStartable.kt +11 −13 Original line number Diff line number Diff line Loading @@ -158,6 +158,10 @@ constructor( anyOf(isScreenOn, flowOf(behavior.allowedInScreenState(ScreenState.OFF))), dreamSettingsInteractor.dreamingEnabled, isPluggedIn, anyOf( isDeviceIdleAndNotDozing, flowOf(behavior.allowedInScreenState(ScreenState.DOZE)), ), ) .flatMapLatestConflated { // The second set of conditions are separated from the above allOf flow combination Loading @@ -169,11 +173,6 @@ constructor( // Force lowlight only if idle and in either direct-boot // mode or in a lowlight environment. if (it) { allOf( anyOf( isDeviceIdleAndNotDozing, flowOf(behavior.allowedInScreenState(ScreenState.DOZE)), ), anyOf( isLowLight, if (lowLightSettingsInteractor.allowLowLightBehaviorWhenLocked) { Loading @@ -181,7 +180,6 @@ constructor( } else { flowOf(false) }, ), ) } else { flowOf(false) Loading