Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt +5 −42 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { @Test @EnableSceneContainer fun surfaceBehindVisibility_fromLockscreenToGone_noUserInput_trueThroughout() = fun surfaceBehindVisibility_fromLockscreenToGone_dependsOnDeviceEntry() = testScope.runTest { val isSurfaceBehindVisible by collectLastValue(underTest.value.surfaceBehindVisibility) val currentScene by collectLastValue(kosmos.sceneInteractor.currentScene) Loading @@ -208,7 +208,7 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { SuccessFingerprintAuthenticationStatus(0, true) ) // Start the transition to Gone, the surface should become immediately visible. // Start the transition to Gone, the surface should remain invisible. kosmos.setSceneTransition( ObservableTransitionState.Transition( fromScene = Scenes.Lockscreen, Loading @@ -220,9 +220,9 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { ) ) assertThat(currentScene).isEqualTo(Scenes.Lockscreen) assertThat(isSurfaceBehindVisible).isTrue() assertThat(isSurfaceBehindVisible).isFalse() // Towards the end of the transition, the surface should continue to be visible. // Towards the end of the transition, the surface should continue to remain invisible. kosmos.setSceneTransition( ObservableTransitionState.Transition( fromScene = Scenes.Lockscreen, Loading @@ -234,7 +234,7 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { ) ) assertThat(currentScene).isEqualTo(Scenes.Lockscreen) assertThat(isSurfaceBehindVisible).isTrue() assertThat(isSurfaceBehindVisible).isFalse() // After the transition, settles on Gone. Surface behind should stay visible now. kosmos.setSceneTransition(ObservableTransitionState.Idle(Scenes.Gone)) Loading @@ -243,43 +243,6 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { assertThat(isSurfaceBehindVisible).isTrue() } @Test @EnableSceneContainer fun surfaceBehindVisibility_fromLockscreenToGone_withUserInput_falseUntilInputStops() = testScope.runTest { val isSurfaceBehindVisible by collectLastValue(underTest.value.surfaceBehindVisibility) val currentScene by collectLastValue(kosmos.sceneInteractor.currentScene) // Before the transition, we start on Lockscreen so the surface should start invisible. kosmos.setSceneTransition(ObservableTransitionState.Idle(Scenes.Lockscreen)) assertThat(currentScene).isEqualTo(Scenes.Lockscreen) assertThat(isSurfaceBehindVisible).isFalse() // Unlocked with fingerprint. kosmos.deviceEntryFingerprintAuthRepository.setAuthenticationStatus( SuccessFingerprintAuthenticationStatus(0, true) ) // Start the transition to Gone, the surface should not be visible while // isUserInputOngoing is true val isUserInputOngoing = MutableStateFlow(true) kosmos.setSceneTransition( ObservableTransitionState.Transition( fromScene = Scenes.Lockscreen, toScene = Scenes.Gone, isInitiatedByUserInput = true, isUserInputOngoing = isUserInputOngoing, progress = flowOf(0.51f), currentScene = flowOf(Scenes.Gone), ) ) assertThat(isSurfaceBehindVisible).isFalse() // When isUserInputOngoing becomes false, then the surface should become visible. isUserInputOngoing.value = false assertThat(isSurfaceBehindVisible).isTrue() } @Test @EnableSceneContainer fun surfaceBehindVisibility_fromBouncerToGone_becomesTrue() = Loading packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +0 −34 Original line number Diff line number Diff line Loading @@ -2118,40 +2118,6 @@ class SceneContainerStartableTest : SysuiTestCase() { assertThat(currentScene).isEqualTo(Scenes.Lockscreen) } @Test fun switchToGone_whenSurfaceBehindLockscreenVisibleMidTransition() = testScope.runTest { val currentScene by collectLastValue(sceneInteractor.currentScene) val transitionStateFlow = prepareState(authenticationMethod = AuthenticationMethodModel.None) underTest.start() assertThat(currentScene).isEqualTo(Scenes.Lockscreen) // Swipe to Gone, more than halfway transitionStateFlow.value = ObservableTransitionState.Transition( fromScene = Scenes.Lockscreen, toScene = Scenes.Gone, currentScene = flowOf(Scenes.Gone), progress = flowOf(0.51f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(true), ) runCurrent() // Lift finger transitionStateFlow.value = ObservableTransitionState.Transition( fromScene = Scenes.Lockscreen, toScene = Scenes.Gone, currentScene = flowOf(Scenes.Gone), progress = flowOf(0.51f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(false), ) runCurrent() assertThat(currentScene).isEqualTo(Scenes.Gone) } @Test fun switchToGone_extendUnlock() = testScope.runTest { Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +1 −8 Original line number Diff line number Diff line Loading @@ -126,14 +126,7 @@ constructor( sceneInteractor.get().transitionState.flatMapLatestConflated { state -> when { state.isTransitioning(from = Scenes.Lockscreen, to = Scenes.Gone) -> (state as Transition).isUserInputOngoing.flatMapLatestConflated { isUserInputOngoing -> if (isUserInputOngoing) { isDeviceEntered } else { flowOf(true) } } state.isTransitioning(from = Scenes.Bouncer, to = Scenes.Gone) -> (state as Transition).progress.map { progress -> progress > Loading packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt +0 −24 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ import com.android.systemui.deviceentry.shared.model.DeviceUnlockSource import com.android.systemui.keyguard.DismissCallbackRegistry import com.android.systemui.keyguard.domain.interactor.KeyguardEnabledInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.domain.interactor.WindowManagerLockscreenVisibilityInteractor import com.android.systemui.model.SceneContainerPlugin import com.android.systemui.model.SysUiState import com.android.systemui.model.updateFlags Loading Loading @@ -97,7 +96,6 @@ import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.flow.filterNot import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map Loading Loading @@ -138,7 +136,6 @@ constructor( private val uiEventLogger: UiEventLogger, private val sceneBackInteractor: SceneBackInteractor, private val shadeSessionStorage: SessionStorage, private val windowMgrLockscreenVisInteractor: WindowManagerLockscreenVisibilityInteractor, private val keyguardEnabledInteractor: KeyguardEnabledInteractor, private val dismissCallbackRegistry: DismissCallbackRegistry, private val statusBarStateController: SysuiStatusBarStateController, Loading Loading @@ -270,27 +267,6 @@ constructor( handleDeviceUnlockStatus() handlePowerState() handleShadeTouchability() handleSurfaceBehindKeyguardVisibility() } private fun handleSurfaceBehindKeyguardVisibility() { applicationScope.launch { sceneInteractor.currentScene.collectLatest { currentScene -> if (currentScene == Scenes.Lockscreen) { // Wait for the screen to be on powerInteractor.isAwake.first { it } // Wait for surface to become visible windowMgrLockscreenVisInteractor.surfaceBehindVisibility.first { it } // Make sure the device is actually unlocked before force-changing the scene deviceUnlockedInteractor.deviceUnlockStatus.first { it.isUnlocked } // Override the current transition, if any, by forcing the scene to Gone sceneInteractor.changeScene( toScene = Scenes.Gone, loggingReason = "surface behind keyguard is visible", ) } } } } private fun handleBouncerImeVisibility() { Loading packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt +0 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import com.android.systemui.haptics.vibratorHelper import com.android.systemui.keyguard.dismissCallbackRegistry import com.android.systemui.keyguard.domain.interactor.keyguardEnabledInteractor import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.keyguard.domain.interactor.windowManagerLockscreenVisibilityInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.testScope Loading Loading @@ -78,7 +77,6 @@ val Kosmos.sceneContainerStartable by Fixture { uiEventLogger = uiEventLogger, sceneBackInteractor = sceneBackInteractor, shadeSessionStorage = shadeSessionStorage, windowMgrLockscreenVisInteractor = windowManagerLockscreenVisibilityInteractor, keyguardEnabledInteractor = keyguardEnabledInteractor, dismissCallbackRegistry = dismissCallbackRegistry, statusBarStateController = sysuiStatusBarStateController, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt +5 −42 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { @Test @EnableSceneContainer fun surfaceBehindVisibility_fromLockscreenToGone_noUserInput_trueThroughout() = fun surfaceBehindVisibility_fromLockscreenToGone_dependsOnDeviceEntry() = testScope.runTest { val isSurfaceBehindVisible by collectLastValue(underTest.value.surfaceBehindVisibility) val currentScene by collectLastValue(kosmos.sceneInteractor.currentScene) Loading @@ -208,7 +208,7 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { SuccessFingerprintAuthenticationStatus(0, true) ) // Start the transition to Gone, the surface should become immediately visible. // Start the transition to Gone, the surface should remain invisible. kosmos.setSceneTransition( ObservableTransitionState.Transition( fromScene = Scenes.Lockscreen, Loading @@ -220,9 +220,9 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { ) ) assertThat(currentScene).isEqualTo(Scenes.Lockscreen) assertThat(isSurfaceBehindVisible).isTrue() assertThat(isSurfaceBehindVisible).isFalse() // Towards the end of the transition, the surface should continue to be visible. // Towards the end of the transition, the surface should continue to remain invisible. kosmos.setSceneTransition( ObservableTransitionState.Transition( fromScene = Scenes.Lockscreen, Loading @@ -234,7 +234,7 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { ) ) assertThat(currentScene).isEqualTo(Scenes.Lockscreen) assertThat(isSurfaceBehindVisible).isTrue() assertThat(isSurfaceBehindVisible).isFalse() // After the transition, settles on Gone. Surface behind should stay visible now. kosmos.setSceneTransition(ObservableTransitionState.Idle(Scenes.Gone)) Loading @@ -243,43 +243,6 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { assertThat(isSurfaceBehindVisible).isTrue() } @Test @EnableSceneContainer fun surfaceBehindVisibility_fromLockscreenToGone_withUserInput_falseUntilInputStops() = testScope.runTest { val isSurfaceBehindVisible by collectLastValue(underTest.value.surfaceBehindVisibility) val currentScene by collectLastValue(kosmos.sceneInteractor.currentScene) // Before the transition, we start on Lockscreen so the surface should start invisible. kosmos.setSceneTransition(ObservableTransitionState.Idle(Scenes.Lockscreen)) assertThat(currentScene).isEqualTo(Scenes.Lockscreen) assertThat(isSurfaceBehindVisible).isFalse() // Unlocked with fingerprint. kosmos.deviceEntryFingerprintAuthRepository.setAuthenticationStatus( SuccessFingerprintAuthenticationStatus(0, true) ) // Start the transition to Gone, the surface should not be visible while // isUserInputOngoing is true val isUserInputOngoing = MutableStateFlow(true) kosmos.setSceneTransition( ObservableTransitionState.Transition( fromScene = Scenes.Lockscreen, toScene = Scenes.Gone, isInitiatedByUserInput = true, isUserInputOngoing = isUserInputOngoing, progress = flowOf(0.51f), currentScene = flowOf(Scenes.Gone), ) ) assertThat(isSurfaceBehindVisible).isFalse() // When isUserInputOngoing becomes false, then the surface should become visible. isUserInputOngoing.value = false assertThat(isSurfaceBehindVisible).isTrue() } @Test @EnableSceneContainer fun surfaceBehindVisibility_fromBouncerToGone_becomesTrue() = Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +0 −34 Original line number Diff line number Diff line Loading @@ -2118,40 +2118,6 @@ class SceneContainerStartableTest : SysuiTestCase() { assertThat(currentScene).isEqualTo(Scenes.Lockscreen) } @Test fun switchToGone_whenSurfaceBehindLockscreenVisibleMidTransition() = testScope.runTest { val currentScene by collectLastValue(sceneInteractor.currentScene) val transitionStateFlow = prepareState(authenticationMethod = AuthenticationMethodModel.None) underTest.start() assertThat(currentScene).isEqualTo(Scenes.Lockscreen) // Swipe to Gone, more than halfway transitionStateFlow.value = ObservableTransitionState.Transition( fromScene = Scenes.Lockscreen, toScene = Scenes.Gone, currentScene = flowOf(Scenes.Gone), progress = flowOf(0.51f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(true), ) runCurrent() // Lift finger transitionStateFlow.value = ObservableTransitionState.Transition( fromScene = Scenes.Lockscreen, toScene = Scenes.Gone, currentScene = flowOf(Scenes.Gone), progress = flowOf(0.51f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(false), ) runCurrent() assertThat(currentScene).isEqualTo(Scenes.Gone) } @Test fun switchToGone_extendUnlock() = testScope.runTest { Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +1 −8 Original line number Diff line number Diff line Loading @@ -126,14 +126,7 @@ constructor( sceneInteractor.get().transitionState.flatMapLatestConflated { state -> when { state.isTransitioning(from = Scenes.Lockscreen, to = Scenes.Gone) -> (state as Transition).isUserInputOngoing.flatMapLatestConflated { isUserInputOngoing -> if (isUserInputOngoing) { isDeviceEntered } else { flowOf(true) } } state.isTransitioning(from = Scenes.Bouncer, to = Scenes.Gone) -> (state as Transition).progress.map { progress -> progress > Loading
packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt +0 −24 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ import com.android.systemui.deviceentry.shared.model.DeviceUnlockSource import com.android.systemui.keyguard.DismissCallbackRegistry import com.android.systemui.keyguard.domain.interactor.KeyguardEnabledInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.domain.interactor.WindowManagerLockscreenVisibilityInteractor import com.android.systemui.model.SceneContainerPlugin import com.android.systemui.model.SysUiState import com.android.systemui.model.updateFlags Loading Loading @@ -97,7 +96,6 @@ import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.flow.filterNot import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map Loading Loading @@ -138,7 +136,6 @@ constructor( private val uiEventLogger: UiEventLogger, private val sceneBackInteractor: SceneBackInteractor, private val shadeSessionStorage: SessionStorage, private val windowMgrLockscreenVisInteractor: WindowManagerLockscreenVisibilityInteractor, private val keyguardEnabledInteractor: KeyguardEnabledInteractor, private val dismissCallbackRegistry: DismissCallbackRegistry, private val statusBarStateController: SysuiStatusBarStateController, Loading Loading @@ -270,27 +267,6 @@ constructor( handleDeviceUnlockStatus() handlePowerState() handleShadeTouchability() handleSurfaceBehindKeyguardVisibility() } private fun handleSurfaceBehindKeyguardVisibility() { applicationScope.launch { sceneInteractor.currentScene.collectLatest { currentScene -> if (currentScene == Scenes.Lockscreen) { // Wait for the screen to be on powerInteractor.isAwake.first { it } // Wait for surface to become visible windowMgrLockscreenVisInteractor.surfaceBehindVisibility.first { it } // Make sure the device is actually unlocked before force-changing the scene deviceUnlockedInteractor.deviceUnlockStatus.first { it.isUnlocked } // Override the current transition, if any, by forcing the scene to Gone sceneInteractor.changeScene( toScene = Scenes.Gone, loggingReason = "surface behind keyguard is visible", ) } } } } private fun handleBouncerImeVisibility() { Loading
packages/SystemUI/tests/utils/src/com/android/systemui/scene/domain/startable/SceneContainerStartableKosmos.kt +0 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import com.android.systemui.haptics.vibratorHelper import com.android.systemui.keyguard.dismissCallbackRegistry import com.android.systemui.keyguard.domain.interactor.keyguardEnabledInteractor import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.keyguard.domain.interactor.windowManagerLockscreenVisibilityInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.testScope Loading Loading @@ -78,7 +77,6 @@ val Kosmos.sceneContainerStartable by Fixture { uiEventLogger = uiEventLogger, sceneBackInteractor = sceneBackInteractor, shadeSessionStorage = shadeSessionStorage, windowMgrLockscreenVisInteractor = windowManagerLockscreenVisibilityInteractor, keyguardEnabledInteractor = keyguardEnabledInteractor, dismissCallbackRegistry = dismissCallbackRegistry, statusBarStateController = sysuiStatusBarStateController, Loading