diff options
2 files changed, 24 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/OccludingAppDeviceEntryInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/OccludingAppDeviceEntryInteractor.kt index f6ad8290d034..63823385dc21 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/OccludingAppDeviceEntryInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/OccludingAppDeviceEntryInteractor.kt @@ -91,13 +91,18 @@ constructor( init { scope.launch { - // On fingerprint success when the screen is on, go to the home screen - fingerprintUnlockSuccessEvents.sample(powerInteractor.isInteractive).collect { - if (it) { - goToHomeScreen() + // On fingerprint success when the screen is on and not dreaming, go to the home screen + fingerprintUnlockSuccessEvents + .sample( + combine(powerInteractor.isInteractive, keyguardInteractor.isDreaming, ::Pair), + ) + .collect { (interactive, dreaming) -> + if (interactive && !dreaming) { + goToHomeScreen() + } + // don't go to the home screen if the authentication is from + // AOD/dozing/off/dreaming } - // don't go to the home screen if the authentication is from AOD/dozing/off - } } scope.launch { diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/OccludingAppDeviceEntryInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/OccludingAppDeviceEntryInteractorTest.kt index 47365457d9e4..1c7073c5f79b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/OccludingAppDeviceEntryInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/OccludingAppDeviceEntryInteractorTest.kt @@ -181,6 +181,18 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() { } @Test + fun fingerprintSuccess_dreaming_doesNotGoToHomeScreen() = + testScope.runTest { + givenOnOccludingApp(true) + keyguardRepository.setDreaming(true) + fingerprintAuthRepository.setAuthenticationStatus( + SuccessFingerprintAuthenticationStatus(0, true) + ) + runCurrent() + verifyNeverGoToHomeScreen() + } + + @Test fun fingerprintSuccess_notOnOccludingApp_doesNotGoToHomeScreen() = testScope.runTest { givenOnOccludingApp(false) @@ -315,6 +327,7 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() { powerRepository.setInteractive(true) keyguardRepository.setKeyguardOccluded(isOnOccludingApp) keyguardRepository.setKeyguardShowing(isOnOccludingApp) + keyguardRepository.setDreaming(false) bouncerRepository.setPrimaryShow(!isOnOccludingApp) bouncerRepository.setAlternateVisible(!isOnOccludingApp) } |