Merge "Handle pattern cooldown correctly"

This commit is contained in:
Paul Lawrence
2014-03-20 13:33:52 +00:00
committed by Android (Google) Code Review

View File

@@ -174,6 +174,9 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
// Factory reset the device. // Factory reset the device.
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR")); sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
} else if ((failedAttempts % COOL_DOWN_ATTEMPTS) == 0) { } else if ((failedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
if (mLockPatternView != null) {
mLockPatternView.clearPattern();
}
mCooldown = COOL_DOWN_INTERVAL; mCooldown = COOL_DOWN_INTERVAL;
cooldown(); cooldown();
} else { } else {
@@ -183,6 +186,9 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
if (mPasswordEntry != null) { if (mPasswordEntry != null) {
mPasswordEntry.setEnabled(true); mPasswordEntry.setEnabled(true);
} }
if (mLockPatternView != null) {
mLockPatternView.setEnabled(true);
}
} }
} }
} }
@@ -373,6 +379,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
setContentView(R.layout.crypt_keeper_pin_entry); setContentView(R.layout.crypt_keeper_pin_entry);
} else if (type == StorageManager.CRYPT_TYPE_PATTERN) { } else if (type == StorageManager.CRYPT_TYPE_PATTERN) {
setContentView(R.layout.crypt_keeper_pattern_entry); setContentView(R.layout.crypt_keeper_pattern_entry);
setBackFunctionality(false);
} else { } else {
setContentView(R.layout.crypt_keeper_password_entry); setContentView(R.layout.crypt_keeper_password_entry);
} }
@@ -498,8 +505,13 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
if (mCooldown <= 0) { if (mCooldown <= 0) {
// Re-enable the password entry and back presses. // Re-enable the password entry and back presses.
mPasswordEntry.setEnabled(true); if (mPasswordEntry != null) {
setBackFunctionality(true); mPasswordEntry.setEnabled(true);
setBackFunctionality(true);
}
if (mLockPatternView != null) {
mLockPatternView.setEnabled(true);
}
status.setText(R.string.enter_password); status.setText(R.string.enter_password);
} else { } else {
CharSequence template = getText(R.string.crypt_keeper_cooldown); CharSequence template = getText(R.string.crypt_keeper_cooldown);
@@ -537,6 +549,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
@Override @Override
public void onPatternDetected(List<LockPatternView.Cell> pattern) { public void onPatternDetected(List<LockPatternView.Cell> pattern) {
mLockPatternView.setEnabled(false);
new DecryptTask().execute(LockPatternUtils.patternToString(pattern)); new DecryptTask().execute(LockPatternUtils.patternToString(pattern));
} }