Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 568513d3 authored by Wink Saville's avatar Wink Saville Committed by Android Git Automerger
Browse files

am 4bc35650: am 604cfc2d: Merge "Enhance pin/puk support" into klp-dev

* commit '4bc35650':
  Enhance pin/puk support
parents b5c9c9be 4bc35650
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -97,6 +97,13 @@
         the SIM card. -->
         the SIM card. -->
    <string name="needPuk">Your SIM card is PUK-locked. Type the PUK code to unlock it.</string>
    <string name="needPuk">Your SIM card is PUK-locked. Type the PUK code to unlock it.</string>
    <string name="needPuk2">Type PUK2 to unblock SIM card.</string>
    <string name="needPuk2">Type PUK2 to unblock SIM card.</string>
    <!-- Displayed when user attempts to change SIM PIN1 without enabling PIN1. -->
    <string name="enablePin">Unsuccessful, enable SIM/RUIM Lock.</string>
    <!-- Displayed when a SIM PIN/PUK is entered incorrectly. -->
    <plurals name="pinpuk_attempts">
        <item quantity="one">You have <xliff:g id="number">%d</xliff:g> remaining attempt before SIM is locked.</item>
        <item quantity="other">You have <xliff:g id="number">%d</xliff:g> remaining attempts before SIM is locked.</item>
    </plurals>
    <!-- Title for the dialog used to display the user's IMEI number [CHAR LIMIT=10] -->
    <!-- Title for the dialog used to display the user's IMEI number [CHAR LIMIT=10] -->
    <string name="imei">IMEI</string>
    <string name="imei">IMEI</string>


+2 −0
Original line number Original line Diff line number Diff line
@@ -612,6 +612,7 @@
  <java-symbol type="string" name="more_item_label" />
  <java-symbol type="string" name="more_item_label" />
  <java-symbol type="string" name="needPuk" />
  <java-symbol type="string" name="needPuk" />
  <java-symbol type="string" name="needPuk2" />
  <java-symbol type="string" name="needPuk2" />
  <java-symbol type="string" name="enablePin" />
  <java-symbol type="string" name="new_app_action" />
  <java-symbol type="string" name="new_app_action" />
  <java-symbol type="string" name="new_app_description" />
  <java-symbol type="string" name="new_app_description" />
  <java-symbol type="string" name="noApplications" />
  <java-symbol type="string" name="noApplications" />
@@ -965,6 +966,7 @@
  <java-symbol type="plurals" name="num_minutes_ago" />
  <java-symbol type="plurals" name="num_minutes_ago" />
  <java-symbol type="plurals" name="num_seconds_ago" />
  <java-symbol type="plurals" name="num_seconds_ago" />
  <java-symbol type="plurals" name="restr_pin_countdown" />
  <java-symbol type="plurals" name="restr_pin_countdown" />
  <java-symbol type="plurals" name="pinpuk_attempts" />


  <java-symbol type="array" name="carrier_properties" />
  <java-symbol type="array" name="carrier_properties" />
  <java-symbol type="array" name="config_data_usage_network_types" />
  <java-symbol type="array" name="config_data_usage_network_types" />
+31 −5
Original line number Original line Diff line number Diff line
@@ -24,12 +24,12 @@


    <!-- Instructions telling the user to enter their SIM PUK to unlock the keyguard.
    <!-- Instructions telling the user to enter their SIM PUK to unlock the keyguard.
         Displayed in one line in a large font.  -->
         Displayed in one line in a large font.  -->
    <string name="keyguard_password_enter_puk_code">Type PUK and new PIN code</string>
    <string name="keyguard_password_enter_puk_code">Type SIM PUK and new PIN code</string>


    <!-- Prompt to enter SIM PUK in Edit Text Box in unlock screen -->
    <!-- Prompt to enter SIM PUK in Edit Text Box in unlock screen -->
    <string name="keyguard_password_enter_puk_prompt">PUK code</string>
    <string name="keyguard_password_enter_puk_prompt">SIM PUK code</string>
    <!-- Prompt to enter New SIM PIN in Edit Text Box in unlock screen -->
    <!-- Prompt to enter New SIM PIN in Edit Text Box in unlock screen -->
    <string name="keyguard_password_enter_pin_prompt">New PIN code</string>
    <string name="keyguard_password_enter_pin_prompt">New SIM PIN code</string>


    <!-- Displayed as hint in passwordEntry EditText on PasswordUnlockScreen [CHAR LIMIT=30]-->
    <!-- Displayed as hint in passwordEntry EditText on PasswordUnlockScreen [CHAR LIMIT=30]-->
    <string name="keyguard_password_entry_touch_hint"><font size="17">Touch to type password</font></string>
    <string name="keyguard_password_entry_touch_hint"><font size="17">Touch to type password</font></string>
