Merge "Add support for ApnSetting.TYPE_OEM_PAID and OEM_PRIVATE" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
c25a0b8f9d
@@ -198,6 +198,10 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
public static final String APN_TYPE_MCX = "mcx";
|
||||
/** APN type for XCAP */
|
||||
public static final String APN_TYPE_XCAP = "xcap";
|
||||
/** APN type for OEM_PAID networks (Automotive PANS) */
|
||||
public static final String APN_TYPE_OEM_PAID = "oem_paid";
|
||||
/** APN type for OEM_PRIVATE networks (Automotive PANS) */
|
||||
public static final String APN_TYPE_OEM_PRIVATE = "oem_private";
|
||||
/** Array of all APN types */
|
||||
public static final String[] APN_TYPES = {APN_TYPE_DEFAULT,
|
||||
APN_TYPE_MMS,
|
||||
@@ -211,6 +215,14 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
APN_TYPE_EMERGENCY,
|
||||
APN_TYPE_MCX,
|
||||
APN_TYPE_XCAP,
|
||||
APN_TYPE_OEM_PAID,
|
||||
APN_TYPE_OEM_PRIVATE,
|
||||
};
|
||||
|
||||
/** Array of APN types that are never user-editable */
|
||||
private static final String[] ALWAYS_READ_ONLY_APN_TYPES = new String[] {
|
||||
APN_TYPE_OEM_PAID,
|
||||
APN_TYPE_OEM_PRIVATE,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -360,6 +372,18 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch complete list of read only APN types.
|
||||
*
|
||||
* The list primarily comes from carrier config, but is also supplied by APN types which are
|
||||
* always read only.
|
||||
*/
|
||||
static String[] getReadOnlyApnTypes(PersistableBundle b) {
|
||||
String[] carrierReadOnlyApnTypes = b.getStringArray(
|
||||
CarrierConfigManager.KEY_READ_ONLY_APN_TYPES_STRING_ARRAY);
|
||||
return ArrayUtils.concat(String.class, carrierReadOnlyApnTypes, ALWAYS_READ_ONLY_APN_TYPES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable ProxySubscriptionMgr with Lifecycle support for all controllers
|
||||
* live within this fragment
|
||||
@@ -1355,8 +1379,7 @@ public class ApnEditor extends SettingsPreferenceFragment
|
||||
if (configManager != null) {
|
||||
final PersistableBundle b = configManager.getConfigForSubId(mSubId);
|
||||
if (b != null) {
|
||||
mReadOnlyApnTypes = b.getStringArray(
|
||||
CarrierConfigManager.KEY_READ_ONLY_APN_TYPES_STRING_ARRAY);
|
||||
mReadOnlyApnTypes = getReadOnlyApnTypes(b);
|
||||
if (!ArrayUtils.isEmpty(mReadOnlyApnTypes)) {
|
||||
Log.d(TAG,
|
||||
"onCreate: read only APN type: " + Arrays.toString(mReadOnlyApnTypes));
|
||||
|
@@ -135,8 +135,7 @@ public class ApnSettings extends RestrictedSettingsFragment
|
||||
mHideImsApn = b.getBoolean(CarrierConfigManager.KEY_HIDE_IMS_APN_BOOL);
|
||||
mAllowAddingApns = b.getBoolean(CarrierConfigManager.KEY_ALLOW_ADDING_APNS_BOOL);
|
||||
if (mAllowAddingApns) {
|
||||
final String[] readOnlyApnTypes = b.getStringArray(
|
||||
CarrierConfigManager.KEY_READ_ONLY_APN_TYPES_STRING_ARRAY);
|
||||
final String[] readOnlyApnTypes = ApnEditor.getReadOnlyApnTypes(b);
|
||||
// if no apn type can be edited, do not allow adding APNs
|
||||
if (ApnEditor.hasAllApns(readOnlyApnTypes)) {
|
||||
Log.d(TAG, "not allowing adding APN because all APN types are read only");
|
||||
|
@@ -204,9 +204,7 @@ fun getCarrierCustomizedConfig(
|
||||
CarrierConfigManager.KEY_ALLOW_ADDING_APNS_BOOL
|
||||
)
|
||||
val customizedConfig = CustomizedConfig(
|
||||
readOnlyApnTypes = b.getStringArray(
|
||||
CarrierConfigManager.KEY_READ_ONLY_APN_TYPES_STRING_ARRAY
|
||||
)?.toList() ?: emptyList(),
|
||||
readOnlyApnTypes = ApnEditor.getReadOnlyApnTypes(b)?.toList() ?: emptyList(),
|
||||
readOnlyApnFields = b.getStringArray(
|
||||
CarrierConfigManager.KEY_READ_ONLY_APN_FIELDS_STRING_ARRAY
|
||||
)?.toList() ?: emptyList(),
|
||||
|
@@ -45,6 +45,8 @@ object ApnTypes {
|
||||
ApnSetting.TYPE_VSIM_STRING,
|
||||
ApnSetting.TYPE_BIP_STRING,
|
||||
ApnSetting.TYPE_ENTERPRISE_STRING,
|
||||
ApnSetting.TYPE_OEM_PAID_STRING,
|
||||
ApnSetting.TYPE_OEM_PRIVATE_STRING,
|
||||
)
|
||||
|
||||
private fun splitToList(apnType: String): List<String> {
|
||||
|
Reference in New Issue
Block a user