diff options
author | Danesh M <daneshm90@gmail.com> | 2012-01-29 23:45:50 -0500 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2012-01-29 23:57:42 -0500 |
commit | ec4c0a8c3f6ce4bd65eb11b91db3b694f6a0542b (patch) | |
tree | 0ba8ceeafe0a3f2ac82a7073083ebc039e493e28 /policy | |
parent | e3a56d8ea7bea2c9e6127e835880cd49de514751 (diff) | |
download | frameworks_base-ec4c0a8c3f6ce4bd65eb11b91db3b694f6a0542b.zip frameworks_base-ec4c0a8c3f6ce4bd65eb11b91db3b694f6a0542b.tar.gz frameworks_base-ec4c0a8c3f6ce4bd65eb11b91db3b694f6a0542b.tar.bz2 |
Lockscreen : Quick unlock
Unlock password/pin lockscreen without pressing enter button
Patchset 2 : Remove unecessary intialization
Change-Id: Iecb5ed52ef28234f6adad813906dc885296a157c
Diffstat (limited to 'policy')
-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); + } + } + } + } } }); |