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
This commit is contained in:
committed by
Vineeta Srivastava
parent
b83cbe202b
commit
9fcc7e1b20
@@ -33,12 +33,14 @@ import android.os.Handler;
|
|||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.PersistableBundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceGroup;
|
import android.preference.PreferenceGroup;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.provider.Telephony;
|
import android.provider.Telephony;
|
||||||
|
import android.telephony.CarrierConfigManager;
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -111,6 +113,8 @@ public class ApnSettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
private boolean mUnavailable;
|
private boolean mUnavailable;
|
||||||
|
|
||||||
|
private boolean mHideImsApn;
|
||||||
|
|
||||||
private final BroadcastReceiver mMobileStateReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver mMobileStateReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@@ -162,6 +166,11 @@ public class ApnSettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
mSubscriptionInfo = SubscriptionManager.from(activity).getActiveSubscriptionInfo(subId);
|
mSubscriptionInfo = SubscriptionManager.from(activity).getActiveSubscriptionInfo(subId);
|
||||||
mUiccController = UiccController.getInstance();
|
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
|
@Override
|
||||||
@@ -226,9 +235,12 @@ public class ApnSettings extends SettingsPreferenceFragment implements
|
|||||||
final String mccmnc = mSubscriptionInfo == null ? ""
|
final String mccmnc = mSubscriptionInfo == null ? ""
|
||||||
: tm.getSimOperator(mSubscriptionInfo.getSubscriptionId());
|
: tm.getSimOperator(mSubscriptionInfo.getSubscriptionId());
|
||||||
Log.d(TAG, "mccmnc = " + mccmnc);
|
Log.d(TAG, "mccmnc = " + mccmnc);
|
||||||
final String where = "numeric=\""
|
String where = "numeric=\""
|
||||||
+ mccmnc
|
+ mccmnc
|
||||||
+ "\" AND NOT (type='ia' AND (apn=\"\" OR apn IS NULL))";
|
+ "\" 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[] {
|
Cursor cursor = getContentResolver().query(Telephony.Carriers.CONTENT_URI, new String[] {
|
||||||
"_id", "name", "apn", "type", "mvno_type", "mvno_match_data"}, where, null,
|
"_id", "name", "apn", "type", "mvno_type", "mvno_match_data"}, where, null,
|
||||||
|
Reference in New Issue
Block a user