@@ -249,8 +249,6 @@
    <string name="kg_enter_confirm_pin_hint">Confirm desired PIN code</string>
    <string name="kg_enter_confirm_pin_hint">Confirm desired PIN code</string>
    <!-- Message shown in dialog while the device is unlocking the SIM card -->
    <!-- Message shown in dialog while the device is unlocking the SIM card -->
    <string name="kg_sim_unlock_progress_dialog_message">Unlocking SIM card\u2026</string>
    <string name="kg_sim_unlock_progress_dialog_message">Unlocking SIM card\u2026</string>
    <!-- Message shown when the user enters the wrong PIN code -->
    <string name="kg_password_wrong_pin_code">Incorrect PIN code.</string>
    <!-- Message shown when the user enters an invalid SIM pin password in PUK screen -->
    <!-- Message shown when the user enters an invalid SIM pin password in PUK screen -->
    <string name="kg_invalid_sim_pin_hint">Type a PIN that is 4 to 8 numbers.</string>
    <string name="kg_invalid_sim_pin_hint">Type a PIN that is 4 to 8 numbers.</string>
    <!-- Message shown when the user enters an invalid PUK code in the PUK screen -->
    <!-- Message shown when the user enters an invalid PUK code in the PUK screen -->
@@ -333,6 +331,34 @@
    <!-- The delete-widget drop target button text -->
    <!-- The delete-widget drop target button text -->
    <string name="kg_reordering_delete_drop_target_text">Remove</string>
    <string name="kg_reordering_delete_drop_target_text">Remove</string>


    <!-- Instructions telling the user that they entered the wrong SIM PIN for the last time.
         Displayed in a dialog box.  -->
    <string name="kg_password_wrong_pin_code_pukked">Incorrect SIM PIN code you must now contact your carrier to unlock your device.</string>
    <!-- Instructions telling the user that they entered the wrong SIM PIN while trying
         to unlock the keyguard.  Displayed in a dialog box.  -->
    <plurals name="kg_password_wrong_pin_code">
        <item quantity="one">Incorrect SIM PIN code, 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">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempts.</item>
    </plurals>

    <!-- Instructions telling the user that they have exhausted SIM PUK retries and the SIM is now unusable.
         Displayed in a dialog box.  -->
    <string name="kg_password_wrong_puk_code_dead">SIM is unusable. Contact your carrier.</string>
    <!-- Instructions telling the user that they entered the wrong puk while trying
         to unlock the keyguard.  Displayed in a dialog box.  -->
    <plurals name="kg_password_wrong_puk_code">
        <item quantity="one">Incorrect SIM PUK code, you have <xliff:g id="number">%d</xliff:g> remaining attempt before SIM becomes permanently unusable.</item>
        <item quantity="other">Incorrect SIM PUK code, you have <xliff:g id="number">%d</xliff:g> remaining attempts before SIM becomes permanently unusable.</item>
    </plurals>
    <!-- Instructions telling the user that the operation to unlock the keyguard
         with SIM PIN failed. Displayed in one line in a large font.  -->
    <string name="kg_password_pin_failed">SIM PIN operation failed!</string>
    <!-- Instructions telling the user that the operation to unlock the keyguard
         with PUK failed. Displayed in one line in a large font.  -->
    <string name="kg_password_puk_failed">SIM PUK operation failed!</string>
    <!-- Notification telling the user that the PIN1 they entered is valid -->
    <string name="kg_pin_accepted">Code Accepted!</string>

    <!-- Transport control strings -->
    <!-- Transport control strings -->
    <!-- Shown on transport control of lockscreen. Pressing button goes to previous track. -->
    <!-- Shown on transport control of lockscreen. Pressing button goes to previous track. -->
    <string name="keyguard_transport_prev_description">Previous track button</string>
    <string name="keyguard_transport_prev_description">Previous track button</string>
+72 −15
Original line number Original line Diff line number Diff line
@@ -17,11 +17,16 @@
package com.android.keyguard;
package com.android.keyguard;


import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.PhoneConstants;


