<string name="sim_change_succeeded">SIM PIN changed successfully</string>
<!-- SIM card lock settings screen, toast after not entering correct SIM PIN [CHAR LIMIT=40] -->
<string name="sim_lock_failed">Can\u2019t change SIM card lock state.\nPossibly incorrect PIN.</string>
+ <!-- SIM card lock settings screen, toast after disabling PIN failed from modem -->
+ <string name="sim_pin_disable_failed">Can\'t disable PIN.</string>
+ <!-- SIM card lock settings screen, toast after enabling PIN failed from modem -->
+ <string name="sim_pin_enable_failed">Can\'t enable PIN.</string>
<!-- SIM card lock settings screen, SIM PIN dialog button labels: [CHAR LIMIT=40] -->
<string name="sim_enter_ok">OK</string>
<!-- SIM card lock settings screen, SIM PIN dialog button labels: [CHAR LIMIT=40] -->
import android.widget.TabWidget;
import android.widget.Toast;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.TelephonyIntents;
AsyncResult ar = (AsyncResult) msg.obj;
switch (msg.what) {
case MSG_ENABLE_ICC_PIN_COMPLETE:
- iccLockChanged(ar.exception == null, msg.arg1);
+ iccLockChanged(ar.exception == null, msg.arg1, ar.exception);
break;
case MSG_CHANGE_ICC_PIN_COMPLETE:
iccPinChanged(ar.exception == null, msg.arg1);
mPinToggle.setEnabled(false);
}
- private void iccLockChanged(boolean success, int attemptsRemaining) {
+ private void iccLockChanged(boolean success, int attemptsRemaining, Throwable exception) {
if (success) {
mPinToggle.setChecked(mToState);
} else {
- Toast.makeText(getContext(), getPinPasswordErrorMessage(attemptsRemaining),
- Toast.LENGTH_LONG).show();
+ if (exception instanceof CommandException) {
+ CommandException.Error err = ((CommandException)(exception)).getCommandError();
+ if (err == CommandException.Error.PASSWORD_INCORRECT) {
+ Toast.makeText(getContext(), getPinPasswordErrorMessage(attemptsRemaining),
+ Toast.LENGTH_LONG).show();
+ } else {
+ if (mToState) {
+ Toast.makeText(getContext(), mRes.getString
+ (R.string.sim_pin_enable_failed), Toast.LENGTH_LONG).show();
+ } else {
+ Toast.makeText(getContext(), mRes.getString
+ (R.string.sim_pin_disable_failed), Toast.LENGTH_LONG).show();
+ }
+ }
+ }
}
mPinToggle.setEnabled(true);
resetDialogState();