Merge "Refactor MobileNetworkSettings to use fragment framework."
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 57e417f..a49ceba 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -253,7 +253,7 @@
<!-- Call forwarding settings screen, setting summary text when forwarding to a specific number when unreachable-->
<string name="sum_cfnrc_enabled">Forwarding to <xliff:g id="phonenumber" example="555-1212">{0}</xliff:g></string>
<!-- Call forwarding settings screen, setting summary text when Forward when unreachable is disabled -->
- <string name="sum_cfnrc_disabled">Disabled</string>
+ <string name="sum_cfnrc_disabled">Off</string>
<!-- Error message displayed after failing to disable forwarding calls when the phone is unreachable -->
<string name="disable_cfnrc_forbidden">Your carrier doesn\'t support disabling call forwarding when your phone is unreachable.</string>
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 0f89bd8..5cd1d85 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -88,7 +88,9 @@
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.uicc.IccIoResult;
import com.android.internal.telephony.uicc.IccUtils;
+import com.android.internal.telephony.uicc.SIMRecords;
import com.android.internal.telephony.uicc.UiccCard;
+import com.android.internal.telephony.uicc.UiccCardApplication;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.util.HexDump;
import com.android.phone.settings.VisualVoicemailSettingsUtil;
@@ -160,6 +162,8 @@
private static final int CMD_GET_ALLOWED_CARRIERS = 45;
private static final int EVENT_GET_ALLOWED_CARRIERS_DONE = 46;
private static final int CMD_HANDLE_USSD_REQUEST = 47;
+ private static final int CMD_GET_FORBIDDEN_PLMNS = 48;
+ private static final int EVENT_GET_FORBIDDEN_PLMNS_DONE = 49;
/** The singleton instance. */
private static PhoneInterfaceManager sInstance;
@@ -860,6 +864,56 @@
}
break;
+ case EVENT_GET_FORBIDDEN_PLMNS_DONE:
+ ar = (AsyncResult) msg.obj;
+ request = (MainThreadRequest) ar.userObj;
+ if (ar.exception == null && ar.result != null) {
+ request.result = ar.result;
+ } else {
+ request.result = new IllegalArgumentException(
+ "Failed to retrieve Forbidden Plmns");
+ if (ar.result == null) {
+ loge("getForbiddenPlmns: Empty response");
+ } else {
+ loge("getForbiddenPlmns: Unknown exception");
+ }
+ }
+ synchronized (request) {
+ request.notifyAll();
+ }
+ break;
+
+ case CMD_GET_FORBIDDEN_PLMNS:
+ request = (MainThreadRequest) msg.obj;
+ uiccCard = getUiccCardFromRequest(request);
+ if (uiccCard == null) {
+ loge("getForbiddenPlmns() UiccCard is null");
+ request.result = new IllegalArgumentException(
+ "getForbiddenPlmns() UiccCard is null");
+ synchronized (request) {
+ request.notifyAll();
+ }
+ break;
+ }
+ Integer appType = (Integer) request.argument;
+ UiccCardApplication uiccApp = uiccCard.getApplicationByType(appType);
+ if (uiccApp == null) {
+ loge("getForbiddenPlmns() no app with specified type -- "
+ + appType);
+ request.result = new IllegalArgumentException("Failed to get UICC App");
+ synchronized (request) {
+ request.notifyAll();
+ }
+ break;
+ } else {
+ if (DBG) logv("getForbiddenPlmns() found app " + uiccApp.getAid()
+ + " specified type -- " + appType);
+ }
+ onCompleted = obtainMessage(EVENT_GET_FORBIDDEN_PLMNS_DONE, request);
+ ((SIMRecords) uiccApp.getIccRecords()).getForbiddenPlmns(
+ onCompleted);
+ break;
+
default:
Log.w(LOG_TAG, "MainThreadHandler: unexpected message code: " + msg.what);
break;
@@ -2424,6 +2478,26 @@
return result;
}
+ /**
+ * Get the forbidden PLMN List from the given app type (ex APPTYPE_USIM)
+ * on a particular subscription
+ */
+ public String[] getForbiddenPlmns(int subId, int appType) {
+ mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
+ "Requires READ_PRIVILEGED_PHONE_STATE");
+ if (appType != TelephonyManager.APPTYPE_USIM && appType != TelephonyManager.APPTYPE_SIM) {
+ loge("getForbiddenPlmnList(): App Type must be USIM or SIM");
+ return null;
+ }
+ Object response = sendRequest(
+ CMD_GET_FORBIDDEN_PLMNS, new Integer(appType), subId);
+ if (response instanceof String[]) {
+ return (String[]) response;
+ }
+ // Response is an Exception of some kind, which is signalled to the user as a NULL retval
+ return null;
+ }
+
@Override
public String sendEnvelopeWithStatus(int subId, String content) {
enforceModifyPermissionOrCarrierPrivilege(subId);