Phone: Display message to indicate PIN/PUK status changes.

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.
PhoneApp: Add APIs that report actual error code on PIN/PUK operations
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.

Bug: 9928717
Change-Id: I73718c9e6a8aa7244097e0dd4593a6226ff0ac08
diff --git a/src/com/android/phone/EditFdnContactScreen.java b/src/com/android/phone/EditFdnContactScreen.java
index 2992b7d..753ae3f 100644
--- a/src/com/android/phone/EditFdnContactScreen.java
+++ b/src/com/android/phone/EditFdnContactScreen.java
@@ -47,6 +47,9 @@
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+
 /**
  * Activity to let the user add or edit an FDN contact.
  */
@@ -377,9 +380,15 @@
             if (invalidNumber) {
                 showStatus(getResources().getText(R.string.fdn_invalid_number));
             } else {
-                // There's no way to know whether the failure is due to incorrect PIN2 or
-                // an inappropriate phone number.
-                showStatus(getResources().getText(R.string.pin2_or_fdn_invalid));
+               if (PhoneFactory.getDefaultPhone().getIccCard().getIccPin2Blocked()) {
+                    showStatus(getResources().getText(R.string.fdn_enable_puk2_requested));
+                } else if (PhoneFactory.getDefaultPhone().getIccCard().getIccPuk2Blocked()) {
+                    showStatus(getResources().getText(R.string.puk2_blocked));
+                } else {
+                    // There's no way to know whether the failure is due to incorrect PIN2 or
+                    // an inappropriate phone number.
+                    showStatus(getResources().getText(R.string.pin2_or_fdn_invalid));
+                }
             }
         }