Merge changes Ib3133583,I0262172d into jb-mr1-lockscreen-dev

* changes:
  Show "wrong password" on password screen, not "wrong PIN"
  Restore incorrect-PIN lockouts.
This commit is contained in:
Daniel Sandler
2012-11-01 18:09:14 -07:00
committed by Android (Google) Code Review
4 changed files with 28 additions and 7 deletions

View File

@@ -88,6 +88,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
}
protected abstract int getPasswordTextViewId();
protected abstract int getWrongPasswordStringId();
protected abstract void resetState();
@Override
@@ -144,7 +145,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
handleAttemptLockout(deadline);
}
mSecurityMessageDisplay.setMessage(R.string.kg_wrong_pin, true);
mSecurityMessageDisplay.setMessage(getWrongPasswordStringId(), true);
}
mPasswordEntry.setText("");
}
@@ -164,6 +165,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
@Override
public void onFinish() {
mSecurityMessageDisplay.setMessage("", false);
resetState();
}
}.start();

View File

@@ -65,7 +65,9 @@ public class KeyguardPINView extends KeyguardAbsKeyInputView
@Override
public void onClick(View v) {
doHapticKeyClick();
verifyPasswordAndUnlock();
if (mPasswordEntry.isEnabled()) {
verifyPasswordAndUnlock();
}
}
});
ok.setOnHoverListener(new NumPadKey.LiftToActivateListener(getContext()));
@@ -78,16 +80,22 @@ public class KeyguardPINView extends KeyguardAbsKeyInputView
pinDelete.setVisibility(View.VISIBLE);
pinDelete.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
CharSequence str = mPasswordEntry.getText();
if (str.length() > 0) {
mPasswordEntry.setText(str.subSequence(0, str.length()-1));
// check for time-based lockouts
if (mPasswordEntry.isEnabled()) {
CharSequence str = mPasswordEntry.getText();
if (str.length() > 0) {
mPasswordEntry.setText(str.subSequence(0, str.length()-1));
}
}
doHapticKeyClick();
}
});
pinDelete.setOnLongClickListener(new View.OnLongClickListener() {
public boolean onLongClick(View v) {
mPasswordEntry.setText("");
// check for time-based lockouts
if (mPasswordEntry.isEnabled()) {
mPasswordEntry.setText("");
}
doHapticKeyClick();
return true;
}
@@ -104,4 +112,9 @@ public class KeyguardPINView extends KeyguardAbsKeyInputView
@Override
public void showUsabilityHint() {
}
@Override
public int getWrongPasswordStringId() {
return R.string.kg_wrong_pin;
}
}

View File

@@ -195,4 +195,9 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
@Override
public void showUsabilityHint() {
}
@Override
public int getWrongPasswordStringId() {
return R.string.kg_wrong_password;
}
}

View File

@@ -51,7 +51,8 @@ public class NumPadKey extends Button {
}
}
}
if (mTextView != null) {
// check for time-based lockouts
if (mTextView != null && mTextView.isEnabled()) {
mTextView.append(String.valueOf(mDigit));
}
doHapticKeyClick();