From 46941d62b8a24ac86e93ad57501bed89c0c8f7e9 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Mon, 20 Apr 2020 21:11:40 -0700 Subject: [PATCH 1/2] Add carrier configs for 5G timer requirements Test: atest OverrideNetworkTypeController Bug: 154186364 Change-Id: I1e31ea85ccbe5c84b295674ce82ff0725958a96f --- .../telephony/CarrierConfigManager.java | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index d2de19aaf89a6..4bf97c00a5a59 100755 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -3064,6 +3064,95 @@ public class CarrierConfigManager { public static final String KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT = "5g_icon_display_grace_period_sec_int"; + /** + * This configuration allows the system UI to determine how long to continue to display 5G icons + * when the device switches between different 5G scenarios. + * + * There are six 5G scenarios: + * 1. connected_mmwave: device currently connected to 5G cell as the secondary cell and using + * millimeter wave. + * 2. connected: device currently connected to 5G cell as the secondary cell but not using + * millimeter wave. + * 3. not_restricted_rrc_idle: device camped on a network that has 5G capability(not necessary + * to connect a 5G cell as a secondary cell) and the use of 5G is not restricted and RRC + * currently in IDLE state. + * 4. not_restricted_rrc_con: device camped on a network that has 5G capability(not necessary + * to connect a 5G cell as a secondary cell) and the use of 5G is not restricted and RRC + * currently in CONNECTED state. + * 5. restricted: device camped on a network that has 5G capability(not necessary to connect a + * 5G cell as a secondary cell) but the use of 5G is restricted. + * 6. any: any of the above scenarios, as well as none (not connected to 5G) + * + * The configured string contains various timer rules separated by a semicolon. + * Each rule will have three items: prior 5G scenario, current 5G scenario, and grace period + * in seconds before changing the icon. When the 5G state changes from the prior to the current + * 5G scenario, the system UI will continue to show the icon for the prior 5G scenario (defined + * in {@link #KEY_5G_ICON_CONFIGURATION_STRING}) for the amount of time specified by the grace + * period. If the prior 5G scenario is reestablished, the timer will reset and start again if + * the UE changes 5G scenarios again. Defined states (5G scenarios #1-5) take precedence over + * 'any' (5G scenario #6), and unspecified transitions have a default grace period of 0. + * The order of rules in the configuration determines the priority (the first applicable timer + * rule will be used). + * + * Here is an example: "connected_mmwave,connected,30;connected_mmwave,any,10;connected,any,10" + * This configuration defines 3 timers: + * 1. When UE goes from 'connected_mmwave' to 'connected', system UI will continue to display + * the 5G icon for 'connected_mmwave' for 30 seconds. + * 2. When UE goes from 'connected_mmwave' to any other state (except for connected, since + * rule 1 would be used instead), system UI will continue to display the 5G icon for + * 'connected_mmwave' for 10 seconds. + * 3. When UE goes from 'connected' to any other state, system UI will continue to display the + * 5G icon for 'connected' for 10 seconds. + * + * @hide + */ + public static final String KEY_5G_ICON_DISPLAY_GRACE_PERIOD_STRING = + "5g_icon_display_grace_period_string"; + + /** + * This configuration extends {@link #KEY_5G_ICON_DISPLAY_GRACE_PERIOD_STRING} to allow the + * system UI to continue displaying 5G icons after the initial timer expires. + * + * There are six 5G scenarios: + * 1. connected_mmwave: device currently connected to 5G cell as the secondary cell and using + * millimeter wave. + * 2. connected: device currently connected to 5G cell as the secondary cell but not using + * millimeter wave. + * 3. not_restricted_rrc_idle: device camped on a network that has 5G capability(not necessary + * to connect a 5G cell as a secondary cell) and the use of 5G is not restricted and RRC + * currently in IDLE state. + * 4. not_restricted_rrc_con: device camped on a network that has 5G capability(not necessary + * to connect a 5G cell as a secondary cell) and the use of 5G is not restricted and RRC + * currently in CONNECTED state. + * 5. restricted: device camped on a network that has 5G capability(not necessary to connect a + * 5G cell as a secondary cell) but the use of 5G is restricted. + * 6. any: any of the above scenarios, as well as none (not connected to 5G) + * + * The configured string contains various timer rules separated by a semicolon. + * Each rule will have three items: primary 5G scenario, secondary 5G scenario, and + * grace period in seconds before changing the icon. When the timer for the primary 5G timer + * expires, the system UI will continue to show the icon for the primary 5G scenario (defined + * in {@link #KEY_5G_ICON_CONFIGURATION_STRING}) for the amount of time specified by the grace + * period. If the primary 5G scenario is reestablished, the timers will reset and the system UI + * will continue to display the icon for the primary 5G scenario without interruption. If the + * secondary 5G scenario is lost, the timer will reset and the icon will reflect the true state. + * Defined states (5G scenarios #1-5) take precedence over 'any' (5G scenario #6), and + * unspecified transitions have a default grace period of 0. The order of rules in the + * configuration determines the priority (the first applicable timer rule will be used). + * + * Here is an example: "connected,not_restricted_rrc_idle,30" + * This configuration defines a secondary timer that extends the primary 'connected' timer. + * When the primary 'connected' timer expires while the UE is in the 'not_restricted_rrc_idle' + * 5G state, system UI will continue to display the 5G icon for 'connected' for 30 seconds. + * If the 5G state returns to 'connected', the timer will be reset without change to the icon, + * and if the 5G state changes to neither 'connected' not 'not_restricted_rrc_idle', the icon + * will change to reflect the true state. + * + * @hide + */ + public static final String KEY_5G_ICON_DISPLAY_SECONDARY_GRACE_PERIOD_STRING = + "5g_icon_display_secondary_grace_period_string"; + /** * Controls time in milliseconds until DcTracker reevaluates 5G connection state. * @hide @@ -4148,6 +4237,8 @@ public class CarrierConfigManager { sDefaults.putString(KEY_5G_ICON_CONFIGURATION_STRING, "connected_mmwave:5G,connected:5G,not_restricted_rrc_idle:5G," + "not_restricted_rrc_con:5G"); + sDefaults.putString(KEY_5G_ICON_DISPLAY_GRACE_PERIOD_STRING, ""); + sDefaults.putString(KEY_5G_ICON_DISPLAY_SECONDARY_GRACE_PERIOD_STRING, ""); sDefaults.putInt(KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT, 0); /* Default value is 1 hour. */ sDefaults.putLong(KEY_5G_WATCHDOG_TIME_MS_LONG, 3600000); From 86b8a847c793b512823125795e1bbb766bb6e18d Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Thu, 23 Apr 2020 10:48:29 -0700 Subject: [PATCH 2/2] Remove constants for DisplayInfo logic from DcTracker Deprecate carrier configs for connected->not connected timer Replaced DCT events with displayinfo changed listener Test: atest NetworkTypeControllerTest, DcTrackerTest Test: manual verify timer and meteredness works as expected Bug: 154186364 Change-Id: I22a459e79f509f20c6b38386655c4b49315e3be7 --- .../android/telephony/CarrierConfigManager.java | 16 ---------------- .../android/internal/telephony/DctConstants.java | 9 ++++----- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 4bf97c00a5a59..6b285d747854a 100755 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -3049,21 +3049,6 @@ public class CarrierConfigManager { */ public static final String KEY_5G_ICON_CONFIGURATION_STRING = "5g_icon_configuration_string"; - /** - * Timeout in seconds for displaying 5G icon, default value is 0 which means the timer is - * disabled. - * - * System UI will show the 5G icon and start a timer with the timeout from this config when the - * device connects to a 5G cell. System UI stops displaying 5G icon when both the device - * disconnects from 5G cell and the timer is expired. - * - * If 5G is reacquired during this timer, the timer is canceled and restarted when 5G is next - * lost. Allows us to momentarily lose 5G without blinking the icon. - * @hide - */ - public static final String KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT = - "5g_icon_display_grace_period_sec_int"; - /** * This configuration allows the system UI to determine how long to continue to display 5G icons * when the device switches between different 5G scenarios. @@ -4239,7 +4224,6 @@ public class CarrierConfigManager { + "not_restricted_rrc_con:5G"); sDefaults.putString(KEY_5G_ICON_DISPLAY_GRACE_PERIOD_STRING, ""); sDefaults.putString(KEY_5G_ICON_DISPLAY_SECONDARY_GRACE_PERIOD_STRING, ""); - sDefaults.putInt(KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT, 0); /* Default value is 1 hour. */ sDefaults.putLong(KEY_5G_WATCHDOG_TIME_MS_LONG, 3600000); sDefaults.putBoolean(KEY_UNMETERED_NR_NSA_BOOL, false); diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java index 18e25921555af..76fc4f7d05194 100644 --- a/telephony/java/com/android/internal/telephony/DctConstants.java +++ b/telephony/java/com/android/internal/telephony/DctConstants.java @@ -109,11 +109,10 @@ public class DctConstants { public static final int EVENT_DATA_SERVICE_BINDING_CHANGED = BASE + 49; public static final int EVENT_DEVICE_PROVISIONED_CHANGE = BASE + 50; public static final int EVENT_DATA_ENABLED_OVERRIDE_RULES_CHANGED = BASE + 51; - public static final int EVENT_SERVICE_STATE_CHANGED = BASE + 52; - public static final int EVENT_5G_TIMER_HYSTERESIS = BASE + 53; - public static final int EVENT_5G_TIMER_WATCHDOG = BASE + 54; - public static final int EVENT_CARRIER_CONFIG_CHANGED = BASE + 55; - public static final int EVENT_SIM_STATE_UPDATED = BASE + 56; + public static final int EVENT_TELEPHONY_DISPLAY_INFO_CHANGED = BASE + 52; + public static final int EVENT_NR_TIMER_WATCHDOG = BASE + 53; + public static final int EVENT_CARRIER_CONFIG_CHANGED = BASE + 54; + public static final int EVENT_SIM_STATE_UPDATED = BASE + 55; /***** Constants *****/