From 838637c66065281aec40b9bcef86ef1bfe9416ff Mon Sep 17 00:00:00 2001 From: Gil Cukierman Date: Mon, 19 Sep 2022 14:11:32 +0000 Subject: [PATCH] Add TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER_RESTRICTION This reason is intended to be passed to TelephonyManager.setAllowedNetworkTypesForReason when 2g is disabled by a user restriction. Bug: 247522864 Test: Included in future commits Change-Id: I617e629163cfb63235055a4e9a75b0c2d6629ad5 --- core/api/system-current.txt | 1 + .../java/android/telephony/TelephonyManager.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index e6555ddfa0cf3..00a7abd041a77 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -13553,6 +13553,7 @@ package android.telephony { field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED"; field public static final int ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G = 3; // 0x3 field public static final int ALLOWED_NETWORK_TYPES_REASON_POWER = 1; // 0x1 + field public static final int ALLOWED_NETWORK_TYPES_REASON_USER_RESTRICTIONS = 4; // 0x4 field public static final int CALL_WAITING_STATUS_DISABLED = 2; // 0x2 field public static final int CALL_WAITING_STATUS_ENABLED = 1; // 0x1 field public static final int CALL_WAITING_STATUS_FDN_CHECK_FAILURE = 5; // 0x5 diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 70d82701da66d..a081bc3209216 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -9358,7 +9358,8 @@ public class TelephonyManager { ALLOWED_NETWORK_TYPES_REASON_USER, ALLOWED_NETWORK_TYPES_REASON_POWER, ALLOWED_NETWORK_TYPES_REASON_CARRIER, - ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G + ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G, + ALLOWED_NETWORK_TYPES_REASON_USER_RESTRICTIONS, }) @Retention(RetentionPolicy.SOURCE) public @interface AllowedNetworkTypesReason { @@ -9396,6 +9397,15 @@ public class TelephonyManager { @SystemApi public static final int ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G = 3; + /** + * To indicate allowed network type change is requested by an update to the + * {@link android.os.UserManager.DISALLOW_CELLULAR_2G} user restriction. + * + * @hide + */ + @SystemApi + public static final int ALLOWED_NETWORK_TYPES_REASON_USER_RESTRICTIONS = 4; + /** * Set the allowed network types of the device and provide the reason triggering the allowed * network change. @@ -9488,6 +9498,7 @@ public class TelephonyManager { case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_POWER: case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_CARRIER: case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G: + case ALLOWED_NETWORK_TYPES_REASON_USER_RESTRICTIONS: return true; } return false;