From 52052c8147dceebe73e24c9bb99a3fcff637dc83 Mon Sep 17 00:00:00 2001 From: Masaho Nishikawa Date: Thu, 30 Jan 2020 11:46:22 +0900 Subject: [PATCH] Data connection for carrier specific APN Implement the following features to support carrier network connection. This commit is to define the carrier config for each features. 1. Sets default preferred APN 2. Uses dun APN when using Preset APN in roaming network Also, fixed that to use only APNs with the same set id as preferred APN. Test: Manual Bug: 147969062 Merged-in: If1e6d2bf58de39c22caa901fcd90fb11f104d900 Change-Id: If1e6d2bf58de39c22caa901fcd90fb11f104d900 --- api/system-current.txt | 1 + core/java/android/provider/Telephony.java | 17 +++++++++++----- non-updatable-api/system-current.txt | 1 + .../telephony/CarrierConfigManager.java | 20 ++++++++++++++++--- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index 9dde046ec313c..7094595c5fb39 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -9239,6 +9239,7 @@ package android.provider { field public static final String APN_SET_ID = "apn_set_id"; field public static final int CARRIER_EDITED = 4; // 0x4 field public static final String EDITED_STATUS = "edited"; + field public static final int MATCH_ALL_APN_SET_ID = -1; // 0xffffffff field public static final String MAX_CONNECTIONS = "max_conns"; field public static final String MODEM_PERSIST = "modem_cognitive"; field public static final String MTU = "mtu"; diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index 784119f946798..2c2d127b0414e 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -3948,8 +3948,7 @@ public final class Telephony { /** * The APN set id. When the user manually selects an APN or the framework sets an APN as - * preferred, all APNs with the same set id as the selected APN should be prioritized over - * APNs in other sets. + * preferred, the device can only use APNs with the same set id as the selected APN. *

Type: INTEGER

* @hide */ @@ -3957,15 +3956,23 @@ public final class Telephony { public static final String APN_SET_ID = "apn_set_id"; /** - * Possible value for the {@link #APN_SET_ID} field. By default APNs will not belong to a - * set. If the user manually selects an APN without apn set id, there is no need to - * prioritize any specific APN set ids. + * Possible value for the {@link #APN_SET_ID} field. By default APNs are added to set 0. *

Type: INTEGER

* @hide */ @SystemApi public static final int NO_APN_SET_ID = 0; + /** + * Possible value for the {@link #APN_SET_ID} field. + * APNs with MATCH_ALL_APN_SET_ID will be used regardless of any set ids of + * the selected APN. + *

Type: INTEGER

+ * @hide + */ + @SystemApi + public static final int MATCH_ALL_APN_SET_ID = -1; + /** * A unique carrier id associated with this APN * {@see TelephonyManager#getSimCarrierId()} diff --git a/non-updatable-api/system-current.txt b/non-updatable-api/system-current.txt index 22d9ec2a15749..d788dadd64a46 100644 --- a/non-updatable-api/system-current.txt +++ b/non-updatable-api/system-current.txt @@ -8121,6 +8121,7 @@ package android.provider { field public static final String APN_SET_ID = "apn_set_id"; field public static final int CARRIER_EDITED = 4; // 0x4 field public static final String EDITED_STATUS = "edited"; + field public static final int MATCH_ALL_APN_SET_ID = -1; // 0xffffffff field public static final String MAX_CONNECTIONS = "max_conns"; field public static final String MODEM_PERSIST = "modem_cognitive"; field public static final String MTU = "mtu"; diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index c9781545a9eb1..97b97488e6c6d 100755 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -3880,10 +3880,23 @@ public class CarrierConfigManager { * Indicating whether DUN APN should be disabled when the device is roaming. In that case, * the default APN (i.e. internet) will be used for tethering. * + * This config is only available when using Preset APN(not user edited) as Preferred APN. + * * @hide */ - public static final String KEY_DISABLE_DUN_APN_WHILE_ROAMING = - "disable_dun_apn_while_roaming"; + public static final String KEY_DISABLE_DUN_APN_WHILE_ROAMING_WITH_PRESET_APN_BOOL = + "disable_dun_apn_while_roaming_with_preset_apn_bool"; + + /** + * Where there is no preferred APN, specifies the carrier's default preferred APN. + * Specifies the {@link android.provider.Telephony.Carriers.APN} of the default preferred apn. + * + * This config is only available with Preset APN(not user edited). + * + * @hide + */ + public static final String KEY_DEFAULT_PREFERRED_APN_NAME_STRING = + "default_preferred_apn_name_string"; /** The default value for every variable. */ private final static PersistableBundle sDefaults; @@ -4422,7 +4435,8 @@ public class CarrierConfigManager { "ims:2", "cbs:2", "ia:2", "emergency:2", "mcx:3", "xcap:3" }); sDefaults.putStringArray(KEY_MISSED_INCOMING_CALL_SMS_PATTERN_STRING_ARRAY, new String[0]); - sDefaults.putBoolean(KEY_DISABLE_DUN_APN_WHILE_ROAMING, false); + sDefaults.putBoolean(KEY_DISABLE_DUN_APN_WHILE_ROAMING_WITH_PRESET_APN_BOOL, false); + sDefaults.putString(KEY_DEFAULT_PREFERRED_APN_NAME_STRING, ""); } /**