From 579d37f3abf024f98fb5a3e850a01f253c500f21 Mon Sep 17 00:00:00 2001 From: Ling Ma Date: Wed, 12 Oct 2022 15:10:33 -0700 Subject: [PATCH 1/2] Add string for auto data siwtch notification Bug: 244064524 Test: manual Merged-In: I8f1fc37480012747466038ca377a9c244ddb5e97 Change-Id: I8f1fc37480012747466038ca377a9c244ddb5e97 --- core/res/res/values/strings.xml | 5 +++++ core/res/res/values/symbols.xml | 2 ++ 2 files changed, 7 insertions(+) diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 73c201c5bf9d7..8764906c66cf0 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -202,6 +202,11 @@ You can\'t change the caller ID setting. + + Switched data to %s + + You can change this anytime in Settings + No mobile data service diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index fa1150cb36745..8477afa0f7fa9 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -598,6 +598,8 @@ + + From 09b3c89b1c08c1a9c1b178335f9db4000d981df7 Mon Sep 17 00:00:00 2001 From: Ling Ma Date: Wed, 14 Sep 2022 20:34:17 -0700 Subject: [PATCH 2/2] Add MOBILE_DATA_POLICY_AUTO_DATA_SWITCH The feature only applies to non-DDS. If enabled, we automatically switch to the non-DDS for data traffic when it has better availability than the DDS. Test: cts Bug: 244064524 Merged-In: Id827b3e253b637273504d87c8db64893c7b70924 Change-Id: Id827b3e253b637273504d87c8db64893c7b70924 --- core/api/system-current.txt | 1 + .../telephony/util/TelephonyUtils.java | 2 ++ .../android/telephony/TelephonyManager.java | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 03c8f8fc68910..a640ffdb1736c 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -13624,6 +13624,7 @@ package android.telephony { field public static final int INVALID_EMERGENCY_NUMBER_DB_VERSION = -1; // 0xffffffff field public static final int KEY_TYPE_EPDG = 1; // 0x1 field public static final int KEY_TYPE_WLAN = 2; // 0x2 + field public static final int MOBILE_DATA_POLICY_AUTO_DATA_SWITCH = 3; // 0x3 field public static final int MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL = 1; // 0x1 field public static final int MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED = 2; // 0x2 field public static final int NR_DUAL_CONNECTIVITY_DISABLE = 2; // 0x2 diff --git a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java index 5179babbd31d7..76d2b7d8fce59 100644 --- a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java +++ b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java @@ -206,6 +206,8 @@ public final class TelephonyUtils { return "DATA_ON_NON_DEFAULT_DURING_VOICE_CALL"; case TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED: return "MMS_ALWAYS_ALLOWED"; + case TelephonyManager.MOBILE_DATA_POLICY_AUTO_DATA_SWITCH: + return "AUTO_DATA_SWITCH"; default: return "UNKNOWN(" + mobileDataPolicy + ")"; } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 3b376fb4c6055..1654848e3f3c9 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -15400,12 +15400,30 @@ public class TelephonyManager { @SystemApi public static final int MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED = 2; + /** + * Allow switching mobile data to the non-default SIM if the non-default SIM has better + * availability. + * + * This is used for temporarily allowing data on the non-default data SIM when on-default SIM + * has better availability on DSDS devices, where better availability means strong + * signal/connectivity. + * If this policy is enabled, data will be temporarily enabled on the non-default data SIM, + * including during any voice calls(equivalent to enabling + * {@link #MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL}). + * + * This policy can be enabled and disabled via {@link #setMobileDataPolicyEnabled}. + * @hide + */ + @SystemApi + public static final int MOBILE_DATA_POLICY_AUTO_DATA_SWITCH = 3; + /** * @hide */ @IntDef(prefix = { "MOBILE_DATA_POLICY_" }, value = { MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL, MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED, + MOBILE_DATA_POLICY_AUTO_DATA_SWITCH, }) @Retention(RetentionPolicy.SOURCE) public @interface MobileDataPolicy { }