diff options
| author | 2024-04-19 19:30:05 +0000 | |
|---|---|---|
| committer | 2024-04-19 19:30:05 +0000 | |
| commit | 07fc72c03a66f4ec261fab038b13b820c7e875bf (patch) | |
| tree | 1368c6c432a52d2f84094a45e6107feb4bb39fee | |
| parent | 3f2b85b5fde89c8e66e0cf6246403b00c5993771 (diff) | |
| parent | 5f2d6d50f851583c0c1411c4e51693fab7265cd1 (diff) | |
Merge "Attempt to show altBouncer before showing primary bouncer" into main
3 files changed, 72 insertions, 4 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt index 37a6ac6adac7..af48802e969f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorTest.kt @@ -25,6 +25,9 @@ import com.android.systemui.authentication.data.repository.FakeAuthenticationRep import com.android.systemui.authentication.data.repository.fakeAuthenticationRepository import com.android.systemui.authentication.domain.interactor.authenticationInteractor import com.android.systemui.authentication.shared.model.AuthenticationMethodModel +import com.android.systemui.biometrics.data.repository.fakeFingerprintPropertyRepository +import com.android.systemui.bouncer.data.repository.keyguardBouncerRepository +import com.android.systemui.bouncer.domain.interactor.alternateBouncerInteractor import com.android.systemui.coroutines.collectLastValue import com.android.systemui.coroutines.collectValues import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository @@ -40,11 +43,16 @@ import com.android.systemui.deviceentry.shared.model.DeviceEntryRestrictionReaso import com.android.systemui.deviceentry.shared.model.DeviceEntryRestrictionReason.UserLockdown import com.android.systemui.flags.EnableSceneContainer import com.android.systemui.flags.fakeSystemPropertiesHelper +import com.android.systemui.keyguard.data.repository.biometricSettingsRepository +import com.android.systemui.keyguard.data.repository.deviceEntryFingerprintAuthRepository import com.android.systemui.keyguard.data.repository.fakeBiometricSettingsRepository import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFaceAuthRepository 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.data.repository.fakeTrustRepository import com.android.systemui.keyguard.shared.model.AuthenticationFlags +import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.SuccessFingerprintAuthenticationStatus import com.android.systemui.kosmos.testScope import com.android.systemui.scene.domain.interactor.sceneInteractor @@ -371,6 +379,42 @@ class DeviceEntryInteractorTest : SysuiTestCase() { } @Test + fun showOrUnlockDevice_noAlternateBouncer_switchesToBouncerScene() = + testScope.runTest { + val currentScene by collectLastValue(sceneInteractor.currentScene) + switchToScene(Scenes.Lockscreen) + assertThat(currentScene).isEqualTo(Scenes.Lockscreen) + + kosmos.fakeFingerprintPropertyRepository.supportsRearFps() // altBouncer unsupported + kosmos.fakeAuthenticationRepository.setAuthenticationMethod( + AuthenticationMethodModel.Pin + ) + runCurrent() + + underTest.attemptDeviceEntry() + + assertThat(currentScene).isEqualTo(Scenes.Bouncer) + } + + @Test + fun showOrUnlockDevice_showsAlternateBouncer_staysOnLockscreenScene() = + testScope.runTest { + val currentScene by collectLastValue(sceneInteractor.currentScene) + switchToScene(Scenes.Lockscreen) + assertThat(currentScene).isEqualTo(Scenes.Lockscreen) + + kosmos.fakeAuthenticationRepository.setAuthenticationMethod( + AuthenticationMethodModel.Pin + ) + givenCanShowAlternateBouncer() + runCurrent() + + underTest.attemptDeviceEntry() + + assertThat(currentScene).isEqualTo(Scenes.Lockscreen) + } + + @Test fun isBypassEnabled_disabledInRepository_false() = testScope.runTest { kosmos.fakeDeviceEntryRepository.setBypassEnabled(false) @@ -593,4 +637,20 @@ class DeviceEntryInteractorTest : SysuiTestCase() { private fun switchToScene(sceneKey: SceneKey) { sceneInteractor.changeScene(sceneKey, "reason") } + + private suspend fun givenCanShowAlternateBouncer() { + val canShowAlternateBouncer by + testScope.collectLastValue(kosmos.alternateBouncerInteractor.canShowAlternateBouncer) + kosmos.fakeFingerprintPropertyRepository.supportsUdfps() + kosmos.fakeKeyguardTransitionRepository.sendTransitionSteps( + from = KeyguardState.GONE, + to = KeyguardState.LOCKSCREEN, + testScheduler = testScope.testScheduler, + ) + kosmos.deviceEntryFingerprintAuthRepository.setLockedOut(false) + kosmos.biometricSettingsRepository.setIsFingerprintAuthCurrentlyAllowed(true) + kosmos.fakeKeyguardRepository.setKeyguardDismissible(false) + kosmos.keyguardBouncerRepository.setPrimaryShow(false) + assertThat(canShowAlternateBouncer).isTrue() + } } diff --git a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt index 5c1ca646529e..662974dd2c91 100644 --- a/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractor.kt @@ -19,6 +19,7 @@ package com.android.systemui.deviceentry.domain.interactor import androidx.annotation.VisibleForTesting import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor import com.android.systemui.authentication.shared.model.AuthenticationMethodModel +import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.deviceentry.data.repository.DeviceEntryRepository @@ -63,6 +64,7 @@ constructor( private val trustInteractor: TrustInteractor, private val deviceUnlockedInteractor: DeviceUnlockedInteractor, private val systemPropertiesHelper: SystemPropertiesHelper, + private val alternateBouncerInteractor: AlternateBouncerInteractor, ) { /** * Whether the device is unlocked. @@ -211,10 +213,14 @@ constructor( // 4. Transition to bouncer scene applicationScope.launch { if (isAuthenticationRequired()) { - sceneInteractor.changeScene( - toScene = Scenes.Bouncer, - loggingReason = "request to unlock device while authentication required", - ) + if (alternateBouncerInteractor.canShowAlternateBouncer.value) { + alternateBouncerInteractor.forceShow() + } else { + sceneInteractor.changeScene( + toScene = Scenes.Bouncer, + loggingReason = "request to unlock device while authentication required", + ) + } } else { sceneInteractor.changeScene( toScene = Scenes.Gone, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorKosmos.kt index bff10a191d5a..120086686282 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryInteractorKosmos.kt @@ -17,6 +17,7 @@ package com.android.systemui.deviceentry.domain.interactor import com.android.systemui.authentication.domain.interactor.authenticationInteractor +import com.android.systemui.bouncer.domain.interactor.alternateBouncerInteractor import com.android.systemui.deviceentry.data.repository.deviceEntryRepository import com.android.systemui.flags.fakeSystemPropertiesHelper import com.android.systemui.keyguard.domain.interactor.trustInteractor @@ -39,5 +40,6 @@ val Kosmos.deviceEntryInteractor by trustInteractor = trustInteractor, deviceUnlockedInteractor = deviceUnlockedInteractor, systemPropertiesHelper = fakeSystemPropertiesHelper, + alternateBouncerInteractor = alternateBouncerInteractor, ) } |