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

Commit e54ad1d0 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Always show error messages on bouncer

The padlock icon and error field should always show
the error message, otherwise the user may end up on the
bouncer waiting for auth that already failed.

Fixes: 129802603
Test: manually swipe up and down
Change-Id: I0dcdd7ffda7684b8e1fded9eae0c85d9e113387a
parent a29d4340
Loading
Loading
Loading
Loading
+10 −24
Original line number Diff line number Diff line
@@ -539,7 +539,6 @@ public class KeyguardIndicationController implements StateListener {

    protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback {
        public static final int HIDE_DELAY_MS = 5000;
        private int mLastSuccessiveErrorMessage = -1;

        @Override
        public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) {
@@ -577,20 +576,14 @@ public class KeyguardIndicationController implements StateListener {
            if (!updateMonitor.isUnlockingWithBiometricAllowed()) {
                return;
            }
            animatePadlockError();
            if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
                mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
                        mInitialTextColorState);
            } else if (updateMonitor.isScreenOn()) {
                mLockIcon.setTransientBiometricsError(true);
                showTransientIndication(helpString);
                hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
                mHandler.removeMessages(MSG_CLEAR_BIOMETRIC_MSG);
                mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEAR_BIOMETRIC_MSG),
                        TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
            }
            // Help messages indicate that there was actually a try since the last error, so those
            // are not two successive error messages anymore.
            mLastSuccessiveErrorMessage = -1;
        }

        @Override
@@ -600,15 +593,9 @@ public class KeyguardIndicationController implements StateListener {
            if (shouldSuppressBiometricError(msgId, biometricSourceType, updateMonitor)) {
                return;
            }
            animatePadlockError();
            if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
                // When swiping up right after receiving a biometric error, the bouncer calls
                // authenticate leading to the same message being shown again on the bouncer.
                // We want to avoid this, as it may confuse the user when the message is too
                // generic.
                if (mLastSuccessiveErrorMessage != msgId) {
                    mStatusBarKeyguardViewManager.showBouncerMessage(errString,
                            mInitialTextColorState);
                }
                mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState);
            } else if (updateMonitor.isScreenOn()) {
                showTransientIndication(errString);
                // We want to keep this message around in case the screen was off
@@ -616,7 +603,13 @@ public class KeyguardIndicationController implements StateListener {
            } else {
                mMessageToShowOnScreenOn = errString;
            }
            mLastSuccessiveErrorMessage = msgId;
        }

        private void animatePadlockError() {
            mLockIcon.setTransientBiometricsError(true);
            mHandler.removeMessages(MSG_CLEAR_BIOMETRIC_MSG);
            mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEAR_BIOMETRIC_MSG),
                    TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
        }

        private boolean shouldSuppressBiometricError(int msgId,
@@ -670,16 +663,9 @@ public class KeyguardIndicationController implements StateListener {
        @Override
        public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType) {
            super.onBiometricAuthenticated(userId, biometricSourceType);
            mLastSuccessiveErrorMessage = -1;
            mHandler.sendEmptyMessage(MSG_HIDE_TRANSIENT);
        }

        @Override
        public void onBiometricAuthFailed(BiometricSourceType biometricSourceType) {
            super.onBiometricAuthFailed(biometricSourceType);
            mLastSuccessiveErrorMessage = -1;
        }

        @Override
        public void onUserUnlocked() {
            if (mVisible) {