Merge "Merge "Don\'t always announce accessibility events when resetting password" into nyc-dev am: 2d1c424a0e am: 9e507bd737" into nyc-mr1-dev-plus-aosp

This commit is contained in:
Android Build Merger (Role)
2016-05-17 22:27:41 +00:00
committed by Android (Google) Code Review
7 changed files with 31 additions and 13 deletions

View File

@@ -69,7 +69,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
public void reset() { public void reset() {
// start fresh // start fresh
mDismissing = false; mDismissing = false;
resetPasswordText(false /* animate */); resetPasswordText(false /* animate */, false /* announce */);
// if the user is currently locked out, enforce it. // if the user is currently locked out, enforce it.
long deadline = mLockPatternUtils.getLockoutAttemptDeadline( long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
KeyguardUpdateMonitor.getCurrentUser()); KeyguardUpdateMonitor.getCurrentUser());
@@ -169,10 +169,10 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
mSecurityMessageDisplay.setMessage(getWrongPasswordStringId(), true); mSecurityMessageDisplay.setMessage(getWrongPasswordStringId(), true);
} }
} }
resetPasswordText(true /* animate */); resetPasswordText(true /* animate */, !matched /* announce deletion if no match */);
} }
protected abstract void resetPasswordText(boolean animate); protected abstract void resetPasswordText(boolean animate, boolean announce);
protected abstract String getPasswordText(); protected abstract String getPasswordText();
protected abstract void setPasswordEntryEnabled(boolean enabled); protected abstract void setPasswordEntryEnabled(boolean enabled);
protected abstract void setPasswordEntryInputEnabled(boolean enabled); protected abstract void setPasswordEntryInputEnabled(boolean enabled);

View File

