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

Commit ae8bfb06 authored by Danesh M's avatar Danesh M Committed by Danesh Mondegarian
Browse files

Quick unlock : Fix bug

There is an issue where users whose passwords are greater than 8 chars and
have quick unlock enabled will be unable to unlock their lockscreen.
This is due to the logic evaluating anything beyond 3chars as a password attempt.

This change modifies the quick unlock behavior so that when typing the password,
each character is considered an attempt, however if incorrect, is not reported as a failed attempt.
Only when the user presses enter is it considered an "explicit" attempt and a failed attempt is reported.

Patchset 2 : Rename runnable to better reflect its purpose
Patchset 3 : Switch to new behavior
Patchset 4 : Fix padding

Change-Id: Ida6289c77f6724cb42e8d3b82593f29afe3d6d1b
parent df259ec5
Loading
Loading
Loading
Loading
+2 −12
Original line number Original line Diff line number Diff line
@@ -35,18 +35,15 @@ import android.text.InputType;
import android.text.TextWatcher;
import android.text.TextWatcher;
import android.text.method.DigitsKeyListener;
import android.text.method.DigitsKeyListener;
import android.text.method.TextKeyListener;
import android.text.method.TextKeyListener;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import android.view.inputmethod.InputMethodSubtype;
import android.widget.EditText;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout;
import android.widget.Space;
import android.widget.TextView;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import android.widget.TextView.OnEditorActionListener;


@@ -184,17 +181,10 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
                }
                }
                if (mQuickUnlock) {
                if (mQuickUnlock) {
                    String entry = mPasswordEntry.getText().toString();
                    String entry = mPasswordEntry.getText().toString();
                    if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT) {
                    if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT &&
                        if (mLockPatternUtils.checkPassword(entry)) {
                            mLockPatternUtils.checkPassword(entry)) {
                            mCallback.keyguardDone(true);
                            mCallback.keyguardDone(true);
                            mCallback.reportSuccessfulUnlockAttempt();
                            mCallback.reportSuccessfulUnlockAttempt();
                        } else {
                            mCallback.reportFailedUnlockAttempt();
                            if (0 == (mUpdateMonitor.getFailedAttempts() % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
                                long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
                                handleAttemptLockout(deadline);
                            }
                        }
                    }
                    }
                }
                }
            }
            }