summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt68
-rw-r--r--packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractor.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/NoopDeviceEntryFaceAuthInteractor.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/deviceentry/domain/interactor/SystemUIDeviceEntryFaceAuthInteractor.kt8
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/deviceentry/domain/interactor/DeviceEntryFaceAuthInteractorTest.kt30
7 files changed, 78 insertions, 40 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..3b5d5a8f0598 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,8 +250,8 @@ constructor(
runFaceAuth(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_NOTIFICATION_PANEL_CLICKED, true)
}
- override fun onQsExpansionStarted() {
- runFaceAuth(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, true)
+ override fun onShadeExpansionStarted() {
+ runFaceAuth(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, false)
}
override fun onDeviceLifted() {
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..40b2a0864a8c 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,33 +362,33 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() {
}
@Test
- fun faceAuthIsRequestedWhenQsExpansionStared() =
+ fun faceAuthIsRequestedWhenShadeExpansionStarted() =
testScope.runTest {
underTest.start()
- underTest.onQsExpansionStarted()
+ underTest.onShadeExpansionStarted()
runCurrent()
assertThat(faceAuthRepository.runningAuthRequest.value)
- .isEqualTo(Pair(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, true))
+ .isEqualTo(Pair(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, false))
}
@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),
@@ -398,25 +398,25 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() {
runCurrent()
assertThat(faceAuthRepository.runningAuthRequest.value)
- .isEqualTo(Pair(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, true))
+ .isEqualTo(Pair(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, false))
}
@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),
@@ -426,16 +426,16 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() {
runCurrent()
assertThat(faceAuthRepository.runningAuthRequest.value)
- .isEqualTo(Pair(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, true))
+ .isEqualTo(Pair(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_QS_EXPANDED, false))
faceAuthRepository.runningAuthRequest.value = null
// expansion progress shouldn't trigger face auth again
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),