diff options
| author | 2019-08-14 16:59:29 +0800 | |
|---|---|---|
| committer | 2019-08-16 16:31:16 +0800 | |
| commit | 52dada71a7c7c39d330f0cc63fac6dcbe1d2356d (patch) | |
| tree | 3607b71984fc8c1cbbf15145497760865fde8111 | |
| parent | a046613c0254f6e075b6aa53c7b84e4fa96fc182 (diff) | |
Extends carrier config KEY_5G_ICON_CONFIGURATION_STRING to support more scenarios.
Add RRC state condition to support more scenarios.
Carrier config KEY_5G_ICON_CONFIGURATION_STRING change default value.
Bug: 138932186
Test: atest NetworkControllerDataTest.java#testNr5GIcon_NrNotRestrictedRrcCon_show5GIcon
atest NetworkControllerDataTest.java#testNr5GIcon_NrNotRestrictedRrcIdle_show5GIcon
Change-Id: Icb8af599f95a09c5e709f00d7710e018218a23cc
6 files changed, 77 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index e75365e66f81..7acf4fd27ced 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -537,8 +537,14 @@ public class MobileSignalController extends SignalController< return mConfig.nr5GIconMap.get(Config.NR_CONNECTED); } } else if (nrState == NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED) { - if (mConfig.nr5GIconMap.containsKey(Config.NR_NOT_RESTRICTED)) { - return mConfig.nr5GIconMap.get(Config.NR_NOT_RESTRICTED); + if (mCurrentState.activityDormant) { + if (mConfig.nr5GIconMap.containsKey(Config.NR_NOT_RESTRICTED_RRC_IDLE)) { + return mConfig.nr5GIconMap.get(Config.NR_NOT_RESTRICTED_RRC_IDLE); + } + } else { + if (mConfig.nr5GIconMap.containsKey(Config.NR_NOT_RESTRICTED_RRC_CON)) { + return mConfig.nr5GIconMap.get(Config.NR_NOT_RESTRICTED_RRC_CON); + } } } else if (nrState == NetworkRegistrationInfo.NR_STATE_RESTRICTED) { if (mConfig.nr5GIconMap.containsKey(Config.NR_RESTRICTED)) { @@ -559,6 +565,8 @@ public class MobileSignalController extends SignalController< || activity == TelephonyManager.DATA_ACTIVITY_IN; mCurrentState.activityOut = activity == TelephonyManager.DATA_ACTIVITY_INOUT || activity == TelephonyManager.DATA_ACTIVITY_OUT; + mCurrentState.activityDormant = activity == TelephonyManager.DATA_ACTIVITY_DORMANT; + notifyListenersIfNecessary(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 1c24bb9e88d1..621b16ab9f41 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -1108,8 +1108,9 @@ public class NetworkControllerImpl extends BroadcastReceiver static class Config { static final int NR_CONNECTED_MMWAVE = 1; static final int NR_CONNECTED = 2; - static final int NR_NOT_RESTRICTED = 3; - static final int NR_RESTRICTED = 4; + static final int NR_NOT_RESTRICTED_RRC_IDLE = 3; + static final int NR_NOT_RESTRICTED_RRC_CON = 4; + static final int NR_RESTRICTED = 5; Map<Integer, MobileIconGroup> nr5GIconMap = new HashMap<>(); @@ -1129,10 +1130,11 @@ public class NetworkControllerImpl extends BroadcastReceiver */ private static final Map<String, Integer> NR_STATUS_STRING_TO_INDEX; static { - NR_STATUS_STRING_TO_INDEX = new HashMap<>(4); + NR_STATUS_STRING_TO_INDEX = new HashMap<>(5); NR_STATUS_STRING_TO_INDEX.put("connected_mmwave", NR_CONNECTED_MMWAVE); NR_STATUS_STRING_TO_INDEX.put("connected", NR_CONNECTED); - NR_STATUS_STRING_TO_INDEX.put("not_restricted", NR_NOT_RESTRICTED); + NR_STATUS_STRING_TO_INDEX.put("not_restricted_rrc_idle", NR_NOT_RESTRICTED_RRC_IDLE); + NR_STATUS_STRING_TO_INDEX.put("not_restricted_rrc_con", NR_NOT_RESTRICTED_RRC_CON); NR_STATUS_STRING_TO_INDEX.put("restricted", NR_RESTRICTED); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java index 9ec30d43ac75..abe3f2c18891 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SignalController.java @@ -258,6 +258,7 @@ public abstract class SignalController<T extends SignalController.State, boolean enabled; boolean activityIn; boolean activityOut; + public boolean activityDormant; int level; IconGroup iconGroup; int inetCondition; @@ -274,6 +275,7 @@ public abstract class SignalController<T extends SignalController.State, inetCondition = state.inetCondition; activityIn = state.activityIn; activityOut = state.activityOut; + activityDormant = state.activityDormant; rssi = state.rssi; time = state.time; } @@ -297,6 +299,7 @@ public abstract class SignalController<T extends SignalController.State, .append("iconGroup=").append(iconGroup).append(',') .append("activityIn=").append(activityIn).append(',') .append("activityOut=").append(activityOut).append(',') + .append("activityDormant=").append(activityDormant).append(',') .append("rssi=").append(rssi).append(',') .append("lastModified=").append(DateFormat.format("MM-dd HH:mm:ss", time)); } @@ -314,6 +317,7 @@ public abstract class SignalController<T extends SignalController.State, && other.iconGroup == iconGroup && other.activityIn == activityIn && other.activityOut == activityOut + && other.activityDormant == activityDormant && other.rssi == rssi; } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java index 9ae9ceb2629f..e691b7dec0d9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java @@ -228,6 +228,18 @@ public class NetworkControllerBaseTest extends SysuiTestCase { NetworkControllerImpl.Config.add5GIconMapping("connected:5g", mConfig); } + public void setupNr5GIconConfigurationForNotRestrictedRrcCon() { + NetworkControllerImpl.Config.add5GIconMapping("connected_mmwave:5g_plus", mConfig); + NetworkControllerImpl.Config.add5GIconMapping("connected:5g_plus", mConfig); + NetworkControllerImpl.Config.add5GIconMapping("not_restricted_rrc_con:5g", mConfig); + } + + public void setupNr5GIconConfigurationForNotRestrictedRrcIdle() { + NetworkControllerImpl.Config.add5GIconMapping("connected_mmwave:5g_plus", mConfig); + NetworkControllerImpl.Config.add5GIconMapping("connected:5g_plus", mConfig); + NetworkControllerImpl.Config.add5GIconMapping("not_restricted_rrc_idle:5g", mConfig); + } + public void setConnectivityViaBroadcast( int networkType, boolean validated, boolean isConnected) { setConnectivityCommon(networkType, validated, isConnected); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java index 5128675e2723..f0394da6f479 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java @@ -175,6 +175,35 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest { } @Test + public void testNr5GIcon_NrNotRestrictedRrcCon_show5GIcon() { + setupNr5GIconConfigurationForNotRestrictedRrcCon(); + setupDefaultSignal(); + updateDataConnectionState(TelephonyManager.DATA_CONNECTED, + TelephonyManager.NETWORK_TYPE_LTE); + updateDataActivity(TelephonyManager.DATA_ACTIVITY_INOUT); + ServiceState ss = Mockito.mock(ServiceState.class); + doReturn(NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED).when(ss).getNrState(); + mPhoneStateListener.onServiceStateChanged(ss); + + verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, TelephonyIcons.ICON_5G, + true, DEFAULT_QS_SIGNAL_STRENGTH, TelephonyIcons.ICON_5G, true, true); + } + + @Test + public void testNr5GIcon_NrNotRestrictedRrcIdle_show5GIcon() { + setupNr5GIconConfigurationForNotRestrictedRrcIdle(); + setupDefaultSignal(); + updateDataConnectionState(TelephonyManager.DATA_CONNECTED, + TelephonyManager.NETWORK_TYPE_LTE); + updateDataActivity(TelephonyManager.DATA_ACTIVITY_DORMANT); + ServiceState ss = Mockito.mock(ServiceState.class); + doReturn(NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED).when(ss).getNrState(); + mPhoneStateListener.onServiceStateChanged(ss); + + verifyDataIndicators(TelephonyIcons.ICON_5G); + } + + @Test public void testNr5GIcon_NrConnectedWithoutMMWave_show5GIcon() { setupDefaultNr5GIconConfiguration(); setupDefaultSignal(); diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index cb7014e56a87..078bf686c94f 100755 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -2616,25 +2616,32 @@ public class CarrierConfigManager { "call_waiting_service_class_int"; /** - * This configuration allow the system UI to display different 5G icon for different 5G status. + * This configuration allow the system UI to display different 5G icon for different 5G + * scenario. * - * There are four 5G status: + * There are five 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: 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. - * 4. restricted: device camped on a network that has 5G capability(not necessary to connect a + * 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. * * The configured string contains multiple key-value pairs separated by comma. For each pair, * the key and value is separated by a colon. The key is corresponded to a 5G status above and * the value is the icon name. Use "None" as the icon name if no icon should be shown in a - * specific 5G status. + * specific 5G scenario. If the scenario is "None", config can skip this key and value. * - * Here is an example of the configuration: - * "connected_mmwave:5GPlus,connected:5G,not_restricted:None,restricted:None" + * Here is an example: + * UE want to display 5GPlus icon for scenario#1, and 5G icon for scenario#2; otherwise no + * define. + * The configuration is: "connected_mmwave:5GPlus,connected:5G" * * @hide */ @@ -3453,7 +3460,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_USE_CALLER_ID_USSD_BOOL, false); sDefaults.putInt(KEY_CALL_WAITING_SERVICE_CLASS_INT, 1 /* SERVICE_CLASS_VOICE */); sDefaults.putString(KEY_5G_ICON_CONFIGURATION_STRING, - "connected_mmwave:None,connected:5G,not_restricted:None,restricted:None"); + "connected_mmwave:5G,connected:5G"); sDefaults.putInt(KEY_5G_ICON_DISPLAY_GRACE_PERIOD_SEC_INT, 0); sDefaults.putBoolean(KEY_ASCII_7_BIT_SUPPORT_FOR_LONG_MESSAGE_BOOL, false); /* Default value is minimum RSRP level needed for SIGNAL_STRENGTH_GOOD */ |