Methods Summary |
---|
private boolean | checkPin()
// make sure the PIN is between 4 and 8 digits
int length = mPasswordEntry.getText().length();
if (length >= 4 && length <= 8) {
mPinText = mPasswordEntry.getText();
return true;
}
return false;
|
private boolean | checkPuk()
// make sure the puk is at least 8 digits long.
if (mPasswordEntry.getText().length() == 8) {
mPukText = mPasswordEntry.getText();
return true;
}
return false;
|
public boolean | confirmPin()
return mPinText.equals(mPasswordEntry.getText());
|
protected int | getPasswordTextViewId()
return R.id.pukEntry;
|
private java.lang.String | getPukPasswordErrorMessage(int attemptsRemaining)
String displayMessage;
if (attemptsRemaining == 0) {
displayMessage = getContext().getString(R.string.kg_password_wrong_puk_code_dead);
} else if (attemptsRemaining > 0) {
displayMessage = getContext().getResources()
.getQuantityString(R.plurals.kg_password_wrong_puk_code, attemptsRemaining,
attemptsRemaining);
} else {
displayMessage = getContext().getString(R.string.kg_password_puk_failed);
}
if (DEBUG) Log.d(LOG_TAG, "getPukPasswordErrorMessage:"
+ " attemptsRemaining=" + attemptsRemaining + " displayMessage=" + displayMessage);
return displayMessage;
|
private android.app.Dialog | getPukRemainingAttemptsDialog(int remaining)
String msg = getPukPasswordErrorMessage(remaining);
if (mRemainingAttemptsDialog == null) {
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setMessage(msg);
builder.setCancelable(false);
builder.setNeutralButton(R.string.ok, null);
mRemainingAttemptsDialog = builder.create();
mRemainingAttemptsDialog.getWindow().setType(
WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
} else {
mRemainingAttemptsDialog.setMessage(msg);
}
return mRemainingAttemptsDialog;
|
private android.app.Dialog | getSimUnlockProgressDialog()
if (mSimUnlockProgressDialog == null) {
mSimUnlockProgressDialog = new ProgressDialog(mContext);
mSimUnlockProgressDialog.setMessage(
mContext.getString(R.string.kg_sim_unlock_progress_dialog_message));
mSimUnlockProgressDialog.setIndeterminate(true);
mSimUnlockProgressDialog.setCancelable(false);
if (!(mContext instanceof Activity)) {
mSimUnlockProgressDialog.getWindow().setType(
WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
}
}
return mSimUnlockProgressDialog;
|
protected void | onAttachedToWindow()
super.onAttachedToWindow();
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback);
|
protected void | onDetachedFromWindow()
super.onDetachedFromWindow();
KeyguardUpdateMonitor.getInstance(mContext).removeCallback(mUpdateMonitorCallback);
|
protected void | onFinishInflate()
super.onFinishInflate();
mSecurityMessageDisplay.setTimeout(0); // don't show ownerinfo/charging status by default
if (mEcaView instanceof EmergencyCarrierArea) {
((EmergencyCarrierArea) mEcaView).setCarrierTextVisible(true);
}
mSimImageView = (ImageView) findViewById(R.id.keyguard_sim);
|
public void | onPause()
// dismiss the dialog.
if (mSimUnlockProgressDialog != null) {
mSimUnlockProgressDialog.dismiss();
mSimUnlockProgressDialog = null;
}
|
public void | resetState()
super.resetState();
mStateMachine.reset();
|
protected boolean | shouldLockout(long deadline)
// SIM PUK doesn't have a timed lockout
return false;
|
public void | showUsabilityHint()
|
public void | startAppearAnimation()
// noop.
|
public boolean | startDisappearAnimation(java.lang.Runnable finishRunnable)
return false;
|
private void | updateSim()
getSimUnlockProgressDialog().show();
if (mCheckSimPukThread == null) {
mCheckSimPukThread = new CheckSimPuk(mPukText, mPinText, mSubId) {
void onSimLockChangedResponse(final int result, final int attemptsRemaining) {
post(new Runnable() {
public void run() {
if (mSimUnlockProgressDialog != null) {
mSimUnlockProgressDialog.hide();
}
resetPasswordText(true /* animate */);
if (result == PhoneConstants.PIN_RESULT_SUCCESS) {
KeyguardUpdateMonitor.getInstance(getContext())
.reportSimUnlocked(mSubId);
mCallback.dismiss(true);
} else {
if (result == PhoneConstants.PIN_PASSWORD_INCORRECT) {
if (attemptsRemaining <= 2) {
// this is getting critical - show dialog
getPukRemainingAttemptsDialog(attemptsRemaining).show();
} else {
// show message
mSecurityMessageDisplay.setMessage(
getPukPasswordErrorMessage(attemptsRemaining), true);
}
} else {
mSecurityMessageDisplay.setMessage(getContext().getString(
R.string.kg_password_puk_failed), true);
}
if (DEBUG) Log.d(LOG_TAG, "verifyPasswordAndUnlock "
+ " UpdateSim.onSimCheckResponse: "
+ " attemptsRemaining=" + attemptsRemaining);
mStateMachine.reset();
}
mCheckSimPukThread = null;
}
});
}
};
mCheckSimPukThread.start();
}
|
protected void | verifyPasswordAndUnlock()
mStateMachine.next();
|