Merge "Fix available/remaining PIN/PUK attempts."
This commit is contained in:
@@ -364,4 +364,20 @@
|
|||||||
<!-- Fingerprint hint message when finger was not recognized.-->
|
<!-- Fingerprint hint message when finger was not recognized.-->
|
||||||
<string name="fingerprint_not_recognized">Not recognized</string>
|
<string name="fingerprint_not_recognized">Not recognized</string>
|
||||||
|
|
||||||
|
<!-- Instructions telling the user remaining times when enter SIM PIN view. -->
|
||||||
|
<plurals name="kg_password_default_pin_message">
|
||||||
|
<item quantity="one">Enter SIM PIN, you have <xliff:g id="number">%d</xliff:g> remaining
|
||||||
|
attempt before you must contact your carrier to unlock your device.</item>
|
||||||
|
<item quantity="other">Enter SIM PIN, you have <xliff:g id="number">%d</xliff:g> remaining
|
||||||
|
attempts.</item>
|
||||||
|
</plurals>
|
||||||
|
|
||||||
|
<!-- Instructions telling the user remaining times when enter SIM PUK view. -->
|
||||||
|
<plurals name="kg_password_default_puk_message">
|
||||||
|
<item quantity="one">SIM is now disabled. Enter PUK code to continue. You have <xliff:g id="
|
||||||
|
number">%d</xliff:g> remaining attempt before SIM becomes permanently unusable. Contact carrier for details.</item>
|
||||||
|
<item quantity="other">SIM is now disabled. Enter PUK code to continue. You have <xliff:g id="
|
||||||
|
number">%d</xliff:g> remaining attempts before SIM becomes permanently unusable. Contact carrier for details.</item>
|
||||||
|
</plurals>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -53,8 +53,13 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
private ProgressDialog mSimUnlockProgressDialog = null;
|
private ProgressDialog mSimUnlockProgressDialog = null;
|
||||||
private CheckSimPin mCheckSimPinThread;
|
private CheckSimPin mCheckSimPinThread;
|
||||||
|
|
||||||
|
// Below flag is set to true during power-up or when a new SIM card inserted on device.
|
||||||
|
// When this is true and when SIM card is PIN locked state, on PIN lock screen, message would
|
||||||
|
// be displayed to inform user about the number of remaining PIN attempts left.
|
||||||
|
private boolean mShowDefaultMessage = true;
|
||||||
|
private int mRemainingAttempts = -1;
|
||||||
private AlertDialog mRemainingAttemptsDialog;
|
private AlertDialog mRemainingAttemptsDialog;
|
||||||
private int mSubId;
|
private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||||
private ImageView mSimImageView;
|
private ImageView mSimImageView;
|
||||||
|
|
||||||
KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() {
|
KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() {
|
||||||
@@ -91,34 +96,71 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
public void resetState() {
|
public void resetState() {
|
||||||
super.resetState();
|
super.resetState();
|
||||||
if (DEBUG) Log.v(TAG, "Resetting state");
|
if (DEBUG) Log.v(TAG, "Resetting state");
|
||||||
KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
|
handleSubInfoChangeIfNeeded();
|
||||||
mSubId = monitor.getNextSubIdForState(IccCardConstants.State.PIN_REQUIRED);
|
if (mShowDefaultMessage) {
|
||||||
boolean isEsimLocked = KeyguardEsimArea.isEsimLocked(mContext, mSubId);
|
showDefaultMessage();
|
||||||
if (SubscriptionManager.isValidSubscriptionId(mSubId)) {
|
|
||||||
int count = TelephonyManager.getDefault().getSimCount();
|
|
||||||
Resources rez = getResources();
|
|
||||||
String msg;
|
|
||||||
int color = Color.WHITE;
|
|
||||||
if (count < 2) {
|
|
||||||
msg = rez.getString(R.string.kg_sim_pin_instructions);
|
|
||||||
} else {
|
|
||||||
SubscriptionInfo info = monitor.getSubscriptionInfoForSubId(mSubId);
|
|
||||||
CharSequence displayName = info != null ? info.getDisplayName() : ""; // don't crash
|
|
||||||
msg = rez.getString(R.string.kg_sim_pin_instructions_multi, displayName);
|
|
||||||
if (info != null) {
|
|
||||||
color = info.getIconTint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isEsimLocked) {
|
|
||||||
msg = msg + " " + rez.getString(R.string.kg_sim_lock_instructions_esim);
|
|
||||||
}
|
|
||||||
mSecurityMessageDisplay.setMessage(msg);
|
|
||||||
mSimImageView.setImageTintList(ColorStateList.valueOf(color));
|
|
||||||
}
|
}
|
||||||
|
boolean isEsimLocked = KeyguardEsimArea.isEsimLocked(mContext, mSubId);
|
||||||
|
|
||||||
KeyguardEsimArea esimButton = findViewById(R.id.keyguard_esim_area);
|
KeyguardEsimArea esimButton = findViewById(R.id.keyguard_esim_area);
|
||||||
esimButton.setVisibility(isEsimLocked ? View.VISIBLE : View.GONE);
|
esimButton.setVisibility(isEsimLocked ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showDefaultMessage() {
|
||||||
|
if (mRemainingAttempts >= 0) {
|
||||||
|
mSecurityMessageDisplay.setMessage(getPinPasswordErrorMessage(
|
||||||
|
mRemainingAttempts, true));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isEsimLocked = KeyguardEsimArea.isEsimLocked(mContext, mSubId);
|
||||||
|
int count = TelephonyManager.getDefault().getSimCount();
|
||||||
|
Resources rez = getResources();
|
||||||
|
String msg;
|
||||||
|
int color = Color.WHITE;
|
||||||
|
if (count < 2) {
|
||||||
|
msg = rez.getString(R.string.kg_sim_pin_instructions);
|
||||||
|
} else {
|
||||||
|
SubscriptionInfo info = KeyguardUpdateMonitor.getInstance(mContext).
|
||||||
|
getSubscriptionInfoForSubId(mSubId);
|
||||||
|
CharSequence displayName = info != null ? info.getDisplayName() : ""; // don't crash
|
||||||
|
msg = rez.getString(R.string.kg_sim_pin_instructions_multi, displayName);
|
||||||
|
if (info != null) {
|
||||||
|
color = info.getIconTint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEsimLocked) {
|
||||||
|
msg = msg + " " + rez.getString(R.string.kg_sim_lock_instructions_esim);
|
||||||
|
}
|
||||||
|
|
||||||
|
mSecurityMessageDisplay.setMessage(msg);
|
||||||
|
mSimImageView.setImageTintList(ColorStateList.valueOf(color));
|
||||||
|
|
||||||
|
// Sending empty PIN here to query the number of remaining PIN attempts
|
||||||
|
new CheckSimPin("", mSubId) {
|
||||||
|
void onSimCheckResponse(final int result, final int attemptsRemaining) {
|
||||||
|
Log.d(LOG_TAG, "onSimCheckResponse " + " dummy One result" + result +
|
||||||
|
" attemptsRemaining=" + attemptsRemaining);
|
||||||
|
if (attemptsRemaining >= 0) {
|
||||||
|
mRemainingAttempts = attemptsRemaining;
|
||||||
|
mSecurityMessageDisplay.setMessage(
|
||||||
|
getPinPasswordErrorMessage(attemptsRemaining, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleSubInfoChangeIfNeeded() {
|
||||||
|
KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
|
||||||
|
int subId = monitor.getNextSubIdForState(IccCardConstants.State.PIN_REQUIRED);
|
||||||
|
if (subId != mSubId && SubscriptionManager.isValidSubscriptionId(subId)) {
|
||||||
|
mSubId = subId;
|
||||||
|
mShowDefaultMessage = true;
|
||||||
|
mRemainingAttempts = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
@@ -131,17 +173,19 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPinPasswordErrorMessage(int attemptsRemaining) {
|
private String getPinPasswordErrorMessage(int attemptsRemaining, boolean isDefault) {
|
||||||
String displayMessage;
|
String displayMessage;
|
||||||
|
int msgId;
|
||||||
if (attemptsRemaining == 0) {
|
if (attemptsRemaining == 0) {
|
||||||
displayMessage = getContext().getString(R.string.kg_password_wrong_pin_code_pukked);
|
displayMessage = getContext().getString(R.string.kg_password_wrong_pin_code_pukked);
|
||||||
} else if (attemptsRemaining > 0) {
|
} else if (attemptsRemaining > 0) {
|
||||||
|
msgId = isDefault ? R.plurals.kg_password_default_pin_message :
|
||||||
|
R.plurals.kg_password_wrong_pin_code;
|
||||||
displayMessage = getContext().getResources()
|
displayMessage = getContext().getResources()
|
||||||
.getQuantityString(R.plurals.kg_password_wrong_pin_code, attemptsRemaining,
|
.getQuantityString(msgId, attemptsRemaining, attemptsRemaining);
|
||||||
attemptsRemaining);
|
|
||||||
} else {
|
} else {
|
||||||
displayMessage = getContext().getString(R.string.kg_password_pin_failed);
|
msgId = isDefault ? R.string.kg_sim_pin_instructions : R.string.kg_password_pin_failed;
|
||||||
|
displayMessage = getContext().getString(msgId);
|
||||||
}
|
}
|
||||||
if (DEBUG) Log.d(LOG_TAG, "getPinPasswordErrorMessage:"
|
if (DEBUG) Log.d(LOG_TAG, "getPinPasswordErrorMessage:"
|
||||||
+ " attemptsRemaining=" + attemptsRemaining + " displayMessage=" + displayMessage);
|
+ " attemptsRemaining=" + attemptsRemaining + " displayMessage=" + displayMessage);
|
||||||
@@ -252,7 +296,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Dialog getSimRemainingAttemptsDialog(int remaining) {
|
private Dialog getSimRemainingAttemptsDialog(int remaining) {
|
||||||
String msg = getPinPasswordErrorMessage(remaining);
|
String msg = getPinPasswordErrorMessage(remaining, false);
|
||||||
if (mRemainingAttemptsDialog == null) {
|
if (mRemainingAttemptsDialog == null) {
|
||||||
Builder builder = new AlertDialog.Builder(mContext);
|
Builder builder = new AlertDialog.Builder(mContext);
|
||||||
builder.setMessage(msg);
|
builder.setMessage(msg);
|
||||||
@@ -288,6 +332,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
post(new Runnable() {
|
post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
mRemainingAttempts = attemptsRemaining;
|
||||||
if (mSimUnlockProgressDialog != null) {
|
if (mSimUnlockProgressDialog != null) {
|
||||||
mSimUnlockProgressDialog.hide();
|
mSimUnlockProgressDialog.hide();
|
||||||
}
|
}
|
||||||
@@ -296,8 +341,13 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
if (result == PhoneConstants.PIN_RESULT_SUCCESS) {
|
if (result == PhoneConstants.PIN_RESULT_SUCCESS) {
|
||||||
KeyguardUpdateMonitor.getInstance(getContext())
|
KeyguardUpdateMonitor.getInstance(getContext())
|
||||||
.reportSimUnlocked(mSubId);
|
.reportSimUnlocked(mSubId);
|
||||||
mCallback.dismiss(true, KeyguardUpdateMonitor.getCurrentUser());
|
mRemainingAttempts = -1;
|
||||||
|
mShowDefaultMessage = true;
|
||||||
|
if (mCallback != null) {
|
||||||
|
mCallback.dismiss(true, KeyguardUpdateMonitor.getCurrentUser());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
mShowDefaultMessage = false;
|
||||||
if (result == PhoneConstants.PIN_PASSWORD_INCORRECT) {
|
if (result == PhoneConstants.PIN_PASSWORD_INCORRECT) {
|
||||||
if (attemptsRemaining <= 2) {
|
if (attemptsRemaining <= 2) {
|
||||||
// this is getting critical - show dialog
|
// this is getting critical - show dialog
|
||||||
@@ -305,7 +355,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView {
|
|||||||
} else {
|
} else {
|
||||||
// show message
|
// show message
|
||||||
mSecurityMessageDisplay.setMessage(
|
mSecurityMessageDisplay.setMessage(
|
||||||
getPinPasswordErrorMessage(attemptsRemaining));
|
getPinPasswordErrorMessage(attemptsRemaining, false));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// "PIN operation failed!" - no idea what this was and no way to
|
// "PIN operation failed!" - no idea what this was and no way to
|
||||||
|
|||||||
@@ -52,11 +52,17 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
|
|||||||
|
|
||||||
private ProgressDialog mSimUnlockProgressDialog = null;
|
private ProgressDialog mSimUnlockProgressDialog = null;
|
||||||
private CheckSimPuk mCheckSimPukThread;
|
private CheckSimPuk mCheckSimPukThread;
|
||||||
|
|
||||||
|
// Below flag is set to true during power-up or when a new SIM card inserted on device.
|
||||||
|
// When this is true and when SIM card is PUK locked state, on PIN lock screen, message would
|
||||||
|
// be displayed to inform user about the number of remaining PUK attempts left.
|
||||||
|
private boolean mShowDefaultMessage = true;
|
||||||
|
private int mRemainingAttempts = -1;
|
||||||
private String mPukText;
|
private String mPukText;
|
||||||
private String mPinText;
|
private String mPinText;
|
||||||
private StateMachine mStateMachine = new StateMachine();
|
private StateMachine mStateMachine = new StateMachine();
|
||||||
private AlertDialog mRemainingAttemptsDialog;
|
private AlertDialog mRemainingAttemptsDialog;
|
||||||
private int mSubId;
|
private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||||
private ImageView mSimImageView;
|
private ImageView mSimImageView;
|
||||||
|
|
||||||
KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() {
|
KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() {
|
||||||
@@ -132,34 +138,17 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
mPinText="";
|
mPinText="";
|
||||||
mPukText="";
|
mPukText="";
|
||||||
state = ENTER_PUK;
|
state = ENTER_PUK;
|
||||||
KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
|
handleSubInfoChangeIfNeeded();
|
||||||
mSubId = monitor.getNextSubIdForState(IccCardConstants.State.PUK_REQUIRED);
|
if (mShowDefaultMessage) {
|
||||||
boolean isEsimLocked = KeyguardEsimArea.isEsimLocked(mContext, mSubId);
|
showDefaultMessage();
|
||||||
if (SubscriptionManager.isValidSubscriptionId(mSubId)) {
|
|
||||||
int count = TelephonyManager.getDefault().getSimCount();
|
|
||||||
Resources rez = getResources();
|
|
||||||
String msg;
|
|
||||||
int color = Color.WHITE;
|
|
||||||
if (count < 2) {
|
|
||||||
msg = rez.getString(R.string.kg_puk_enter_puk_hint);
|
|
||||||
} else {
|
|
||||||
SubscriptionInfo info = monitor.getSubscriptionInfoForSubId(mSubId);
|
|
||||||
CharSequence displayName = info != null ? info.getDisplayName() : "";
|
|
||||||
msg = rez.getString(R.string.kg_puk_enter_puk_hint_multi, displayName);
|
|
||||||
if (info != null) {
|
|
||||||
color = info.getIconTint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isEsimLocked) {
|
|
||||||
msg = msg + " " + rez.getString(R.string.kg_sim_lock_instructions_esim);
|
|
||||||
}
|
|
||||||
mSecurityMessageDisplay.setMessage(msg);
|
|
||||||
mSimImageView.setImageTintList(ColorStateList.valueOf(color));
|
|
||||||
}
|
}
|
||||||
|
boolean isEsimLocked = KeyguardEsimArea.isEsimLocked(mContext, mSubId);
|
||||||
|
|
||||||
KeyguardEsimArea esimButton = findViewById(R.id.keyguard_esim_area);
|
KeyguardEsimArea esimButton = findViewById(R.id.keyguard_esim_area);
|
||||||
esimButton.setVisibility(isEsimLocked ? View.VISIBLE : View.GONE);
|
esimButton.setVisibility(isEsimLocked ? View.VISIBLE : View.GONE);
|
||||||
mPasswordEntry.requestFocus();
|
mPasswordEntry.requestFocus();
|
||||||
@@ -168,23 +157,79 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showDefaultMessage() {
|
||||||
|
if (mRemainingAttempts >= 0) {
|
||||||
|
mSecurityMessageDisplay.setMessage(getPukPasswordErrorMessage(
|
||||||
|
mRemainingAttempts, true));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isEsimLocked = KeyguardEsimArea.isEsimLocked(mContext, mSubId);
|
||||||
|
int count = TelephonyManager.getDefault().getSimCount();
|
||||||
|
Resources rez = getResources();
|
||||||
|
String msg;
|
||||||
|
int color = Color.WHITE;
|
||||||
|
if (count < 2) {
|
||||||
|
msg = rez.getString(R.string.kg_puk_enter_puk_hint);
|
||||||
|
} else {
|
||||||
|
SubscriptionInfo info = KeyguardUpdateMonitor.getInstance(mContext).
|
||||||
|
getSubscriptionInfoForSubId(mSubId);
|
||||||
|
CharSequence displayName = info != null ? info.getDisplayName() : "";
|
||||||
|
msg = rez.getString(R.string.kg_puk_enter_puk_hint_multi, displayName);
|
||||||
|
if (info != null) {
|
||||||
|
color = info.getIconTint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isEsimLocked) {
|
||||||
|
msg = msg + " " + rez.getString(R.string.kg_sim_lock_instructions_esim);
|
||||||
|
}
|
||||||
|
mSecurityMessageDisplay.setMessage(msg);
|
||||||
|
mSimImageView.setImageTintList(ColorStateList.valueOf(color));
|
||||||
|
|
||||||
|
// Sending empty PUK here to query the number of remaining PIN attempts
|
||||||
|
new CheckSimPuk("", "", mSubId) {
|
||||||
|
void onSimLockChangedResponse(final int result, final int attemptsRemaining) {
|
||||||
|
Log.d(LOG_TAG, "onSimCheckResponse " + " dummy One result" + result +
|
||||||
|
" attemptsRemaining=" + attemptsRemaining);
|
||||||
|
if (attemptsRemaining >= 0) {
|
||||||
|
mRemainingAttempts = attemptsRemaining;
|
||||||
|
mSecurityMessageDisplay.setMessage(
|
||||||
|
getPukPasswordErrorMessage(attemptsRemaining, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleSubInfoChangeIfNeeded() {
|
||||||
|
KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
|
||||||
|
int subId = monitor.getNextSubIdForState(IccCardConstants.State.PUK_REQUIRED);
|
||||||
|
if (subId != mSubId && SubscriptionManager.isValidSubscriptionId(subId)) {
|
||||||
|
mSubId = subId;
|
||||||
|
mShowDefaultMessage = true;
|
||||||
|
mRemainingAttempts = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getPromtReasonStringRes(int reason) {
|
protected int getPromtReasonStringRes(int reason) {
|
||||||
// No message on SIM Puk
|
// No message on SIM Puk
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPukPasswordErrorMessage(int attemptsRemaining) {
|
private String getPukPasswordErrorMessage(int attemptsRemaining, boolean isDefault) {
|
||||||
String displayMessage;
|
String displayMessage;
|
||||||
|
|
||||||
if (attemptsRemaining == 0) {
|
if (attemptsRemaining == 0) {
|
||||||
displayMessage = getContext().getString(R.string.kg_password_wrong_puk_code_dead);
|
displayMessage = getContext().getString(R.string.kg_password_wrong_puk_code_dead);
|
||||||
} else if (attemptsRemaining > 0) {
|
} else if (attemptsRemaining > 0) {
|
||||||
|
int msgId = isDefault ? R.plurals.kg_password_default_puk_message :
|
||||||
|
R.plurals.kg_password_wrong_puk_code;
|
||||||
displayMessage = getContext().getResources()
|
displayMessage = getContext().getResources()
|
||||||
.getQuantityString(R.plurals.kg_password_wrong_puk_code, attemptsRemaining,
|
.getQuantityString(msgId, attemptsRemaining, attemptsRemaining);
|
||||||
attemptsRemaining);
|
|
||||||
} else {
|
} else {
|
||||||
displayMessage = getContext().getString(R.string.kg_password_puk_failed);
|
int msgId = isDefault ? R.string.kg_puk_enter_puk_hint :
|
||||||
|
R.string.kg_password_puk_failed;
|
||||||
|
displayMessage = getContext().getString(msgId);
|
||||||
}
|
}
|
||||||
if (DEBUG) Log.d(LOG_TAG, "getPukPasswordErrorMessage:"
|
if (DEBUG) Log.d(LOG_TAG, "getPukPasswordErrorMessage:"
|
||||||
+ " attemptsRemaining=" + attemptsRemaining + " displayMessage=" + displayMessage);
|
+ " attemptsRemaining=" + attemptsRemaining + " displayMessage=" + displayMessage);
|
||||||
@@ -303,7 +348,7 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Dialog getPukRemainingAttemptsDialog(int remaining) {
|
private Dialog getPukRemainingAttemptsDialog(int remaining) {
|
||||||
String msg = getPukPasswordErrorMessage(remaining);
|
String msg = getPukPasswordErrorMessage(remaining, false);
|
||||||
if (mRemainingAttemptsDialog == null) {
|
if (mRemainingAttemptsDialog == null) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
|
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
|
||||||
builder.setMessage(msg);
|
builder.setMessage(msg);
|
||||||
@@ -359,16 +404,25 @@ public class KeyguardSimPukView extends KeyguardPinBasedInputView {
|
|||||||
if (result == PhoneConstants.PIN_RESULT_SUCCESS) {
|
if (result == PhoneConstants.PIN_RESULT_SUCCESS) {
|
||||||
KeyguardUpdateMonitor.getInstance(getContext())
|
KeyguardUpdateMonitor.getInstance(getContext())
|
||||||
.reportSimUnlocked(mSubId);
|
.reportSimUnlocked(mSubId);
|
||||||
mCallback.dismiss(true, KeyguardUpdateMonitor.getCurrentUser());
|
mRemainingAttempts = -1;
|
||||||
|
mShowDefaultMessage = true;
|
||||||
|
if (mCallback != null) {
|
||||||
|
mCallback.dismiss(true, KeyguardUpdateMonitor.getCurrentUser());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
mShowDefaultMessage = false;
|
||||||
if (result == PhoneConstants.PIN_PASSWORD_INCORRECT) {
|
if (result == PhoneConstants.PIN_PASSWORD_INCORRECT) {
|
||||||
|
// show message
|
||||||
|
mSecurityMessageDisplay.setMessage(getPukPasswordErrorMessage(
|
||||||
|
attemptsRemaining, false));
|
||||||
if (attemptsRemaining <= 2) {
|
if (attemptsRemaining <= 2) {
|
||||||
// this is getting critical - show dialog
|
// this is getting critical - show dialog
|
||||||
getPukRemainingAttemptsDialog(attemptsRemaining).show();
|
getPukRemainingAttemptsDialog(attemptsRemaining).show();
|
||||||
} else {
|
} else {
|
||||||
// show message
|
// show message
|
||||||
mSecurityMessageDisplay.setMessage(
|
mSecurityMessageDisplay.setMessage(
|
||||||
getPukPasswordErrorMessage(attemptsRemaining));
|
getPukPasswordErrorMessage(
|
||||||
|
attemptsRemaining, false));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mSecurityMessageDisplay.setMessage(getContext().getString(
|
mSecurityMessageDisplay.setMessage(getContext().getString(
|
||||||
|
|||||||
Reference in New Issue
Block a user