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

Commit aeb6ad20 authored by Rakesh Pallerla's avatar Rakesh Pallerla Committed by Steve Kondik
Browse files

Telephony: Few PIN/PUK fixes

Following changes have been made as part of this:
-> Changes done to display retry counter on wrong entry of
   PIN1,and message to indicate Code accepted/PIN1 blocked
   during PIN1 verification as per certain carrier requirements.
-> The current APIs that are used to verify the PIN and PUK only
   convey whether the operation succeeded or failed. As a result
   on ANY failure clients ask the user to re-enter the PIN.
   Add 2 new APIs that report the actual error code in case of
   failure.
-> Display the complete text including attempts remaining to
   unlock PIN on SimUnlockScreen if user entered incorrect PIN.
   On some devices the display text is ellipsized when trying to
   display on a single line.

Change-Id: I73718c9e6a8aa7244097e0dd4593a6226ff0ac08
CRs-Fixed: 184479, 260481, 181402, 181380, 181401, 326286, 441001,
479414, 479417
(cherry picked from commit 1cfe4cb95d29b792e40c6a89cf2fdb1a0b8371e7)
(cherry picked from commit a50adebc939f1ff6cb9633ba116f4e7d1ffe60e3)
(cherry picked from commit e29e99706ad4e8ddc06f157a9a56e5dcaf0e49e7)
parent 236c92c0
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -2275,6 +2275,9 @@
         to unlock the keyguard.  Displayed in one line in a large font.  -->
    <string name="keyguard_password_wrong_pin_code">Incorrect PIN code.</string>

    <!-- Displayed when a SIM PIN/PUK is entered incorrectly. -->
    <string name="pinpuk_attempts">\nAttempts Remaining :</string>

    <!-- Instructions telling the user how to unlock the phone. -->
    <string name="keyguard_label_text">To unlock, press Menu then 0.</string>

@@ -2366,10 +2369,10 @@
         PUK locked (Pin Unlock Kode) -->
    <string name="lockscreen_sim_puk_locked_message">SIM card is PUK-locked.</string>
    <!-- Shown in the lock screen when the SIM has become PUK locked and the user must call customer care to unlock it. -->
    <string name="lockscreen_sim_puk_locked_instructions">See the User Guide or contact Customer Care.</string>
    <string name="lockscreen_sim_puk_locked_instructions">PIN1 Blocked. Enter PUK1\nor\nPlease see the User Guide or contact Customer Care.</string>

    <!-- Shown in the lock screen to tell the user that their SIM is locked and they must unlock it. -->
    <string name="lockscreen_sim_locked_message">SIM card is locked.</string>
    <!-- Shown in the lock screen to tell the user that their SIM/RUIM is locked and they must unlock it. -->
    <string name="lockscreen_sim_locked_message">SIM/RUIM card is locked.</string>

    <!-- For the unlock screen, When the user enters a sim unlock code, it takes a little while to check
         whether it is valid, and to unlock the sim if it is valid.  we display a
+2 −0
Original line number Diff line number Diff line
@@ -458,6 +458,7 @@
  <java-symbol type="string" name="badPin" />
  <java-symbol type="string" name="badPuk" />
  <java-symbol type="string" name="lockscreen_sim_error_message_short" />
  <java-symbol type="string" name="pinpuk_attempts" />
  <java-symbol type="string" name="byteShort" />
  <java-symbol type="string" name="capability_desc_canRequestEnhancedWebAccessibility" />
  <java-symbol type="string" name="capability_title_canRequestFilterKeyEvents" />
@@ -634,6 +635,7 @@
  <java-symbol type="string" name="orgTypeOther" />
  <java-symbol type="string" name="orgTypeWork" />
  <java-symbol type="string" name="passwordIncorrect" />
  <java-symbol type="string" name="enablePin" />
  <java-symbol type="string" name="perms_description_app" />
  <java-symbol type="string" name="perms_new_perm_prefix" />
  <java-symbol type="string" name="petabyteShort" />
