diff options
| author | 2023-08-23 00:10:50 +0000 | |
|---|---|---|
| committer | 2023-08-23 00:10:50 +0000 | |
| commit | e82df7fd52575a6eb902339cc99bd4f64a326a0c (patch) | |
| tree | aa2fd0629849c397c2ecdf7a4d13075cdb696f3f | |
| parent | e451fd2ba0e024a0d914493dd3021216c5f3b989 (diff) | |
| parent | 754805fe0eb91c0f52a984c9af69238d57e31052 (diff) | |
Merge "Clear icon after temporary error" into udc-qpr-dev
2 files changed, 10 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt index 4dc7720ef447..e8b8f54220aa 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModel.kt @@ -289,7 +289,7 @@ constructor( if (authenticateAfterError) { showAuthenticating(messageAfterError) } else { - showHelp(messageAfterError) + showInfo(messageAfterError) } } } @@ -309,12 +309,15 @@ constructor( private fun supportsRetry(failedModality: BiometricModality) = failedModality == BiometricModality.Face + suspend fun showHelp(message: String) = showHelp(message, clearIconError = false) + suspend fun showInfo(message: String) = showHelp(message, clearIconError = true) + /** * Show a persistent help message. * * Will be show even if the user has already authenticated. */ - suspend fun showHelp(message: String) { + private suspend fun showHelp(message: String, clearIconError: Boolean) { val alreadyAuthenticated = _isAuthenticated.value.isAuthenticated if (!alreadyAuthenticated) { _isAuthenticating.value = false @@ -329,6 +332,8 @@ constructor( AuthBiometricView.STATE_PENDING_CONFIRMATION } else if (alreadyAuthenticated && !isConfirmationRequired.first()) { AuthBiometricView.STATE_AUTHENTICATED + } else if (clearIconError) { + AuthBiometricView.STATE_IDLE } else { AuthBiometricView.STATE_HELP } diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt index 11b0b0798ebc..47084c087952 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/ui/viewmodel/PromptViewModelTest.kt @@ -312,10 +312,13 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa assertThat(message).isEqualTo(PromptMessage.Empty) assertThat(messageVisible).isFalse() } + val clearIconError = !restart assertThat(legacyState) .isEqualTo( if (restart) { AuthBiometricView.STATE_AUTHENTICATING + } else if (clearIconError) { + AuthBiometricView.STATE_IDLE } else { AuthBiometricView.STATE_HELP } |