diff options
| author | 2024-08-30 10:24:44 -0700 | |
|---|---|---|
| committer | 2024-08-30 15:52:07 -0700 | |
| commit | 0710dfd7d8a4ff561dff8db2a8d582da04308d30 (patch) | |
| tree | 0550dbb34f62ce0f3a5953e67f871ace104526e5 | |
| parent | eeb126374925a7c98a5552371c6e44f533bae13e (diff) | |
Change face auth trigger to LockScreen -> Shade transition
It was incorrectly set to QuickSettings -> Shade in the previous CL
Other changes:
Address unresolved comment from previous CL ag/28949039 (transition to GONE instead of UNDEFINED)
Bug: 361673279
Test: atest DeviceEntryFaceAuthInteractorTest
Test: manually,
1. enroll face auth
2. start pulling down the shade
4. face auth should run without affecting the shade expansion
Flag: com.android.systemui.scene_container
Change-Id: I17eed5065fa6f7f2d24b2b18a4dd60b70c682a35
7 files changed, 74 insertions, 36 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt index 3e75cebb1c7d..d4a76910c46a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt @@ -96,6 +96,7 @@ import java.io.PrintWriter import java.io.StringWriter import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceTimeBy import kotlinx.coroutines.test.runCurrent @@ -561,14 +562,29 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() { fun withSceneContainerEnabled_authenticateDoesNotRunWhenKeyguardIsGoingAway() = testScope.runTest { testGatingCheckForFaceAuth(sceneContainerEnabled = true) { - keyguardTransitionRepository.sendTransitionStep( - TransitionStep( - KeyguardState.LOCKSCREEN, - KeyguardState.UNDEFINED, - value = 0.5f, - transitionState = TransitionState.RUNNING - ), - validateStep = false + kosmos.sceneInteractor.setTransitionState( + MutableStateFlow( + ObservableTransitionState.Transition( + fromScene = Scenes.Bouncer, + toScene = Scenes.Gone, + currentScene = flowOf(Scenes.Bouncer), + progress = MutableStateFlow(0.2f), + isInitiatedByUserInput = true, + isUserInputOngoing = flowOf(false), + ) + ) + ) + runCurrent() + } + } + + @Test + @EnableSceneContainer + fun withSceneContainerEnabled_authenticateDoesNotRunWhenLockscreenIsGone() = + testScope.runTest { + testGatingCheckForFaceAuth(sceneContainerEnabled = true) { + kosmos.sceneInteractor.setTransitionState( + MutableStateFlow(ObservableTransitionState.Idle(Scenes.Gone)) ) runCurrent() } @@ -898,15 +914,32 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() { fun withSceneContainer_faceDetectDoesNotRunWhenKeyguardGoingAway() = testScope.runTest { testGatingCheckForDetect(sceneContainerEnabled = true) { - keyguardTransitionRepository.sendTransitionStep( - TransitionStep( - KeyguardState.LOCKSCREEN, - KeyguardState.UNDEFINED, - value = 0.5f, - transitionState = TransitionState.RUNNING - ), - validateStep = false + kosmos.sceneInteractor.setTransitionState( + MutableStateFlow( + ObservableTransitionState.Transition( + fromScene = Scenes.Bouncer, + toScene = Scenes.Gone, + currentScene = flowOf(Scenes.Bouncer), + progress = MutableStateFlow(0.2f), + isInitiatedByUserInput = true, + isUserInputOngoing = flowOf(false), + ) + ) + ) + + runCurrent() + } + } + + @Test + @EnableSceneContainer + fun withSceneContainer_faceDetectDoesNotRunWhenLockscreenIsGone() = + testScope.runTest { + testGatingCheckForDetect(sceneContainerEnabled = true) { + kosmos.sceneInteractor.setTransitionState( + MutableStateFlow(ObservableTransitionState.Idle(Scenes.Gone)) ) + runCurrent() } } @@ -1231,6 +1264,9 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() { TransitionStep(KeyguardState.OFF, KeyguardState.LOCKSCREEN, value = 1.0f), validateStep = false ) + kosmos.sceneInteractor.setTransitionState( + MutableStateFlow(ObservableTransitionState.Idle(Scenes.Lockscreen)) + ) } else { keyguardRepository.setKeyguardGoingAway(false) } diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt index d288ccee2ae8..37c6e17de148 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt @@ -391,8 +391,10 @@ constructor( ), Pair( if (SceneContainerFlag.isEnabled) { - keyguardTransitionInteractor - .isInTransitionWhere(toStatePredicate = { it == KeyguardState.UNDEFINED }) + sceneInteractor + .get() + .transitionState + .map { it.isTransitioning(to = Scenes.Gone) || it.isIdle(Scenes.Gone) } .isFalse() } else { keyguardRepository.isKeyguardGoingAway.isFalse() diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractor.kt index f5914104d87f..cdd2b054711e 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractor.kt @@ -65,7 +65,7 @@ interface DeviceEntryFaceAuthInteractor : CoreStartable { fun onDeviceLifted() - fun onQsExpansionStarted() + fun onShadeExpansionStarted() fun onNotificationPanelClicked() diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/NoopDeviceEntryFaceAuthInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/NoopDeviceEntryFaceAuthInteractor.kt index b7d2a57d9a41..9b8c2b1acc33 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/NoopDeviceEntryFaceAuthInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/NoopDeviceEntryFaceAuthInteractor.kt @@ -60,7 +60,7 @@ class NoopDeviceEntryFaceAuthInteractor @Inject constructor() : DeviceEntryFaceA override fun onDeviceLifted() {} - override fun onQsExpansionStarted() {} + override fun onShadeExpansionStarted() {} override fun onNotificationPanelClicked() {} diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/SystemUIDeviceEntryFaceAuthInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/SystemUIDeviceEntryFaceAuthInteractor.kt index 5ef63d9b856c..eccae9b576c7 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/SystemUIDeviceEntryFaceAuthInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/SystemUIDeviceEntryFaceAuthInteractor.kt @@ -220,9 +220,9 @@ constructor( sceneInteractor .get() .transitionState - .filter { it.isTransitioning(from = Scenes.QuickSettings, to = Scenes.Shade) } + .filter { it.isTransitioning(from = Scenes.Lockscreen, to = Scenes.Shade) } .distinctUntilChanged() - .onEach { onQsExpansionStarted() } + .onEach { onShadeExpansionStarted() } .launchIn(applicationScope) } } @@ -250,7 +250,7 @@ constructor( runFaceAuth(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_NOTIFICATION_PANEL_CLICKED, true) } - override fun onQsExpansionStarted() { + override fun onShadeExpansionStarted() { runFaceAuth(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, true) } diff --git a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java index 34c0cb7c7a31..f1d9764abab3 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java @@ -1005,7 +1005,7 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum // When expanding QS, let's authenticate the user if possible, // this will speed up notification actions. if (height == 0 && !mKeyguardStateController.canDismissLockScreen()) { - mDeviceEntryFaceAuthInteractor.onQsExpansionStarted(); + mDeviceEntryFaceAuthInteractor.onShadeExpansionStarted(); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractorTest.kt index 4883d1bb9400..67c661b62c3e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractorTest.kt @@ -362,11 +362,11 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() { } @Test - fun faceAuthIsRequestedWhenQsExpansionStared() = + fun faceAuthIsRequestedWhenShadeExpansionStarted() = testScope.runTest { underTest.start() - underTest.onQsExpansionStarted() + underTest.onShadeExpansionStarted() runCurrent() assertThat(faceAuthRepository.runningAuthRequest.value) @@ -375,20 +375,20 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() { @Test @EnableSceneContainer - fun faceAuthIsRequestedWhenQuickSettingsIsExpandedToTheShade() = + fun faceAuthIsRequestedWhenShadeExpansionIsStarted() = testScope.runTest { underTest.start() faceAuthRepository.canRunFaceAuth.value = true - kosmos.sceneInteractor.snapToScene(toScene = Scenes.QuickSettings, "for-test") + kosmos.sceneInteractor.snapToScene(toScene = Scenes.Lockscreen, "for-test") runCurrent() kosmos.sceneInteractor.changeScene(toScene = Scenes.Shade, loggingReason = "for-test") kosmos.sceneInteractor.setTransitionState( MutableStateFlow( ObservableTransitionState.Transition( - fromScene = Scenes.QuickSettings, + fromScene = Scenes.Lockscreen, toScene = Scenes.Shade, - currentScene = flowOf(Scenes.QuickSettings), + currentScene = flowOf(Scenes.Lockscreen), progress = MutableStateFlow(0.2f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(false), @@ -403,20 +403,20 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() { @Test @EnableSceneContainer - fun faceAuthIsRequestedOnlyOnceWhenQuickSettingsIsExpandedToTheShade() = + fun faceAuthIsRequestedOnlyOnceWhenShadeExpansionStarts() = testScope.runTest { underTest.start() faceAuthRepository.canRunFaceAuth.value = true - kosmos.sceneInteractor.snapToScene(toScene = Scenes.QuickSettings, "for-test") + kosmos.sceneInteractor.snapToScene(toScene = Scenes.Lockscreen, "for-test") runCurrent() kosmos.sceneInteractor.changeScene(toScene = Scenes.Shade, loggingReason = "for-test") kosmos.sceneInteractor.setTransitionState( MutableStateFlow( ObservableTransitionState.Transition( - fromScene = Scenes.QuickSettings, + fromScene = Scenes.Lockscreen, toScene = Scenes.Shade, - currentScene = flowOf(Scenes.QuickSettings), + currentScene = flowOf(Scenes.Lockscreen), progress = MutableStateFlow(0.2f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(false), @@ -433,9 +433,9 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() { kosmos.sceneInteractor.setTransitionState( MutableStateFlow( ObservableTransitionState.Transition( - fromScene = Scenes.QuickSettings, + fromScene = Scenes.Lockscreen, toScene = Scenes.Shade, - currentScene = flowOf(Scenes.QuickSettings), + currentScene = flowOf(Scenes.Lockscreen), progress = MutableStateFlow(0.5f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(false), |