Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 754805fe authored by Grace Cheng's avatar Grace Cheng
Browse files

Clear icon after temporary error

Visually clear iconView in BiometricPrompt after showing temporary error

Fixes: 287465344
Test: atest PromptViewModelTest
Change-Id: Ia651f68d8a2c1898164727f2cedf3f0e9dfc4661
parent 4d1c1d41
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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
            }
+3 −0
Original line number Diff line number Diff line
@@ -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
                }