Loading src/com/android/settings/CryptKeeper.java +69 −38 Original line number Diff line number Diff line Loading @@ -137,6 +137,17 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList // how long we wait to clear a right pattern private static final int RIGHT_PATTERN_CLEAR_TIMEOUT_MS = 500; // When the user enters a short pin/password, run this to show an error, // but don't count it against attempts. private final Runnable mFakeUnlockAttemptRunnable = new Runnable() { public void run() { handleBadAttempt(1 /* failedAttempt */); } }; // TODO: this should be tuned to match minimum decryption timeout private static final int FAKE_ATTEMPT_DELAY = 1000; private Runnable mClearPatternRunnable = new Runnable() { public void run() { mLockPatternView.clearPattern(); Loading Loading @@ -200,6 +211,12 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList showFactoryReset(true); return; } else { handleBadAttempt(failedAttempts); } } } private void handleBadAttempt(Integer failedAttempts) { // Wrong entry. Handle pattern case. if (mLockPatternView != null) { mLockPatternView.setDisplayMode(DisplayMode.Wrong); Loading Loading @@ -238,8 +255,6 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList } } } } } private class ValidationTask extends AsyncTask<Void, Void, Boolean> { int state; Loading Loading @@ -307,6 +322,8 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList | StatusBarManager.DISABLE_SEARCH | StatusBarManager.DISABLE_RECENT; protected static final int MIN_LENGTH_BEFORE_REPORT = LockPatternUtils.MIN_LOCK_PATTERN_SIZE; /** @return whether or not this Activity was started for debugging the UI only. */ private boolean isDebugView() { return getIntent().hasExtra(EXTRA_FORCE_VIEW); Loading Loading @@ -679,6 +696,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList } } private void fakeUnlockAttempt(View postingView) { postingView.postDelayed(mFakeUnlockAttemptRunnable, FAKE_ATTEMPT_DELAY); } protected LockPatternView.OnPatternListener mChooseNewLockPatternListener = new LockPatternView.OnPatternListener() { Loading @@ -694,7 +715,12 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList @Override public void onPatternDetected(List<LockPatternView.Cell> pattern) { mLockPatternView.setEnabled(false); if (pattern.size() >= MIN_LENGTH_BEFORE_REPORT) { new DecryptTask().execute(LockPatternUtils.patternToString(pattern)); } else { // Allow user to make as many of these as they want. fakeUnlockAttempt(mLockPatternView); } } @Override Loading Loading @@ -851,8 +877,13 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList mPasswordEntry.setEnabled(false); setBackFunctionality(false); if (password.length() >= LockPatternUtils.MIN_LOCK_PATTERN_SIZE) { Log.d(TAG, "Attempting to send command to decrypt"); new DecryptTask().execute(password); } else { // Allow user to make as many of these as they want. fakeUnlockAttempt(mPasswordEntry); } return true; } Loading Loading
src/com/android/settings/CryptKeeper.java +69 −38 Original line number Diff line number Diff line Loading @@ -137,6 +137,17 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList // how long we wait to clear a right pattern private static final int RIGHT_PATTERN_CLEAR_TIMEOUT_MS = 500; // When the user enters a short pin/password, run this to show an error, // but don't count it against attempts. private final Runnable mFakeUnlockAttemptRunnable = new Runnable() { public void run() { handleBadAttempt(1 /* failedAttempt */); } }; // TODO: this should be tuned to match minimum decryption timeout private static final int FAKE_ATTEMPT_DELAY = 1000; private Runnable mClearPatternRunnable = new Runnable() { public void run() { mLockPatternView.clearPattern(); Loading Loading @@ -200,6 +211,12 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList showFactoryReset(true); return; } else { handleBadAttempt(failedAttempts); } } } private void handleBadAttempt(Integer failedAttempts) { // Wrong entry. Handle pattern case. if (mLockPatternView != null) { mLockPatternView.setDisplayMode(DisplayMode.Wrong); Loading Loading @@ -238,8 +255,6 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList } } } } } private class ValidationTask extends AsyncTask<Void, Void, Boolean> { int state; Loading Loading @@ -307,6 +322,8 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList | StatusBarManager.DISABLE_SEARCH | StatusBarManager.DISABLE_RECENT; protected static final int MIN_LENGTH_BEFORE_REPORT = LockPatternUtils.MIN_LOCK_PATTERN_SIZE; /** @return whether or not this Activity was started for debugging the UI only. */ private boolean isDebugView() { return getIntent().hasExtra(EXTRA_FORCE_VIEW); Loading Loading @@ -679,6 +696,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList } } private void fakeUnlockAttempt(View postingView) { postingView.postDelayed(mFakeUnlockAttemptRunnable, FAKE_ATTEMPT_DELAY); } protected LockPatternView.OnPatternListener mChooseNewLockPatternListener = new LockPatternView.OnPatternListener() { Loading @@ -694,7 +715,12 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList @Override public void onPatternDetected(List<LockPatternView.Cell> pattern) { mLockPatternView.setEnabled(false); if (pattern.size() >= MIN_LENGTH_BEFORE_REPORT) { new DecryptTask().execute(LockPatternUtils.patternToString(pattern)); } else { // Allow user to make as many of these as they want. fakeUnlockAttempt(mLockPatternView); } } @Override Loading Loading @@ -851,8 +877,13 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList mPasswordEntry.setEnabled(false); setBackFunctionality(false); if (password.length() >= LockPatternUtils.MIN_LOCK_PATTERN_SIZE) { Log.d(TAG, "Attempting to send command to decrypt"); new DecryptTask().execute(password); } else { // Allow user to make as many of these as they want. fakeUnlockAttempt(mPasswordEntry); } return true; } Loading