diff options
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java index 06cd69e..798add6 100644 --- a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java @@ -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); + } + } + } + } } }); |