Merge "From dream, FP auth brings you to the last app" into main
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 f6ad829..6382338 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 @@
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 4736545..1c7073c 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 @@
}
@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 @@
powerRepository.setInteractive(true)
keyguardRepository.setKeyguardOccluded(isOnOccludingApp)
keyguardRepository.setKeyguardShowing(isOnOccludingApp)
+ keyguardRepository.setDreaming(false)
bouncerRepository.setPrimaryShow(!isOnOccludingApp)
bouncerRepository.setAlternateVisible(!isOnOccludingApp)
}