import android.content.Context;
import android.content.Context;
import android.content.DialogInterface;
import android.app.Activity;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.app.ProgressDialog;
import android.os.Message;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.text.Editable;
import android.text.Editable;
@@ -30,6 +35,7 @@ import android.text.TextWatcher;
import android.text.method.DigitsKeyListener;
import android.text.method.DigitsKeyListener;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.view.View;
import android.view.View;
import android.util.Log;
import android.view.WindowManager;
import android.view.WindowManager;
import android.widget.TextView.OnEditorActionListener;
import android.widget.TextView.OnEditorActionListener;


@@ -38,10 +44,14 @@ import android.widget.TextView.OnEditorActionListener;
 */
 */
public class KeyguardSimPinView extends KeyguardAbsKeyInputView
public class KeyguardSimPinView extends KeyguardAbsKeyInputView
        implements KeyguardSecurityView, OnEditorActionListener, TextWatcher {
        implements KeyguardSecurityView, OnEditorActionListener, TextWatcher {
    private static final String LOG_TAG = "KeyguardSimPinView";
    private static final boolean DEBUG = KeyguardViewMediator.DEBUG;


    private ProgressDialog mSimUnlockProgressDialog = null;
    private ProgressDialog mSimUnlockProgressDialog = null;
    private volatile boolean mSimCheckInProgress;
    private volatile boolean mSimCheckInProgress;


    private AlertDialog mRemainingAttemptsDialog;

    public KeyguardSimPinView(Context context) {
    public KeyguardSimPinView(Context context) {
        this(context, null);
        this(context, null);
    }
    }
@@ -55,6 +65,23 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
        mPasswordEntry.setEnabled(true);
        mPasswordEntry.setEnabled(true);
    }
    }


    private String getPinPasswordErrorMessage(int attemptsRemaining) {
        String displayMessage;

        if (attemptsRemaining == 0) {
            displayMessage = getContext().getString(R.string.kg_password_wrong_pin_code_pukked);
        } else if (attemptsRemaining > 0) {
            displayMessage = getContext().getResources()
                    .getQuantityString(R.plurals.kg_password_wrong_pin_code, attemptsRemaining,
                            attemptsRemaining);
        } else {
            displayMessage = getContext().getString(R.string.kg_password_pin_failed);
        }
        if (DEBUG) Log.d(LOG_TAG, "getPinPasswordErrorMessage:"
                + " attemptsRemaining=" + attemptsRemaining + " displayMessage=" + displayMessage);
        return displayMessage;
    }

    @Override
    @Override
    protected boolean shouldLockout(long deadline) {
    protected boolean shouldLockout(long deadline) {
        // SIM PIN doesn't have a timed lockout
        // SIM PIN doesn't have a timed lockout
@@ -109,6 +136,8 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
                | InputType.TYPE_NUMBER_VARIATION_PASSWORD);
                | InputType.TYPE_NUMBER_VARIATION_PASSWORD);


        mPasswordEntry.requestFocus();
        mPasswordEntry.requestFocus();

        mSecurityMessageDisplay.setTimeout(0); // don't show ownerinfo/charging status by default
    }
    }


    @Override
    @Override
