Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ResourceTrimmerTest.kt +0 −66 Original line number Diff line number Diff line Loading @@ -9,15 +9,12 @@ import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.flags.EnableSceneContainer import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFingerprintAuthRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.SuccessFingerprintAuthenticationStatus import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAsleepForTest import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.scene.data.repository.Idle import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.domain.interactor.sceneInteractor Loading @@ -42,10 +39,8 @@ class ResourceTrimmerTest : SysuiTestCase() { val kosmos = testKosmos() private val testScope = kosmos.testScope private val keyguardRepository = kosmos.fakeKeyguardRepository private val featureFlags = kosmos.fakeFeatureFlagsClassic private val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository private val powerInteractor = kosmos.powerInteractor @Mock private lateinit var globalWindowManager: GlobalWindowManager private lateinit var resourceTrimmer: ResourceTrimmer Loading @@ -55,8 +50,6 @@ class ResourceTrimmerTest : SysuiTestCase() { @Before fun setUp() { MockitoAnnotations.initMocks(this) keyguardRepository.setDozeAmount(0f) keyguardRepository.setKeyguardGoingAway(false) resourceTrimmer = ResourceTrimmer( keyguardTransitionInteractor = kosmos.keyguardTransitionInteractor, Loading @@ -67,65 +60,6 @@ class ResourceTrimmerTest : SysuiTestCase() { resourceTrimmer.start() } @Test fun dozeAodDisabled_sleep_doesntTrimMemory() = testScope.runTest { powerInteractor.setAsleepForTest() testScope.runCurrent() verifyNoMoreInteractions(globalWindowManager) } @Test fun dozeEnabled_sleepWithFullDozeAmount_doesntTrimMemory() = testScope.runTest { keyguardRepository.setDreaming(true) keyguardRepository.setDozeAmount(1f) powerInteractor.setAsleepForTest() testScope.runCurrent() verifyNoMoreInteractions(globalWindowManager) } @Test fun dozeEnabled_sleepWithoutFullDozeAmount_doesntTrimMemory() = testScope.runTest { keyguardRepository.setDreaming(true) keyguardRepository.setDozeAmount(0f) powerInteractor.setAsleepForTest() testScope.runCurrent() verifyNoMoreInteractions(globalWindowManager) } @Test fun aodEnabled_deviceWakesHalfWayThrough_doesNotTrimMemory() { testScope.runTest { keyguardRepository.setDreaming(true) keyguardRepository.setDozeAmount(0f) powerInteractor.setAsleepForTest() testScope.runCurrent() verifyNoMoreInteractions(globalWindowManager) generateSequence(0f) { it + 0.1f } .takeWhile { it < 0.8f } .forEach { keyguardRepository.setDozeAmount(it) testScope.runCurrent() } verifyNoMoreInteractions(globalWindowManager) generateSequence(0.8f) { it - 0.1f } .takeWhile { it >= 0f } .forEach { keyguardRepository.setDozeAmount(it) testScope.runCurrent() } keyguardRepository.setDozeAmount(0f) testScope.runCurrent() verifyNoMoreInteractions(globalWindowManager) } } @Test @DisableSceneContainer fun keyguardTransitionsToGone_trimsFontCache() = Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt +0 −27 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import com.android.systemui.doze.DozeMachine import com.android.systemui.doze.DozeTransitionCallback import com.android.systemui.doze.DozeTransitionListener import com.android.systemui.dreams.DreamOverlayCallbackController import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.keyguard.shared.model.BiometricUnlockMode import com.android.systemui.keyguard.shared.model.BiometricUnlockSource import com.android.systemui.keyguard.shared.model.DozeStateModel Loading @@ -39,7 +38,6 @@ import com.android.systemui.keyguard.shared.model.DozeTransitionModel import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor Loading Loading @@ -265,31 +263,6 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { assertThat(underTest.lastDozeTapToWakePosition.value).isEqualTo(expectedPoint) } @Test @DisableSceneContainer fun dozeAmount() = testScope.runTest { val values = mutableListOf<Float>() val job = underTest.linearDozeAmount.onEach(values::add).launchIn(this) val captor = argumentCaptor<StatusBarStateController.StateListener>() runCurrent() verify(statusBarStateController, atLeastOnce()).addCallback(captor.capture()) captor.allValues.forEach { it.onDozeAmountChanged(0.433f, 0.4f) } runCurrent() captor.allValues.forEach { it.onDozeAmountChanged(0.498f, 0.5f) } runCurrent() captor.allValues.forEach { it.onDozeAmountChanged(0.661f, 0.65f) } runCurrent() assertThat(values).isEqualTo(listOf(0f, 0.433f, 0.498f, 0.661f)) job.cancel() runCurrent() verify(statusBarStateController).removeCallback(any()) } @Test fun isUdfpsSupported() = testScope.runTest { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt +0 −2 Original line number Diff line number Diff line Loading @@ -563,7 +563,6 @@ class KeyguardInteractorTest : SysuiTestCase() { } @Test @EnableSceneContainer fun dozeAmount_updatedByAodTransitionWhenAodEnabled() = testScope.runTest { val dozeAmount by collectLastValue(underTest.dozeAmount) Loading @@ -590,7 +589,6 @@ class KeyguardInteractorTest : SysuiTestCase() { } @Test @EnableSceneContainer fun dozeAmount_updatedByDozeTransitionWhenAodDisabled() = testScope.runTest { val dozeAmount by collectLastValue(underTest.dozeAmount) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/UdfpsKeyguardInteractorTest.kt +8 −22 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAwakeForTest import com.android.systemui.power.domain.interactor.PowerInteractorFactory import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.shade.data.repository.fakeShadeRepository import com.android.systemui.shade.domain.interactor.shadeInteractor import com.android.systemui.shade.domain.interactor.shadeLockscreenInteractor Loading Loading @@ -108,7 +107,7 @@ class UdfpsKeyguardInteractorTest(flags: FlagsParameterization) : SysuiTestCase( burnInHelper, testScope.backgroundScope, kosmos.configurationInteractor, kosmos.keyguardInteractor kosmos.keyguardInteractor, ) powerInteractor = PowerInteractorFactory.create().powerInteractor Loading Loading @@ -138,15 +137,10 @@ class UdfpsKeyguardInteractorTest(flags: FlagsParameterization) : SysuiTestCase( assertThat(burnInOffsets?.x).isEqualTo(0) // WHEN we're in the middle of the doze amount change if (SceneContainerFlag.isEnabled) { sendTransitionSteps( TransitionStep(to = DOZING, value = 0.0f, transitionState = STARTED), TransitionStep(to = DOZING, value = 0.5f, transitionState = RUNNING), ) } else { keyguardRepository.setDozeAmount(.50f) runCurrent() } // THEN burn in is updated (between 0 and the full offset) assertThat(burnInOffsets?.progress).isGreaterThan(0f) Loading @@ -157,14 +151,9 @@ class UdfpsKeyguardInteractorTest(flags: FlagsParameterization) : SysuiTestCase( assertThat(burnInOffsets?.x).isLessThan(burnInXOffset) // WHEN we're fully dozing if (SceneContainerFlag.isEnabled) { sendTransitionSteps( TransitionStep(to = DOZING, value = 1.0f, transitionState = FINISHED) ) } else { keyguardRepository.setDozeAmount(1f) runCurrent() } // THEN burn in offsets are updated to final current values (for the given time) assertThat(burnInOffsets?.progress).isEqualTo(burnInProgress) Loading Loading @@ -236,9 +225,6 @@ class UdfpsKeyguardInteractorTest(flags: FlagsParameterization) : SysuiTestCase( } private fun setAwake() { if (!SceneContainerFlag.isEnabled) { keyguardRepository.setDozeAmount(0f) } keyguardRepository.dozeTimeTick() bouncerRepository.setAlternateVisible(false) Loading packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +1 −47 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback import com.android.systemui.biometrics.AuthController import com.android.systemui.biometrics.data.repository.FacePropertyRepository import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLogging import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Main Loading @@ -46,6 +45,7 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.time.SystemClock import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope Loading @@ -58,7 +58,6 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.mapLatest Loading Loading @@ -158,10 +157,6 @@ interface KeyguardRepository { * * Doze state is the same as "Always on Display" or "AOD". It is the state that the device can * enter to conserve battery when the device is locked and inactive. * * Note that it is possible for the system to be transitioning into doze while this flow still * returns `false`. In order to account for that, observers should also use the * [linearDozeAmount] flow to check if it's greater than `0` */ val isDozing: StateFlow<Boolean> Loading @@ -179,18 +174,6 @@ interface KeyguardRepository { /** Observable for whether the device is dreaming with an overlay, see [DreamOverlayService] */ val isDreamingWithOverlay: Flow<Boolean> /** * Observable for the amount of doze we are currently in. * * While in doze state, this amount can change - driving a cycle of animations designed to avoid * pixel burn-in, etc. * * Also note that the value here may be greater than `0` while [isDozing] is still `false`, this * happens during an animation/transition into doze mode. An observer would be wise to account * for both flows if needed. */ val linearDozeAmount: Flow<Float> /** Doze state information, as it transitions */ val dozeTransitionModel: Flow<DozeTransitionModel> Loading Loading @@ -462,35 +445,6 @@ constructor( override val isDreaming: MutableStateFlow<Boolean> = MutableStateFlow(false) private val _preSceneLinearDozeAmount: Flow<Float> = if (SceneContainerFlag.isEnabled) { emptyFlow() } else { conflatedCallbackFlow { val callback = object : StatusBarStateController.StateListener { override fun onDozeAmountChanged(linear: Float, eased: Float) { trySendWithFailureLogging(linear, TAG, "updated dozeAmount") } } statusBarStateController.addCallback(callback) trySendWithFailureLogging( statusBarStateController.dozeAmount, TAG, "initial dozeAmount", ) awaitClose { statusBarStateController.removeCallback(callback) } } } override val linearDozeAmount: Flow<Float> get() { SceneContainerFlag.assertInLegacyMode() return _preSceneLinearDozeAmount } override val dozeTransitionModel: Flow<DozeTransitionModel> = conflatedCallbackFlow { val callback = object : DozeTransitionCallback { Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ResourceTrimmerTest.kt +0 −66 Original line number Diff line number Diff line Loading @@ -9,15 +9,12 @@ import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.flags.EnableSceneContainer import com.android.systemui.flags.fakeFeatureFlagsClassic import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFingerprintAuthRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.SuccessFingerprintAuthenticationStatus import com.android.systemui.kosmos.testDispatcher import com.android.systemui.kosmos.testScope import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAsleepForTest import com.android.systemui.power.domain.interactor.powerInteractor import com.android.systemui.scene.data.repository.Idle import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.domain.interactor.sceneInteractor Loading @@ -42,10 +39,8 @@ class ResourceTrimmerTest : SysuiTestCase() { val kosmos = testKosmos() private val testScope = kosmos.testScope private val keyguardRepository = kosmos.fakeKeyguardRepository private val featureFlags = kosmos.fakeFeatureFlagsClassic private val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository private val powerInteractor = kosmos.powerInteractor @Mock private lateinit var globalWindowManager: GlobalWindowManager private lateinit var resourceTrimmer: ResourceTrimmer Loading @@ -55,8 +50,6 @@ class ResourceTrimmerTest : SysuiTestCase() { @Before fun setUp() { MockitoAnnotations.initMocks(this) keyguardRepository.setDozeAmount(0f) keyguardRepository.setKeyguardGoingAway(false) resourceTrimmer = ResourceTrimmer( keyguardTransitionInteractor = kosmos.keyguardTransitionInteractor, Loading @@ -67,65 +60,6 @@ class ResourceTrimmerTest : SysuiTestCase() { resourceTrimmer.start() } @Test fun dozeAodDisabled_sleep_doesntTrimMemory() = testScope.runTest { powerInteractor.setAsleepForTest() testScope.runCurrent() verifyNoMoreInteractions(globalWindowManager) } @Test fun dozeEnabled_sleepWithFullDozeAmount_doesntTrimMemory() = testScope.runTest { keyguardRepository.setDreaming(true) keyguardRepository.setDozeAmount(1f) powerInteractor.setAsleepForTest() testScope.runCurrent() verifyNoMoreInteractions(globalWindowManager) } @Test fun dozeEnabled_sleepWithoutFullDozeAmount_doesntTrimMemory() = testScope.runTest { keyguardRepository.setDreaming(true) keyguardRepository.setDozeAmount(0f) powerInteractor.setAsleepForTest() testScope.runCurrent() verifyNoMoreInteractions(globalWindowManager) } @Test fun aodEnabled_deviceWakesHalfWayThrough_doesNotTrimMemory() { testScope.runTest { keyguardRepository.setDreaming(true) keyguardRepository.setDozeAmount(0f) powerInteractor.setAsleepForTest() testScope.runCurrent() verifyNoMoreInteractions(globalWindowManager) generateSequence(0f) { it + 0.1f } .takeWhile { it < 0.8f } .forEach { keyguardRepository.setDozeAmount(it) testScope.runCurrent() } verifyNoMoreInteractions(globalWindowManager) generateSequence(0.8f) { it - 0.1f } .takeWhile { it >= 0f } .forEach { keyguardRepository.setDozeAmount(it) testScope.runCurrent() } keyguardRepository.setDozeAmount(0f) testScope.runCurrent() verifyNoMoreInteractions(globalWindowManager) } } @Test @DisableSceneContainer fun keyguardTransitionsToGone_trimsFontCache() = Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt +0 −27 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import com.android.systemui.doze.DozeMachine import com.android.systemui.doze.DozeTransitionCallback import com.android.systemui.doze.DozeTransitionListener import com.android.systemui.dreams.DreamOverlayCallbackController import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.keyguard.shared.model.BiometricUnlockMode import com.android.systemui.keyguard.shared.model.BiometricUnlockSource import com.android.systemui.keyguard.shared.model.DozeStateModel Loading @@ -39,7 +38,6 @@ import com.android.systemui.keyguard.shared.model.DozeTransitionModel import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.whenever import com.android.systemui.util.mockito.withArgCaptor Loading Loading @@ -265,31 +263,6 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { assertThat(underTest.lastDozeTapToWakePosition.value).isEqualTo(expectedPoint) } @Test @DisableSceneContainer fun dozeAmount() = testScope.runTest { val values = mutableListOf<Float>() val job = underTest.linearDozeAmount.onEach(values::add).launchIn(this) val captor = argumentCaptor<StatusBarStateController.StateListener>() runCurrent() verify(statusBarStateController, atLeastOnce()).addCallback(captor.capture()) captor.allValues.forEach { it.onDozeAmountChanged(0.433f, 0.4f) } runCurrent() captor.allValues.forEach { it.onDozeAmountChanged(0.498f, 0.5f) } runCurrent() captor.allValues.forEach { it.onDozeAmountChanged(0.661f, 0.65f) } runCurrent() assertThat(values).isEqualTo(listOf(0f, 0.433f, 0.498f, 0.661f)) job.cancel() runCurrent() verify(statusBarStateController).removeCallback(any()) } @Test fun isUdfpsSupported() = testScope.runTest { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractorTest.kt +0 −2 Original line number Diff line number Diff line Loading @@ -563,7 +563,6 @@ class KeyguardInteractorTest : SysuiTestCase() { } @Test @EnableSceneContainer fun dozeAmount_updatedByAodTransitionWhenAodEnabled() = testScope.runTest { val dozeAmount by collectLastValue(underTest.dozeAmount) Loading @@ -590,7 +589,6 @@ class KeyguardInteractorTest : SysuiTestCase() { } @Test @EnableSceneContainer fun dozeAmount_updatedByDozeTransitionWhenAodDisabled() = testScope.runTest { val dozeAmount by collectLastValue(underTest.dozeAmount) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/UdfpsKeyguardInteractorTest.kt +8 −22 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAwakeForTest import com.android.systemui.power.domain.interactor.PowerInteractorFactory import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.shade.data.repository.fakeShadeRepository import com.android.systemui.shade.domain.interactor.shadeInteractor import com.android.systemui.shade.domain.interactor.shadeLockscreenInteractor Loading Loading @@ -108,7 +107,7 @@ class UdfpsKeyguardInteractorTest(flags: FlagsParameterization) : SysuiTestCase( burnInHelper, testScope.backgroundScope, kosmos.configurationInteractor, kosmos.keyguardInteractor kosmos.keyguardInteractor, ) powerInteractor = PowerInteractorFactory.create().powerInteractor Loading Loading @@ -138,15 +137,10 @@ class UdfpsKeyguardInteractorTest(flags: FlagsParameterization) : SysuiTestCase( assertThat(burnInOffsets?.x).isEqualTo(0) // WHEN we're in the middle of the doze amount change if (SceneContainerFlag.isEnabled) { sendTransitionSteps( TransitionStep(to = DOZING, value = 0.0f, transitionState = STARTED), TransitionStep(to = DOZING, value = 0.5f, transitionState = RUNNING), ) } else { keyguardRepository.setDozeAmount(.50f) runCurrent() } // THEN burn in is updated (between 0 and the full offset) assertThat(burnInOffsets?.progress).isGreaterThan(0f) Loading @@ -157,14 +151,9 @@ class UdfpsKeyguardInteractorTest(flags: FlagsParameterization) : SysuiTestCase( assertThat(burnInOffsets?.x).isLessThan(burnInXOffset) // WHEN we're fully dozing if (SceneContainerFlag.isEnabled) { sendTransitionSteps( TransitionStep(to = DOZING, value = 1.0f, transitionState = FINISHED) ) } else { keyguardRepository.setDozeAmount(1f) runCurrent() } // THEN burn in offsets are updated to final current values (for the given time) assertThat(burnInOffsets?.progress).isEqualTo(burnInProgress) Loading Loading @@ -236,9 +225,6 @@ class UdfpsKeyguardInteractorTest(flags: FlagsParameterization) : SysuiTestCase( } private fun setAwake() { if (!SceneContainerFlag.isEnabled) { keyguardRepository.setDozeAmount(0f) } keyguardRepository.dozeTimeTick() bouncerRepository.setAlternateVisible(false) Loading
packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +1 −47 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback import com.android.systemui.biometrics.AuthController import com.android.systemui.biometrics.data.repository.FacePropertyRepository import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLogging import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Main Loading @@ -46,6 +45,7 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.time.SystemClock import com.android.systemui.utils.coroutines.flow.conflatedCallbackFlow import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope Loading @@ -58,7 +58,6 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.mapLatest Loading Loading @@ -158,10 +157,6 @@ interface KeyguardRepository { * * Doze state is the same as "Always on Display" or "AOD". It is the state that the device can * enter to conserve battery when the device is locked and inactive. * * Note that it is possible for the system to be transitioning into doze while this flow still * returns `false`. In order to account for that, observers should also use the * [linearDozeAmount] flow to check if it's greater than `0` */ val isDozing: StateFlow<Boolean> Loading @@ -179,18 +174,6 @@ interface KeyguardRepository { /** Observable for whether the device is dreaming with an overlay, see [DreamOverlayService] */ val isDreamingWithOverlay: Flow<Boolean> /** * Observable for the amount of doze we are currently in. * * While in doze state, this amount can change - driving a cycle of animations designed to avoid * pixel burn-in, etc. * * Also note that the value here may be greater than `0` while [isDozing] is still `false`, this * happens during an animation/transition into doze mode. An observer would be wise to account * for both flows if needed. */ val linearDozeAmount: Flow<Float> /** Doze state information, as it transitions */ val dozeTransitionModel: Flow<DozeTransitionModel> Loading Loading @@ -462,35 +445,6 @@ constructor( override val isDreaming: MutableStateFlow<Boolean> = MutableStateFlow(false) private val _preSceneLinearDozeAmount: Flow<Float> = if (SceneContainerFlag.isEnabled) { emptyFlow() } else { conflatedCallbackFlow { val callback = object : StatusBarStateController.StateListener { override fun onDozeAmountChanged(linear: Float, eased: Float) { trySendWithFailureLogging(linear, TAG, "updated dozeAmount") } } statusBarStateController.addCallback(callback) trySendWithFailureLogging( statusBarStateController.dozeAmount, TAG, "initial dozeAmount", ) awaitClose { statusBarStateController.removeCallback(callback) } } } override val linearDozeAmount: Flow<Float> get() { SceneContainerFlag.assertInLegacyMode() return _preSceneLinearDozeAmount } override val dozeTransitionModel: Flow<DozeTransitionModel> = conflatedCallbackFlow { val callback = object : DozeTransitionCallback { Loading