summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Shawn Lin <shawnlin@google.com> 2024-05-07 01:22:40 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-05-07 01:22:40 +0000
commit3e51ebc59c5723ab24fbbc74f00d3f87ffce97e9 (patch)
tree81545d04d48cd63e1df8088704312dbc07ceb185
parentea2fd638e7e87e024e4a8978029e5ac091d0ed33 (diff)
parentb51b01417bbfa251036fbf01577246e2a9f7f4ad (diff)
Merge "Fix the ring animation not showing while unfolding device" into 24D1-dev
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepositoryTest.kt19
-rw-r--r--packages/SystemUI/src/com/android/systemui/deviceentry/data/repository/DeviceEntryFaceAuthRepository.kt5
2 files changed, 23 insertions, 1 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 44e312d20142..ddde6815a7d4 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
@@ -1070,6 +1070,25 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
faceAuthenticateIsCalled()
}
+ @Test
+ fun retryFaceAuthAfterCancel() =
+ testScope.runTest {
+ initCollectors()
+ allPreconditionsToRunFaceAuthAreTrue()
+ val isAuthRunning by collectLastValue(underTest.isAuthRunning)
+
+ underTest.requestAuthenticate(FaceAuthUiEvent.FACE_AUTH_CAMERA_AVAILABLE_CHANGED)
+ underTest.cancel()
+ clearInvocations(faceManager)
+ underTest.requestAuthenticate(FaceAuthUiEvent.FACE_AUTH_CAMERA_AVAILABLE_CHANGED)
+
+ advanceTimeBy(DeviceEntryFaceAuthRepositoryImpl.DEFAULT_CANCEL_SIGNAL_TIMEOUT)
+ runCurrent()
+
+ assertThat(isAuthRunning).isEqualTo(true)
+ faceAuthenticateIsCalled()
+ }
+
private suspend fun TestScope.testGatingCheckForFaceAuth(
gatingCheckModifier: suspend () -> Unit
) {
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 8a25e4106751..52027db893b5 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
@@ -517,9 +517,12 @@ constructor(
private fun onFaceAuthRequestCompleted() {
cancelNotReceivedHandlerJob?.cancel()
- cancellationInProgress.value = false
_isAuthRunning.value = false
authCancellationSignal = null
+ // Updates to "cancellationInProgress" may re-trigger face auth
+ // (see processPendingAuthRequests()), so we must update this after setting _isAuthRunning
+ // to false.
+ cancellationInProgress.value = false
}
private val detectionCallback =