Do not display dialog when PUK attempts remaining is 0.

When using MMI codes to set a new pin and the attempts remaining becomes
zero the lock screen, KeyguardSimPukView, will be handling resetting the
PIN using the PUK. Therefore we set the MmiCode state to CANCELLED which
causes the dialog to be dismissed. If we don't do this then after setting
the new PIN from the lock screen the dialog will still be present
indicating the user still needs to set the PIN.

Bug: 9928717
Change-Id: Ic7dc51ba684a1fd623f2cab0a89f40ef8ff491d5
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaMmiCode.java b/src/java/com/android/internal/telephony/cdma/CdmaMmiCode.java
index 07c137b..3cb8bc7 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaMmiCode.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaMmiCode.java
@@ -315,7 +315,11 @@
                         }
                         // Get the No. of retries remaining to unlock PUK/PUK2
                         int attemptsRemaining = msg.arg1;
-                        if (attemptsRemaining >= 0) {
+                        if (attemptsRemaining <= 0) {
+                            Rlog.d(LOG_TAG, "onSetComplete: PUK locked,"
+                                    + " cancel as lock screen will handle this");
+                            mState = State.CANCELLED;
+                        } else if (attemptsRemaining > 0) {
                             Rlog.d(LOG_TAG, "onSetComplete: attemptsRemaining="+attemptsRemaining);
                             sb.append(mContext.getResources().getQuantityString(
                                     com.android.internal.R.plurals.pinpuk_attempts,
diff --git a/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java b/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java
index 1dd958f..c2bafbe 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java
@@ -1030,7 +1030,12 @@
                         }
                         // Get the No. of retries remaining to unlock PUK/PUK2
                         int attemptsRemaining = msg.arg1;
-                        if (attemptsRemaining >= 0) {
+                        if (attemptsRemaining <= 0) {
+                            Rlog.d(LOG_TAG, "onSetComplete: PUK locked,"
+                                    + " cancel as lock screen will handle this");
+                            mState = State.CANCELLED;
+                        } else if (attemptsRemaining > 0) {
+                            Rlog.d(LOG_TAG, "onSetComplete: attemptsRemaining="+attemptsRemaining);
                             sb.append(mContext.getResources().getQuantityString(
                                     com.android.internal.R.plurals.pinpuk_attempts,
                                     attemptsRemaining, attemptsRemaining));