[LockSettings] pipe through HW throttle timeout
Bug: 21118563 Change-Id: I23f5af2ebef9dac981281fb04c055a02f3b159b8
This commit is contained in:
@@ -41,6 +41,7 @@ import android.text.Selection;
|
||||
import android.text.Spannable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -61,6 +62,8 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
public static final String PASSWORD_MIN_SYMBOLS_KEY = "lockscreen.password_min_symbols";
|
||||
public static final String PASSWORD_MIN_NONLETTER_KEY = "lockscreen.password_min_nonletter";
|
||||
|
||||
private static final String TAG = "ChooseLockPassword";
|
||||
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
Intent modIntent = new Intent(super.getIntent());
|
||||
@@ -533,7 +536,11 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
UserHandle.myUserId(),
|
||||
new LockPatternChecker.OnVerifyCallback() {
|
||||
@Override
|
||||
public void onVerified(byte[] token) {
|
||||
public void onVerified(byte[] token, int timeoutMs) {
|
||||
if (token == null) {
|
||||
Log.e(TAG, "critical: no token returned from known good password");
|
||||
}
|
||||
|
||||
mPasswordEntryInputDisabler.setInputEnabled(true);
|
||||
setNextEnabled(true);
|
||||
mPendingLockCheck = null;
|
||||
|
@@ -34,6 +34,7 @@ import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -64,6 +65,8 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
*/
|
||||
static final int RESULT_FINISHED = RESULT_FIRST_USER;
|
||||
|
||||
private static final String TAG = "ChooseLockPattern";
|
||||
|
||||
@Override
|
||||
public Intent getIntent() {
|
||||
Intent modIntent = new Intent(super.getIntent());
|
||||
@@ -663,7 +666,11 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
UserHandle.myUserId(),
|
||||
new LockPatternChecker.OnVerifyCallback() {
|
||||
@Override
|
||||
public void onVerified(byte[] token) {
|
||||
public void onVerified(byte[] token, int timeoutMs) {
|
||||
if (token == null) {
|
||||
Log.e(TAG, "critical: no token returned for known good pattern");
|
||||
}
|
||||
|
||||
mLockPatternView.enableInput();
|
||||
mPendingLockCheck = null;
|
||||
|
||||
|
@@ -248,7 +248,7 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
onPasswordChecked(false, intent);
|
||||
onPasswordChecked(false, intent, 0);
|
||||
}
|
||||
|
||||
private boolean isInternalActivity() {
|
||||
@@ -265,7 +265,7 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
UserHandle.myUserId(),
|
||||
new LockPatternChecker.OnVerifyCallback() {
|
||||
@Override
|
||||
public void onVerified(byte[] token) {
|
||||
public void onVerified(byte[] token, int timeoutMs) {
|
||||
mPendingLockCheck = null;
|
||||
boolean matched = false;
|
||||
if (token != null) {
|
||||
@@ -274,7 +274,7 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN,
|
||||
token);
|
||||
}
|
||||
onPasswordChecked(matched, intent);
|
||||
onPasswordChecked(matched, intent, timeoutMs);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -286,7 +286,7 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
UserHandle.myUserId(),
|
||||
new LockPatternChecker.OnCheckCallback() {
|
||||
@Override
|
||||
public void onChecked(boolean matched) {
|
||||
public void onChecked(boolean matched, int timeoutMs) {
|
||||
mPendingLockCheck = null;
|
||||
if (matched && isInternalActivity()) {
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
|
||||
@@ -295,20 +295,20 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
intent.putExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD, pin);
|
||||
}
|
||||
onPasswordChecked(matched, intent);
|
||||
onPasswordChecked(matched, intent, timeoutMs);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onPasswordChecked(boolean matched, Intent intent) {
|
||||
private void onPasswordChecked(boolean matched, Intent intent, int timeoutMs) {
|
||||
mPasswordEntryInputDisabler.setInputEnabled(true);
|
||||
if (matched) {
|
||||
getActivity().setResult(RESULT_OK, intent);
|
||||
getActivity().finish();
|
||||
} else {
|
||||
if (++mNumWrongConfirmAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
|
||||
if (timeoutMs > 0) {
|
||||
long deadline = mLockPatternUtils.setLockoutAttemptDeadline(
|
||||
UserHandle.myUserId());
|
||||
UserHandle.myUserId(), timeoutMs);
|
||||
handleAttemptLockout(deadline);
|
||||
} else {
|
||||
showError(getErrorMessage());
|
||||
|
@@ -295,7 +295,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
onPatternChecked(pattern, false, intent);
|
||||
onPatternChecked(pattern, false, intent, 0);
|
||||
}
|
||||
|
||||
private boolean isInternalActivity() {
|
||||
@@ -313,7 +313,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
UserHandle.myUserId(),
|
||||
new LockPatternChecker.OnVerifyCallback() {
|
||||
@Override
|
||||
public void onVerified(byte[] token) {
|
||||
public void onVerified(byte[] token, int timeoutMs) {
|
||||
mPendingLockCheck = null;
|
||||
boolean matched = false;
|
||||
if (token != null) {
|
||||
@@ -322,20 +322,25 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN,
|
||||
token);
|
||||
}
|
||||
onPatternChecked(pattern, matched, intent);
|
||||
onPatternChecked(pattern, matched, intent, timeoutMs);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void startCheckPattern(final List<LockPatternView.Cell> pattern,
|
||||
final Intent intent) {
|
||||
if (pattern.size() <= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL) {
|
||||
onPatternChecked(pattern, false, intent, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
mPendingLockCheck = LockPatternChecker.checkPattern(
|
||||
mLockPatternUtils,
|
||||
pattern,
|
||||
UserHandle.myUserId(),
|
||||
new LockPatternChecker.OnCheckCallback() {
|
||||
@Override
|
||||
public void onChecked(boolean matched) {
|
||||
public void onChecked(boolean matched, int timeoutMs) {
|
||||
mPendingLockCheck = null;
|
||||
if (matched && isInternalActivity()) {
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
|
||||
@@ -343,24 +348,21 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD,
|
||||
LockPatternUtils.patternToString(pattern));
|
||||
}
|
||||
onPatternChecked(pattern, matched, intent);
|
||||
onPatternChecked(pattern, matched, intent, timeoutMs);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onPatternChecked(List<LockPatternView.Cell> pattern,
|
||||
boolean matched,
|
||||
Intent intent) {
|
||||
boolean matched, Intent intent, int timeoutMs) {
|
||||
mLockPatternView.setEnabled(true);
|
||||
if (matched) {
|
||||
getActivity().setResult(Activity.RESULT_OK, intent);
|
||||
getActivity().finish();
|
||||
} else {
|
||||
if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL &&
|
||||
++mNumWrongConfirmAttempts
|
||||
>= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
|
||||
if (timeoutMs > 0) {
|
||||
long deadline = mLockPatternUtils.setLockoutAttemptDeadline(
|
||||
UserHandle.myUserId());
|
||||
UserHandle.myUserId(), timeoutMs);
|
||||
handleAttemptLockout(deadline);
|
||||
} else {
|
||||
updateStage(Stage.NeedToUnlockWrong);
|
||||
|
Reference in New Issue
Block a user