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";
|
public static final String APN_TYPE_MCX = "mcx";
|
||||||
/** APN type for XCAP */
|
/** APN type for XCAP */
|
||||||
public static final String APN_TYPE_XCAP = "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 */
|
/** Array of all APN types */
|
||||||
public static final String[] APN_TYPES = {APN_TYPE_DEFAULT,
|
public static final String[] APN_TYPES = {APN_TYPE_DEFAULT,
|
||||||
APN_TYPE_MMS,
|
APN_TYPE_MMS,
|
||||||
@@ -211,6 +215,14 @@ public class ApnEditor extends SettingsPreferenceFragment
|
|||||||
APN_TYPE_EMERGENCY,
|
APN_TYPE_EMERGENCY,
|
||||||
APN_TYPE_MCX,
|
APN_TYPE_MCX,
|
||||||
APN_TYPE_XCAP,
|
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
|
* Enable ProxySubscriptionMgr with Lifecycle support for all controllers
|
||||||
* live within this fragment
|
* live within this fragment
|
||||||
@@ -1355,8 +1379,7 @@ public class ApnEditor extends SettingsPreferenceFragment
|
|||||||
if (configManager != null) {
|
if (configManager != null) {
|
||||||
final PersistableBundle b = configManager.getConfigForSubId(mSubId);
|
final PersistableBundle b = configManager.getConfigForSubId(mSubId);
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
mReadOnlyApnTypes = b.getStringArray(
|
mReadOnlyApnTypes = getReadOnlyApnTypes(b);
|
||||||
CarrierConfigManager.KEY_READ_ONLY_APN_TYPES_STRING_ARRAY);
|
|
||||||
if (!ArrayUtils.isEmpty(mReadOnlyApnTypes)) {
|
if (!ArrayUtils.isEmpty(mReadOnlyApnTypes)) {
|
||||||
Log.d(TAG,
|
Log.d(TAG,
|
||||||
"onCreate: read only APN type: " + Arrays.toString(mReadOnlyApnTypes));
|
"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);
|
mHideImsApn = b.getBoolean(CarrierConfigManager.KEY_HIDE_IMS_APN_BOOL);
|
||||||
mAllowAddingApns = b.getBoolean(CarrierConfigManager.KEY_ALLOW_ADDING_APNS_BOOL);
|
mAllowAddingApns = b.getBoolean(CarrierConfigManager.KEY_ALLOW_ADDING_APNS_BOOL);
|
||||||
if (mAllowAddingApns) {
|
if (mAllowAddingApns) {
|
||||||
final String[] readOnlyApnTypes = b.getStringArray(
|
final String[] readOnlyApnTypes = ApnEditor.getReadOnlyApnTypes(b);
|
||||||
CarrierConfigManager.KEY_READ_ONLY_APN_TYPES_STRING_ARRAY);
|
|
||||||
// if no apn type can be edited, do not allow adding APNs
|
// if no apn type can be edited, do not allow adding APNs
|
||||||
if (ApnEditor.hasAllApns(readOnlyApnTypes)) {
|
if (ApnEditor.hasAllApns(readOnlyApnTypes)) {
|
||||||
Log.d(TAG, "not allowing adding APN because all APN types are read only");
|
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
|
CarrierConfigManager.KEY_ALLOW_ADDING_APNS_BOOL
|
||||||
)
|
)
|
||||||
val customizedConfig = CustomizedConfig(
|
val customizedConfig = CustomizedConfig(
|
||||||
readOnlyApnTypes = b.getStringArray(
|
readOnlyApnTypes = ApnEditor.getReadOnlyApnTypes(b)?.toList() ?: emptyList(),
|
||||||
CarrierConfigManager.KEY_READ_ONLY_APN_TYPES_STRING_ARRAY
|
|
||||||
)?.toList() ?: emptyList(),
|
|
||||||
readOnlyApnFields = b.getStringArray(
|
readOnlyApnFields = b.getStringArray(
|
||||||
CarrierConfigManager.KEY_READ_ONLY_APN_FIELDS_STRING_ARRAY
|
CarrierConfigManager.KEY_READ_ONLY_APN_FIELDS_STRING_ARRAY
|
||||||
)?.toList() ?: emptyList(),
|
)?.toList() ?: emptyList(),
|
||||||
|
@@ -45,6 +45,8 @@ object ApnTypes {
|
|||||||
ApnSetting.TYPE_VSIM_STRING,
|
ApnSetting.TYPE_VSIM_STRING,
|
||||||
ApnSetting.TYPE_BIP_STRING,
|
ApnSetting.TYPE_BIP_STRING,
|
||||||
ApnSetting.TYPE_ENTERPRISE_STRING,
|
ApnSetting.TYPE_ENTERPRISE_STRING,
|
||||||
|
ApnSetting.TYPE_OEM_PAID_STRING,
|
||||||
|
ApnSetting.TYPE_OEM_PRIVATE_STRING,
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun splitToList(apnType: String): List<String> {
|
private fun splitToList(apnType: String): List<String> {
|
||||||
|
Reference in New Issue
Block a user