From 0e500d92a81ad124ac3f6e11fcc6d86a00b3f7c4 Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 2 Oct 2023 16:21:31 +0000 Subject: From dream, FP auth brings you to the last app Instead of dismissing the activity and bringing the user to the home screen/launcher. Test: atest OccludingAppDeviceEntryInteractorTest Test: use an app and then wait for timeout to dream. When authenticating with SFPS from the dream, the last app shows after authentication Bug: 302196044 Change-Id: I404b2bcaea4e88c9e217c2565af9cd55770dc88c --- .../interactor/OccludingAppDeviceEntryInteractor.kt | 17 +++++++++++------ .../interactor/OccludingAppDeviceEntryInteractorTest.kt | 13 +++++++++++++ 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 @@ -180,6 +180,18 @@ class OccludingAppDeviceEntryInteractorTest : SysuiTestCase() { verifyNeverGoToHomeScreen() } + @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 { @@ -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) } -- cgit v1.2.3-59-g8ed1b