@@ -135,22 +164,22 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
            mPin = pin;
            mPin = pin;
        }
        }


        abstract void onSimCheckResponse(boolean success);
        abstract void onSimCheckResponse(final int result, final int attemptsRemaining);


        @Override
        @Override
        public void run() {
        public void run() {
            try {
            try {
                final boolean result = ITelephony.Stub.asInterface(ServiceManager
                final int[] result = ITelephony.Stub.asInterface(ServiceManager
                        .checkService("phone")).supplyPin(mPin);
                        .checkService("phone")).supplyPinReportResult(mPin);
                post(new Runnable() {
                post(new Runnable() {
                    public void run() {
                    public void run() {
                        onSimCheckResponse(result);
                        onSimCheckResponse(result[0], result[1]);
                    }
                    }
                });
                });
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                post(new Runnable() {
                post(new Runnable() {
                    public void run() {
                    public void run() {
                        onSimCheckResponse(false);
                        onSimCheckResponse(PhoneConstants.PIN_GENERAL_FAILURE, -1);
                    }
                    }
                });
                });
            }
            }
@@ -164,14 +193,28 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
                    mContext.getString(R.string.kg_sim_unlock_progress_dialog_message));
                    mContext.getString(R.string.kg_sim_unlock_progress_dialog_message));
            mSimUnlockProgressDialog.setIndeterminate(true);
            mSimUnlockProgressDialog.setIndeterminate(true);
            mSimUnlockProgressDialog.setCancelable(false);
            mSimUnlockProgressDialog.setCancelable(false);
            if (!(mContext instanceof Activity)) {
            mSimUnlockProgressDialog.getWindow().setType(
            mSimUnlockProgressDialog.getWindow().setType(
                    WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
                    WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
        }
        }
        }
        return mSimUnlockProgressDialog;
        return mSimUnlockProgressDialog;
    }
    }


    private Dialog getSimRemainingAttemptsDialog(int remaining) {
        String msg = getPinPasswordErrorMessage(remaining);
        if (mRemainingAttemptsDialog == null) {
            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;
    }

    @Override
    @Override
    protected void verifyPasswordAndUnlock() {
    protected void verifyPasswordAndUnlock() {
        String entry = mPasswordEntry.getText().toString();
        String entry = mPasswordEntry.getText().toString();
@@ -189,20 +232,34 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
        if (!mSimCheckInProgress) {
        if (!mSimCheckInProgress) {
            mSimCheckInProgress = true; // there should be only one
            mSimCheckInProgress = true; // there should be only one
            new CheckSimPin(mPasswordEntry.getText().toString()) {
            new CheckSimPin(mPasswordEntry.getText().toString()) {
                void onSimCheckResponse(final boolean success) {
                void onSimCheckResponse(final int result, final int attemptsRemaining) {
                    post(new Runnable() {
                    post(new Runnable() {
                        public void run() {
                        public void run() {
                            if (mSimUnlockProgressDialog != null) {
                            if (mSimUnlockProgressDialog != null) {
                                mSimUnlockProgressDialog.hide();
                                mSimUnlockProgressDialog.hide();
                            }
                            }
                            if (success) {
                            if (result == PhoneConstants.PIN_RESULT_SUCCESS) {
                                // before closing the keyguard, report back that the sim is unlocked
                                // so it knows right away.
                                KeyguardUpdateMonitor.getInstance(getContext()).reportSimUnlocked();
                                KeyguardUpdateMonitor.getInstance(getContext()).reportSimUnlocked();
                                mCallback.dismiss(true);
                                mCallback.dismiss(true);
                            } else {
                            } else {
                                mSecurityMessageDisplay.setMessage
                                if (result == PhoneConstants.PIN_PASSWORD_INCORRECT) {
                                    (R.string.kg_password_wrong_pin_code, true);
                                    if (attemptsRemaining <= 2) {
                                        // this is getting critical - show dialog
                                        getSimRemainingAttemptsDialog(attemptsRemaining).show();
                                    } else {
                                        // show message
                                        mSecurityMessageDisplay.setMessage(
                                                getPinPasswordErrorMessage(attemptsRemaining), true);
                                    }
                                } else {
                                    // "PIN operation failed!" - no idea what this was and no way to
                                    // find out. :/
                                    mSecurityMessageDisplay.setMessage(getContext().getString(
                                            R.string.kg_password_pin_failed), true);
                                }
                                if (DEBUG) Log.d(LOG_TAG, "verifyPasswordAndUnlock "
                                        + " CheckSimPin.onSimCheckResponse: " + result
                                        + " attemptsRemaining=" + attemptsRemaining);
                                mPasswordEntry.setText("");
                                mPasswordEntry.setText("");
                            }
                            }
                            mCallback.userActivity(0);
                            mCallback.userActivity(0);
+67 −10
Original line number Original line Diff line number Diff line
@@ -16,10 +16,10 @@


package com.android.keyguard;
package com.android.keyguard;


import com.android.internal.telephony.ITelephony;

import android.content.Context;
import android.content.Context;
import android.animation.AnimatorSet.Builder;
import android.app.Activity;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.app.ProgressDialog;
import android.os.RemoteException;
import android.os.RemoteException;
@@ -29,21 +29,29 @@ import android.text.InputType;
import android.text.TextWatcher;
import android.text.TextWatcher;
import android.text.method.DigitsKeyListener;
import android.text.method.DigitsKeyListener;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowManager;
import android.widget.TextView.OnEditorActionListener;
import android.widget.TextView.OnEditorActionListener;


import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.PhoneConstants;


/**
/**
 * Displays a PIN pad for entering a PUK (Pin Unlock Kode) provided by a carrier.
 * Displays a PIN pad for entering a PUK (Pin Unlock Kode) provided by a carrier.
 */
 */
public class KeyguardSimPukView extends KeyguardAbsKeyInputView
public class KeyguardSimPukView extends KeyguardAbsKeyInputView
        implements KeyguardSecurityView, OnEditorActionListener, TextWatcher {
        implements KeyguardSecurityView, OnEditorActionListener, TextWatcher {
    private static final String LOG_TAG = "KeyguardSimPukView";
    private static final boolean DEBUG = KeyguardViewMediator.DEBUG;


    private ProgressDialog mSimUnlockProgressDialog = null;
    private ProgressDialog mSimUnlockProgressDialog = null;
    private volatile boolean mCheckInProgress;
    private volatile boolean mCheckInProgress;
    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 class StateMachine {
    private class StateMachine {
        final int ENTER_PUK = 0;
        final int ENTER_PUK = 0;
@@ -93,6 +101,23 @@ public class KeyguardSimPukView extends KeyguardAbsKeyInputView
        }
        }
    }
    }


    private 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;
    }

    public KeyguardSimPukView(Context context) {
    public KeyguardSimPukView(Context context) {
        this(context, null);
        this(context, null);
    }
    }
@@ -190,23 +215,23 @@ public class KeyguardSimPukView extends KeyguardAbsKeyInputView
            mPin = pin;
            mPin = pin;
        }
        }


        abstract void onSimLockChangedResponse(boolean success);
        abstract void onSimLockChangedResponse(final int result, final int attemptsRemaining);


        @Override
        @Override
        public void run() {
        public void run() {
            try {
            try {
                final boolean result = ITelephony.Stub.asInterface(ServiceManager
                final int[] result = ITelephony.Stub.asInterface(ServiceManager
                        .checkService("phone")).supplyPuk(mPuk, mPin);
                        .checkService("phone")).supplyPukReportResult(mPuk, mPin);


                post(new Runnable() {
                post(new Runnable() {
                    public void run() {
                    public void run() {
                        onSimLockChangedResponse(result);
                        onSimLockChangedResponse(result[0], result[1]);
                    }
                    }
                });
                });
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                post(new Runnable() {
                post(new Runnable() {
                    public void run() {
                    public void run() {
                        onSimLockChangedResponse(false);
                        onSimLockChangedResponse(PhoneConstants.PIN_GENERAL_FAILURE, -1);
                    }
                    }
                });
                });
            }
            }
@@ -228,6 +253,22 @@ public class KeyguardSimPukView extends KeyguardAbsKeyInputView
        return mSimUnlockProgressDialog;
        return mSimUnlockProgressDialog;
    }
    }


    private 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 boolean checkPuk() {
    private boolean checkPuk() {
        // make sure the puk is at least 8 digits long.
        // make sure the puk is at least 8 digits long.
        if (mPasswordEntry.getText().length() >= 8) {
        if (mPasswordEntry.getText().length() >= 8) {
@@ -257,17 +298,33 @@ public class KeyguardSimPukView extends KeyguardAbsKeyInputView
        if (!mCheckInProgress) {
        if (!mCheckInProgress) {
            mCheckInProgress = true;
            mCheckInProgress = true;
            new CheckSimPuk(mPukText, mPinText) {
            new CheckSimPuk(mPukText, mPinText) {
                void onSimLockChangedResponse(final boolean success) {
                void onSimLockChangedResponse(final int result, final int attemptsRemaining) {
                    post(new Runnable() {
                    post(new Runnable() {
                        public void run() {
                        public void run() {
                            if (mSimUnlockProgressDialog != null) {
                            if (mSimUnlockProgressDialog != null) {
                                mSimUnlockProgressDialog.hide();
                                mSimUnlockProgressDialog.hide();
                            }
                            }
                            if (success) {
                            if (result == PhoneConstants.PIN_RESULT_SUCCESS) {
                                KeyguardUpdateMonitor.getInstance(getContext()).reportSimUnlocked();
                                mCallback.dismiss(true);
                                mCallback.dismiss(true);
                            } else {
                            } 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();
                                mStateMachine.reset();
                                mSecurityMessageDisplay.setMessage(R.string.kg_invalid_puk, true);
                            }
                            }
                            mCheckInProgress = false;
                            mCheckInProgress = false;
                        }
                        }
Loading