From a255aeab99142d5b56a90ebdc884c71d18b196be Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Mon, 13 May 2019 16:54:04 -0700 Subject: [PATCH] Fixed incorrect metered/unmetered APN in AP-assisted mode From now all data traffic through IWLAN will be unmetered. Only data through cellular will be checked for metered/unmetered. Test: Unit tests Bug: 132433959 Merged-In: Id1498fb8627dd7221a5ab7cde72929e6ee25b425 Change-Id: Id1498fb8627dd7221a5ab7cde72929e6ee25b425 (cherry picked from commit 7ff7865d7b17cc015f2d38f6a5f503f0e4169c17) --- .../android/telephony/CarrierConfigManager.java | 16 ---------------- .../java/android/telephony/data/ApnSetting.java | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 77f76d92578c..eb25e0237708 100755 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -835,13 +835,6 @@ public class CarrierConfigManager { public static final String KEY_CARRIER_METERED_ROAMING_APN_TYPES_STRINGS = "carrier_metered_roaming_apn_types_strings"; - /** - * Default APN types that are metered on IWLAN by the carrier - * @hide - */ - public static final String KEY_CARRIER_METERED_IWLAN_APN_TYPES_STRINGS = - "carrier_metered_iwlan_apn_types_strings"; - /** * CDMA carrier ERI (Enhanced Roaming Indicator) file name * @hide @@ -2840,15 +2833,6 @@ public class CarrierConfigManager { new String[]{"default", "mms", "dun", "supl"}); sDefaults.putStringArray(KEY_CARRIER_METERED_ROAMING_APN_TYPES_STRINGS, new String[]{"default", "mms", "dun", "supl"}); - // By default all APNs should be unmetered if the device is on IWLAN. However, we add - // default APN as metered here as a workaround for P because in some cases, a data - // connection was brought up on cellular, but later on the device camped on IWLAN. That - // data connection was incorrectly treated as unmetered due to the current RAT IWLAN. - // Marking it as metered for now can workaround the issue. - // Todo: This will be fixed in Q when IWLAN full refactoring is completed. - sDefaults.putStringArray(KEY_CARRIER_METERED_IWLAN_APN_TYPES_STRINGS, - new String[]{"default"}); - sDefaults.putIntArray(KEY_ONLY_SINGLE_DC_ALLOWED_INT_ARRAY, new int[]{ 4, /* IS95A */ diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java index 4a7585db0740..f0c819da2dde 100644 --- a/telephony/java/android/telephony/data/ApnSetting.java +++ b/telephony/java/android/telephony/data/ApnSetting.java @@ -1272,6 +1272,23 @@ public class ApnSetting implements Parcelable { return apnValue; } + /** + * Get supported APN types + * + * @return list of APN types + * @hide + */ + @ApnType + public List getApnTypes() { + List types = new ArrayList<>(); + for (Integer type : APN_TYPE_INT_MAP.keySet()) { + if ((mApnTypeBitmask & type) == type) { + types.add(type); + } + } + return types; + } + /** * @param apnTypeBitmask bitmask of APN types. * @return comma delimited list of APN types.