Add 5G icon to System UI
This add the 5G and 5G+ icon to the system UI for 5G Non-Standalone
network.
System UI uses the ServiceState & CarrierConfig to determine whether and
which 5G icon should be displayed in 5G Non-Standalone network.
Bug: 111497313, 111453000
Test: build & manually test
Change-Id: I6fba0f9c42fff3cb1398895b122f18f13de239f7
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 d42940a..2baea1a 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
@@ -1,11 +1,14 @@
package com.android.systemui.statusbar.policy;
import static org.mockito.Matchers.anyInt;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import android.net.NetworkCapabilities;
import android.os.Looper;
+import android.telephony.NetworkRegistrationState;
+import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
@@ -16,6 +19,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mockito;
@SmallTest
@RunWith(AndroidTestingRunner.class)
@@ -141,6 +145,47 @@
}
@Test
+ public void testNr5GIcon_NrConnectedWithoutMMWave_show5GIcon() {
+ setupDefaultNr5GIconConfiguration();
+ setupDefaultSignal();
+ updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
+ TelephonyManager.NETWORK_TYPE_LTE);
+ ServiceState ss = Mockito.mock(ServiceState.class);
+ doReturn(NetworkRegistrationState.NR_STATUS_CONNECTED).when(ss).getNrStatus();
+ doReturn(ServiceState.FREQUENCY_RANGE_HIGH).when(ss).getNrFrequencyRange();
+ mPhoneStateListener.onServiceStateChanged(ss);
+
+ verifyDataIndicators(TelephonyIcons.ICON_5G);
+ }
+
+ @Test
+ public void testNr5GIcon_NrConnectedWithMMWave_show5GPlusIcon() {
+ setupDefaultNr5GIconConfiguration();
+ setupDefaultSignal();
+ updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
+ TelephonyManager.NETWORK_TYPE_LTE);
+ ServiceState ss = Mockito.mock(ServiceState.class);
+ doReturn(NetworkRegistrationState.NR_STATUS_CONNECTED).when(ss).getNrStatus();
+ doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(ss).getNrFrequencyRange();
+ mPhoneStateListener.onServiceStateChanged(ss);
+
+ verifyDataIndicators(TelephonyIcons.ICON_5G_PLUS);
+ }
+
+ @Test
+ public void testNr5GIcon_NrRestricted_showLteIcon() {
+ setupDefaultNr5GIconConfiguration();
+ setupDefaultSignal();
+ updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
+ TelephonyManager.NETWORK_TYPE_LTE);
+ ServiceState ss = Mockito.mock(ServiceState.class);
+ doReturn(NetworkRegistrationState.NR_STATUS_RESTRICTED).when(ss).getNrStatus();
+ mPhoneStateListener.onServiceStateChanged(mServiceState);
+
+ verifyDataIndicators(TelephonyIcons.ICON_LTE);
+ }
+
+ @Test
public void testDataDisabledIcon_UserNotSetup() {
setupNetworkController();
when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
@@ -222,5 +267,4 @@
true, DEFAULT_QS_SIGNAL_STRENGTH, dataIcon, false,
false);
}
-
}