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

Commit f0f2d243 authored by Steven Ross's avatar Steven Ross Committed by Android (Google) Code Review
Browse files

Merge "Display max retry lockout message on backup lock fixes 5462647"

parents 44ddd1ff b9430d2a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/strings.xml
**
@@ -1787,6 +1787,8 @@
    <string name="lockscreen_pattern_wrong">Try again</string>
    <!-- On the unlock password screen, shown when the user enters the wrong lock password and must try again. -->
    <string name="lockscreen_password_wrong">Try again</string>
    <!-- Shown when face unlock failed multiple times so we're just using the backup -->
    <string name="faceunlock_multiple_failures">Maximum Face Unlock attempts exceeded</string>

    <!-- When the lock screen is showing and the phone plugged in, and the battery
         is not fully charged, show the current charge %.  -->
+4 −0
Original line number Diff line number Diff line
@@ -293,6 +293,10 @@ class KeyguardStatusViewManager implements OnClickListener {
        mUpdateMonitor.registerInfoCallback(mInfoCallback);
        mUpdateMonitor.registerSimStateCallback(mSimStateCallback);
        resetStatusInfo();
        //Issue the faceunlock failure message in a centralized place
        if (mUpdateMonitor.getMaxFaceUnlockAttemptsReached()) {
            setInstructionText(getContext().getString(R.string.faceunlock_multiple_failures));
        }
    }

    void resetStatusInfo() {
+11 −0
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ public class KeyguardUpdateMonitor {
    private CharSequence mTelephonySpn;

    private int mFailedAttempts = 0;
    private int mFailedFaceUnlockAttempts = 0;
    private static final int FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 15;

    private boolean mClockVisible;

@@ -630,6 +632,7 @@ public class KeyguardUpdateMonitor {

    public void clearFailedAttempts() {
        mFailedAttempts = 0;
        mFailedFaceUnlockAttempts = 0;
    }

    public void reportFailedAttempt() {
@@ -643,4 +646,12 @@ public class KeyguardUpdateMonitor {
    public int getPhoneState() {
        return mPhoneState;
    }

    public void reportFailedFaceUnlockAttempt() {
        mFailedFaceUnlockAttempts++;
    }

    public boolean getMaxFaceUnlockAttemptsReached() {
        return mFailedFaceUnlockAttempts >= FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP;
    }
}
+2 −8
Original line number Diff line number Diff line
@@ -132,10 +132,6 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
    // So the user has a consistent amount of time when brought to the backup method from FaceLock
    private final int BACKUP_LOCK_TIMEOUT = 5000;

    // Needed to keep track of failed FaceUnlock attempts
    private int mFailedFaceUnlockAttempts = 0;
    private static final int FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 15;

    /**
     * The current {@link KeyguardScreen} will use this to communicate back to us.
     */
@@ -464,7 +460,6 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
            }

            public void reportSuccessfulUnlockAttempt() {
                mFailedFaceUnlockAttempts = 0;
                mLockPatternUtils.reportSuccessfulPasswordAttempt();
            }
        };
@@ -583,8 +578,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
     *  FaceLock, but only if we're not dealing with a call
    */
    private void activateFaceLockIfAble() {
        final boolean tooManyFaceUnlockTries =
                (mFailedFaceUnlockAttempts >= FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP);
        final boolean tooManyFaceUnlockTries = mUpdateMonitor.getMaxFaceUnlockAttemptsReached();
        final int failedBackupAttempts = mUpdateMonitor.getFailedAttempts();
        final boolean backupIsTimedOut =
                (failedBackupAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT);
@@ -1398,7 +1392,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
        @Override
        public void reportFailedAttempt() {
            if (DEBUG) Log.d(TAG, "FaceLock reportFailedAttempt()");
            mFailedFaceUnlockAttempts++;
            mUpdateMonitor.reportFailedFaceUnlockAttempt();
            hideFaceLockArea(); // Expose fallback
            stopFaceLock();
            mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT);