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

Commit ec4c0a8c authored by Danesh M's avatar Danesh M
Browse files

Lockscreen : Quick unlock

Unlock password/pin lockscreen without pressing enter button

Patchset 2 : Remove unecessary intialization

Change-Id: Iecb5ed52ef28234f6adad813906dc885296a157c
parent e3a56d8e
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen

    private final KeyguardStatusViewManager mStatusViewManager;
    private final boolean mUseSystemIME = true; // TODO: Make configurable
    private boolean mQuickUnlock;
    private boolean mResuming; // used to prevent poking the wakelock during onResume()

    // To avoid accidental lockout due to events while the device in in the pocket, ignore
@@ -166,6 +167,10 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
                mCallback.pokeWakelock();
            }
        });

        mQuickUnlock = (Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.LOCKSCREEN_QUICK_UNLOCK_CONTROL, 0) == 1);

        mPasswordEntry.addTextChangedListener(new TextWatcher() {
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }
@@ -177,6 +182,21 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen
                if (!mResuming) {
                    mCallback.pokeWakelock();
                }
                if (mQuickUnlock) {
                    String entry = mPasswordEntry.getText().toString();
                    if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT) {
                        if (mLockPatternUtils.checkPassword(entry)) {
                            mCallback.keyguardDone(true);
                            mCallback.reportSuccessfulUnlockAttempt();
                        } else {
                            mCallback.reportFailedUnlockAttempt();
                            if (0 == (mUpdateMonitor.getFailedAttempts() % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
                                long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
                                handleAttemptLockout(deadline);
                            }
                        }
                    }
                }
            }
        });