Loading packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java +18 −11 Original line number Diff line number Diff line Loading @@ -53,15 +53,18 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout super(context, attrs); } @Override public void setKeyguardCallback(KeyguardSecurityCallback callback) { mCallback = callback; } @Override public void setLockPatternUtils(LockPatternUtils utils) { mLockPatternUtils = utils; mEnableHaptics = mLockPatternUtils.isTactileFeedbackEnabled(); } @Override public void reset() { // start fresh resetPasswordText(false /* animate */); Loading Loading @@ -95,6 +98,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout } } @Override public void onEmergencyButtonClickedWhenInCall() { mCallback.reset(); } Loading @@ -115,11 +119,11 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout mPendingLockCheck.cancel(false); } if (entry.length() < MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT) { if (entry.length() <= MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT) { // to avoid accidental lockout, only count attempts that are long enough to be a // real password. This may require some tweaking. setPasswordEntryInputEnabled(true); onPasswordChecked(entry, false, 0); onPasswordChecked(false /* matched */, 0, false /* not valid - too short */); return; } Loading @@ -132,25 +136,28 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout public void onChecked(boolean matched, int timeoutMs) { setPasswordEntryInputEnabled(true); mPendingLockCheck = null; onPasswordChecked(entry, matched, timeoutMs); onPasswordChecked(matched, timeoutMs, true /* isValidPassword */); } }); } private void onPasswordChecked(String entry, boolean matched, int timeoutMs) { private void onPasswordChecked(boolean matched, int timeoutMs, boolean isValidPassword) { if (matched) { mCallback.reportUnlockAttempt(true, 0); mCallback.dismiss(true); } else { if (isValidPassword) { mCallback.reportUnlockAttempt(false, timeoutMs); int attempts = KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts(); if (timeoutMs > 0) { long deadline = mLockPatternUtils.setLockoutAttemptDeadline( KeyguardUpdateMonitor.getCurrentUser(), timeoutMs); handleAttemptLockout(deadline); } } if (timeoutMs == 0) { mSecurityMessageDisplay.setMessage(getWrongPasswordStringId(), true); } } resetPasswordText(true /* animate */); } Loading packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +24 −14 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit * Useful for clearing out the wrong pattern after a delay */ private Runnable mCancelPatternRunnable = new Runnable() { @Override public void run() { mLockPatternView.clearPattern(); } Loading Loading @@ -117,10 +118,12 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit R.dimen.disappear_y_translation); } @Override public void setKeyguardCallback(KeyguardSecurityCallback callback) { mCallback = callback; } @Override public void setLockPatternUtils(LockPatternUtils utils) { mLockPatternUtils = utils; } Loading Loading @@ -153,6 +156,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit } } @Override public void onEmergencyButtonClickedWhenInCall() { mCallback.reset(); } Loading @@ -174,6 +178,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit return result; } @Override public void reset() { // reset lock pattern mLockPatternView.enableInput(); Loading Loading @@ -207,18 +212,22 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit private class UnlockPatternListener implements LockPatternView.OnPatternListener { @Override public void onPatternStart() { mLockPatternView.removeCallbacks(mCancelPatternRunnable); mSecurityMessageDisplay.setMessage("", false); } @Override public void onPatternCleared() { } @Override public void onPatternCellAdded(List<LockPatternView.Cell> pattern) { mCallback.userActivity(); } @Override public void onPatternDetected(final List<LockPatternView.Cell> pattern) { mLockPatternView.disableInput(); if (mPendingLockCheck != null) { Loading @@ -227,7 +236,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit if (pattern.size() < LockPatternUtils.MIN_PATTERN_REGISTER_FAIL) { mLockPatternView.enableInput(); onPatternChecked(pattern, false, 0); onPatternChecked(false, 0, false /* not valid - too short */); return; } Loading @@ -240,29 +249,30 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit public void onChecked(boolean matched, int timeoutMs) { mLockPatternView.enableInput(); mPendingLockCheck = null; onPatternChecked(pattern, matched, timeoutMs); onPatternChecked(matched, timeoutMs, true); } }); if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) { mCallback.userActivity(); } } private void onPatternChecked(List<LockPatternView.Cell> pattern, boolean matched, int timeoutMs) { private void onPatternChecked(boolean matched, int timeoutMs, boolean isValidPattern) { if (matched) { mCallback.reportUnlockAttempt(true, 0); mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct); mCallback.dismiss(true); } else { if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) { mCallback.userActivity(); } mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong); if (isValidPattern) { mCallback.reportUnlockAttempt(false, timeoutMs); int attempts = mKeyguardUpdateMonitor.getFailedUnlockAttempts(); if (timeoutMs > 0) { long deadline = mLockPatternUtils.setLockoutAttemptDeadline( KeyguardUpdateMonitor.getCurrentUser(), timeoutMs); handleAttemptLockout(deadline); } else { } } if (timeoutMs == 0) { mSecurityMessageDisplay.setMessage(R.string.kg_wrong_pattern, true); mLockPatternView.postDelayed(mCancelPatternRunnable, PATTERN_CLEAR_TIMEOUT_MS); } Loading Loading
packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java +18 −11 Original line number Diff line number Diff line Loading @@ -53,15 +53,18 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout super(context, attrs); } @Override public void setKeyguardCallback(KeyguardSecurityCallback callback) { mCallback = callback; } @Override public void setLockPatternUtils(LockPatternUtils utils) { mLockPatternUtils = utils; mEnableHaptics = mLockPatternUtils.isTactileFeedbackEnabled(); } @Override public void reset() { // start fresh resetPasswordText(false /* animate */); Loading Loading @@ -95,6 +98,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout } } @Override public void onEmergencyButtonClickedWhenInCall() { mCallback.reset(); } Loading @@ -115,11 +119,11 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout mPendingLockCheck.cancel(false); } if (entry.length() < MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT) { if (entry.length() <= MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT) { // to avoid accidental lockout, only count attempts that are long enough to be a // real password. This may require some tweaking. setPasswordEntryInputEnabled(true); onPasswordChecked(entry, false, 0); onPasswordChecked(false /* matched */, 0, false /* not valid - too short */); return; } Loading @@ -132,25 +136,28 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout public void onChecked(boolean matched, int timeoutMs) { setPasswordEntryInputEnabled(true); mPendingLockCheck = null; onPasswordChecked(entry, matched, timeoutMs); onPasswordChecked(matched, timeoutMs, true /* isValidPassword */); } }); } private void onPasswordChecked(String entry, boolean matched, int timeoutMs) { private void onPasswordChecked(boolean matched, int timeoutMs, boolean isValidPassword) { if (matched) { mCallback.reportUnlockAttempt(true, 0); mCallback.dismiss(true); } else { if (isValidPassword) { mCallback.reportUnlockAttempt(false, timeoutMs); int attempts = KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts(); if (timeoutMs > 0) { long deadline = mLockPatternUtils.setLockoutAttemptDeadline( KeyguardUpdateMonitor.getCurrentUser(), timeoutMs); handleAttemptLockout(deadline); } } if (timeoutMs == 0) { mSecurityMessageDisplay.setMessage(getWrongPasswordStringId(), true); } } resetPasswordText(true /* animate */); } Loading
packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +24 −14 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit * Useful for clearing out the wrong pattern after a delay */ private Runnable mCancelPatternRunnable = new Runnable() { @Override public void run() { mLockPatternView.clearPattern(); } Loading Loading @@ -117,10 +118,12 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit R.dimen.disappear_y_translation); } @Override public void setKeyguardCallback(KeyguardSecurityCallback callback) { mCallback = callback; } @Override public void setLockPatternUtils(LockPatternUtils utils) { mLockPatternUtils = utils; } Loading Loading @@ -153,6 +156,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit } } @Override public void onEmergencyButtonClickedWhenInCall() { mCallback.reset(); } Loading @@ -174,6 +178,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit return result; } @Override public void reset() { // reset lock pattern mLockPatternView.enableInput(); Loading Loading @@ -207,18 +212,22 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit private class UnlockPatternListener implements LockPatternView.OnPatternListener { @Override public void onPatternStart() { mLockPatternView.removeCallbacks(mCancelPatternRunnable); mSecurityMessageDisplay.setMessage("", false); } @Override public void onPatternCleared() { } @Override public void onPatternCellAdded(List<LockPatternView.Cell> pattern) { mCallback.userActivity(); } @Override public void onPatternDetected(final List<LockPatternView.Cell> pattern) { mLockPatternView.disableInput(); if (mPendingLockCheck != null) { Loading @@ -227,7 +236,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit if (pattern.size() < LockPatternUtils.MIN_PATTERN_REGISTER_FAIL) { mLockPatternView.enableInput(); onPatternChecked(pattern, false, 0); onPatternChecked(false, 0, false /* not valid - too short */); return; } Loading @@ -240,29 +249,30 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit public void onChecked(boolean matched, int timeoutMs) { mLockPatternView.enableInput(); mPendingLockCheck = null; onPatternChecked(pattern, matched, timeoutMs); onPatternChecked(matched, timeoutMs, true); } }); if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) { mCallback.userActivity(); } } private void onPatternChecked(List<LockPatternView.Cell> pattern, boolean matched, int timeoutMs) { private void onPatternChecked(boolean matched, int timeoutMs, boolean isValidPattern) { if (matched) { mCallback.reportUnlockAttempt(true, 0); mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct); mCallback.dismiss(true); } else { if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) { mCallback.userActivity(); } mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong); if (isValidPattern) { mCallback.reportUnlockAttempt(false, timeoutMs); int attempts = mKeyguardUpdateMonitor.getFailedUnlockAttempts(); if (timeoutMs > 0) { long deadline = mLockPatternUtils.setLockoutAttemptDeadline( KeyguardUpdateMonitor.getCurrentUser(), timeoutMs); handleAttemptLockout(deadline); } else { } } if (timeoutMs == 0) { mSecurityMessageDisplay.setMessage(R.string.kg_wrong_pattern, true); mLockPatternView.postDelayed(mCancelPatternRunnable, PATTERN_CLEAR_TIMEOUT_MS); } Loading