Hide or show APNs with type="ims" as CarrierConfig
APN with type="ims" is used to attach IMS APN to the modem.
This APN is meaningless and confusing to end users.
Most carriers don't care to show this APN from apn list.
Some carriers want to show this APN from apn list and others don't.
This change hides or shows this as CarrierConfig from the APN list.
Bug: 23770219
Change-Id: Ia632f39401d84e8c63ac96f1c3b12aa3d8d2a4e6
diff --git a/src/com/android/settings/ApnSettings.java b/src/com/android/settings/ApnSettings.java
index 226f8ab..3b3ce2f 100644
--- a/src/com/android/settings/ApnSettings.java
+++ b/src/com/android/settings/ApnSettings.java
@@ -33,12 +33,14 @@
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
+import android.os.PersistableBundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.Telephony;
+import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
@@ -111,6 +113,8 @@
private boolean mUnavailable;
+ private boolean mHideImsApn;
+
private final BroadcastReceiver mMobileStateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -162,6 +166,11 @@
mSubscriptionInfo = SubscriptionManager.from(activity).getActiveSubscriptionInfo(subId);
mUiccController = UiccController.getInstance();
+
+ CarrierConfigManager configManager = (CarrierConfigManager)
+ getSystemService(Context.CARRIER_CONFIG_SERVICE);
+ PersistableBundle b = configManager.getConfig();
+ mHideImsApn = b.getBoolean(CarrierConfigManager.KEY_HIDE_IMS_APN_BOOL);
}
@Override
@@ -226,9 +235,12 @@
final String mccmnc = mSubscriptionInfo == null ? ""
: tm.getSimOperator(mSubscriptionInfo.getSubscriptionId());
Log.d(TAG, "mccmnc = " + mccmnc);
- final String where = "numeric=\""
+ String where = "numeric=\""
+ mccmnc
+ "\" AND NOT (type='ia' AND (apn=\"\" OR apn IS NULL))";
+ if (mHideImsApn) {
+ where = where + " AND NOT (type='ims')";
+ }
Cursor cursor = getContentResolver().query(Telephony.Carriers.CONTENT_URI, new String[] {
"_id", "name", "apn", "type", "mvno_type", "mvno_match_data"}, where, null,