@@ -60,6 +60,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView {
R.dimen.disappear_y_translation); R.dimen.disappear_y_translation);
} }
@Override
protected void resetState() { protected void resetState() {
super.resetState(); super.resetState();
mSecurityMessageDisplay.setMessage(R.string.kg_pin_instructions, false); mSecurityMessageDisplay.setMessage(R.string.kg_pin_instructions, false);

View File

@@ -72,6 +72,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
context, android.R.interpolator.fast_out_linear_in); context, android.R.interpolator.fast_out_linear_in);
} }
@Override
protected void resetState() { protected void resetState() {
mSecurityMessageDisplay.setMessage(R.string.kg_password_instructions, false); mSecurityMessageDisplay.setMessage(R.string.kg_password_instructions, false);
final boolean wasDisabled = mPasswordEntry.isEnabled(); final boolean wasDisabled = mPasswordEntry.isEnabled();
@@ -159,6 +160,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
// Poke the wakelock any time the text is selected or modified // Poke the wakelock any time the text is selected or modified
mPasswordEntry.setOnClickListener(new OnClickListener() { mPasswordEntry.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
mCallback.userActivity(); mCallback.userActivity();
} }
@@ -175,6 +177,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
switchImeButton.setVisibility(View.VISIBLE); switchImeButton.setVisibility(View.VISIBLE);
imeOrDeleteButtonVisible = true; imeOrDeleteButtonVisible = true;
switchImeButton.setOnClickListener(new OnClickListener() { switchImeButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { public void onClick(View v) {
mCallback.userActivity(); // Leave the screen on a bit longer mCallback.userActivity(); // Leave the screen on a bit longer
// Do not show auxiliary subtypes in password lock screen. // Do not show auxiliary subtypes in password lock screen.
@@ -202,7 +205,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
} }
@Override @Override
protected void resetPasswordText(boolean animate) { protected void resetPasswordText(boolean animate, boolean announce) {
mPasswordEntry.setText(""); mPasswordEntry.setText("");
} }

View File

@@ -159,8 +159,8 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
} }
@Override @Override
protected void resetPasswordText(boolean animate) { protected void resetPasswordText(boolean animate, boolean announce) {
mPasswordEntry.reset(animate); mPasswordEntry.reset(animate, announce);
} }
@Override @Override
@@ -214,7 +214,7 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
// check for time-based lockouts // check for time-based lockouts
if (mPasswordEntry.isEnabled()) { if (mPasswordEntry.isEnabled()) {
resetPasswordText(true /* animate */); resetPasswordText(true /* animate */, true /* announce */);
} }
doHapticKeyClick(); doHapticKeyClick();
return true; return true;

View File

@@ -71,6 +71,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
super(context, attrs); super(context, attrs);
} }
@Override
public void resetState() { public void resetState() {
super.resetState(); super.resetState();
if (DEBUG) Log.v(TAG, "Resetting state"); if (DEBUG) Log.v(TAG, "Resetting state");
@@ -199,6 +200,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
Log.v(TAG, "supplyPinReportResult returned: " + result[0] + " " + result[1]); Log.v(TAG, "supplyPinReportResult returned: " + result[0] + " " + result[1]);
} }
post(new Runnable() { post(new Runnable() {
@Override
public void run() { public void run() {
onSimCheckResponse(result[0], result[1]); onSimCheckResponse(result[0], result[1]);
} }
@@ -206,6 +208,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e(TAG, "RemoteException for supplyPinReportResult:", e); Log.e(TAG, "RemoteException for supplyPinReportResult:", e);
post(new Runnable() { post(new Runnable() {
@Override
public void run() { public void run() {
onSimCheckResponse(PhoneConstants.PIN_GENERAL_FAILURE, -1); onSimCheckResponse(PhoneConstants.PIN_GENERAL_FAILURE, -1);
} }
@@ -250,7 +253,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
if (entry.length() < 4) { if (entry.length() < 4) {
// otherwise, display a message to the user, and don't submit. // otherwise, display a message to the user, and don't submit.
mSecurityMessageDisplay.setMessage(R.string.kg_invalid_sim_pin_hint, true); mSecurityMessageDisplay.setMessage(R.string.kg_invalid_sim_pin_hint, true);
resetPasswordText(true); resetPasswordText(true /* animate */, true /* announce */);
mCallback.userActivity(); mCallback.userActivity();
return; return;
} }
@@ -259,13 +262,16 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
if (mCheckSimPinThread == null) { if (mCheckSimPinThread == null) {
mCheckSimPinThread = new CheckSimPin(mPasswordEntry.getText(), mSubId) { mCheckSimPinThread = new CheckSimPin(mPasswordEntry.getText(), mSubId) {
@Override
void onSimCheckResponse(final int result, final int attemptsRemaining) { void onSimCheckResponse(final int result, final int attemptsRemaining) {
post(new Runnable() { post(new Runnable() {
@Override
public void run() { public void run() {
if (mSimUnlockProgressDialog != null) { if (mSimUnlockProgressDialog != null) {
mSimUnlockProgressDialog.hide(); mSimUnlockProgressDialog.hide();
} }
resetPasswordText(true /* animate */); resetPasswordText(true /* animate */,
result != PhoneConstants.PIN_RESULT_SUCCESS /* announce */);
if (result == PhoneConstants.PIN_RESULT_SUCCESS) { if (result == PhoneConstants.PIN_RESULT_SUCCESS) {
KeyguardUpdateMonitor.getInstance(getContext()) KeyguardUpdateMonitor.getInstance(getContext())
.reportSimUnlocked(mSubId); .reportSimUnlocked(mSubId);

View File

@@ -106,7 +106,7 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
msg = R.string.kg_invalid_confirm_pin_hint; msg = R.string.kg_invalid_confirm_pin_hint;
} }
} }
resetPasswordText(true); resetPasswordText(true /* animate */, true /* announce */);
if (msg != 0) { if (msg != 0) {
mSecurityMessageDisplay.setMessage(msg, true); mSecurityMessageDisplay.setMessage(msg, true);
} }
@@ -163,6 +163,7 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
return displayMessage; return displayMessage;
} }
@Override
public void resetState() { public void resetState() {
super.resetState(); super.resetState();
mStateMachine.reset(); mStateMachine.reset();
@@ -242,6 +243,7 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
Log.v(TAG, "supplyPukReportResult returned: " + result[0] + " " + result[1]); Log.v(TAG, "supplyPukReportResult returned: " + result[0] + " " + result[1]);
} }
post(new Runnable() { post(new Runnable() {
@Override
public void run() { public void run() {
onSimLockChangedResponse(result[0], result[1]); onSimLockChangedResponse(result[0], result[1]);
} }
@@ -249,6 +251,7 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e(TAG, "RemoteException for supplyPukReportResult:", e); Log.e(TAG, "RemoteException for supplyPukReportResult:", e);
post(new Runnable() { post(new Runnable() {
@Override
public void run() { public void run() {
onSimLockChangedResponse(PhoneConstants.PIN_GENERAL_FAILURE, -1); onSimLockChangedResponse(PhoneConstants.PIN_GENERAL_FAILURE, -1);
} }
@@ -316,13 +319,16 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
if (mCheckSimPukThread == null) { if (mCheckSimPukThread == null) {
mCheckSimPukThread = new CheckSimPuk(mPukText, mPinText, mSubId) { mCheckSimPukThread = new CheckSimPuk(mPukText, mPinText, mSubId) {
@Override
void onSimLockChangedResponse(final int result, final int attemptsRemaining) { void onSimLockChangedResponse(final int result, final int attemptsRemaining) {
post(new Runnable() { post(new Runnable() {
@Override
public void run() { public void run() {
if (mSimUnlockProgressDialog != null) { if (mSimUnlockProgressDialog != null) {
mSimUnlockProgressDialog.hide(); mSimUnlockProgressDialog.hide();
} }
resetPasswordText(true /* animate */); resetPasswordText(true /* animate */,
result != PhoneConstants.PIN_RESULT_SUCCESS /* announce */);
if (result == PhoneConstants.PIN_RESULT_SUCCESS) { if (result == PhoneConstants.PIN_RESULT_SUCCESS) {
KeyguardUpdateMonitor.getInstance(getContext()) KeyguardUpdateMonitor.getInstance(getContext())
.reportSimUnlocked(mSubId); .reportSimUnlocked(mSubId);

View File

@@ -268,7 +268,7 @@ public class PasswordTextView extends View {
return charState; return charState;
} }
public void reset(boolean animated) { public void reset(boolean animated, boolean announce) {
String textbefore = mText; String textbefore = mText;
mText = ""; mText = "";
int length = mTextChars.size(); int length = mTextChars.size();
@@ -297,7 +297,9 @@ public class PasswordTextView extends View {
if (!animated) { if (!animated) {
mTextChars.clear(); mTextChars.clear();
} }
sendAccessibilityEventTypeViewTextChanged(textbefore, 0, textbefore.length(), 0); if (announce) {
sendAccessibilityEventTypeViewTextChanged(textbefore, 0, textbefore.length(), 0);
}
} }
void sendAccessibilityEventTypeViewTextChanged(String beforeText, int fromIndex, void sendAccessibilityEventTypeViewTextChanged(String beforeText, int fromIndex,