+22 −0
Original line number Diff line number Diff line
@@ -46,6 +46,28 @@
         to unlock the keyguard.  Displayed in one line in a large font.  -->
    <string name="keyguard_password_wrong_pin_code">Incorrect PIN code.</string>

    <!-- Instructions telling the user that they entered the wrong puk while trying
         to unlock the keyguard.  Displayed in one line in a large font.  -->
    <string name="keyguard_password_wrong_puk_code">Incorrect PUK code!</string>

    <!-- Instructions telling the user that the operation to unlock the keyguard
         with PIN failed. Displayed in one line in a large font.  -->
    <string name="keyguard_password_pin_failed">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="keyguard_password_puk_failed">PUK operation failed!</string>


    <!-- Notification telling the user that the PIN1 they entered is valid -->
    <string name="keyguard_pin_accepted">Code Accepted!</string>

    <!-- Displayed when a SIM PIN/PUK is entered incorrectly. -->
    <string name="pinpuk_attempts">\nAttempts Remaining :</string>

    <!-- Shown in the lock screen when there is SIM card IO error. -->
    <string name="lockscreen_sim_error_message_short">Invalid Card.</string>

    <!-- Instructions telling the user how to unlock the phone. -->
    <string name="keyguard_label_text">To unlock, press Menu then 0.</string>

+10 −1
Original line number Diff line number Diff line
@@ -73,7 +73,8 @@ public class CarrierText extends TextView {
        SimPukLocked, // SIM card is PUK locked because SIM entered wrong too many times
        SimLocked, // SIM card is currently locked
        SimPermDisabled, // SIM card is permanently disabled due to PUK unlock failure
        SimNotReady; // SIM is not ready yet. May never be on devices w/o a SIM.
        SimNotReady, // SIM is not ready yet. May never be on devices w/o a SIM.
        SimIoError; //The sim card is faulty
    }

    public CarrierText(Context context) {
@@ -173,6 +174,12 @@ public class CarrierText extends TextView {
                        getContext().getText(R.string.keyguard_sim_puk_locked_message),
                        plmn);
                break;

            case SimIoError:
                carrierText = makeCarrierStringOnEmergencyCapable(
                        getContext().getText(R.string.lockscreen_sim_error_message_short),
                        plmn);
                break;
        }

        return carrierText;
@@ -222,6 +229,8 @@ public class CarrierText extends TextView {
                return StatusMode.SimPermDisabled;
            case UNKNOWN:
                return StatusMode.SimMissing;
            case CARD_IO_ERROR:
                return StatusMode.SimIoError;
        }
        return StatusMode.SimMissing;
    }
+16 −1
Original line number Diff line number Diff line
@@ -78,7 +78,20 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
    }

    public void resetState() {
        mSecurityMessageDisplay.setMessage(R.string.kg_sim_pin_instructions, true);
        String  displayMessage = "";
        try {
            int attemptsRemaining = ITelephony.Stub.asInterface(ServiceManager
                    .checkService("phone")).getIccPin1RetryCount();
            if (attemptsRemaining >= 0) {
                displayMessage = getContext().getString(R.string.keyguard_password_wrong_pin_code)
                        + getContext().getString(R.string.pinpuk_attempts)
                        + attemptsRemaining + ". ";
            }
        } catch (RemoteException ex) {
            displayMessage = getContext().getString(R.string.keyguard_password_pin_failed);
        }
        displayMessage = displayMessage + getContext().getString(R.string.kg_sim_pin_instructions) ;
        mSecurityMessageDisplay.setMessage(displayMessage, true);
        mPasswordEntry.setEnabled(true);
    }

@@ -259,6 +272,8 @@ public class KeyguardSimPinView extends KeyguardAbsKeyInputView
                                mSimUnlockProgressDialog.hide();
                            }
                            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();
                                mCallback.dismiss(true);
                            } else {
Loading