Add timeout for displaying 5G icon in SystemUI
SystemUI refer CarrierConfig timeout(Second) to show 5G icon gracefully
System UI will show the 5G icon and post message delay by config value
after the device connect to a 5G cell to make the UX better
System UI stop displaying 5G icon when below conditions matched
1. device disconnect from 5G cell
2. the timer is expired.
Fixes: 136636141
Bug: 136107473
Test: atest SystemUITests
Test: enable SystemUI Demo Mode, simulate mServiceState callback 5G
Test: adb shell am broadcast -a com.android.systemui.demo -e command network
-e mobile show -e datatype 5g -e level 4
Test: adb shell am broadcast -a com.android.systemui.demo -e command network
-e mobile show -e datatype 5g+ -e level 4
Design: go/sysui_5g_signal_timer
Change-Id: I5e723c3edf28d31725fa9d847ed3569a1c322739
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 e691b7d..c03f07e 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
@@ -30,6 +30,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import android.app.Instrumentation;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.Network;
@@ -48,6 +49,8 @@
import android.testing.TestableResources;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+
import com.android.internal.telephony.cdma.EriInfo;
import com.android.settingslib.graph.SignalDrawable;
import com.android.settingslib.net.DataUsageController;
@@ -95,6 +98,7 @@
protected SubscriptionDefaults mMockSubDefaults;
protected DeviceProvisionedController mMockProvisionController;
protected DeviceProvisionedListener mUserCallback;
+ protected Instrumentation mInstrumentation;
protected int mSubId;
@@ -116,6 +120,7 @@
@Before
public void setUp() throws Exception {
+ mInstrumentation = InstrumentationRegistry.getInstrumentation();
Settings.Global.putInt(mContext.getContentResolver(), Global.AIRPLANE_MODE_ON, 0);
TestableResources res = mContext.getOrCreateTestableResources();
res.addOverride(R.string.cell_data_off_content_description, NO_DATA_STRING);
@@ -240,6 +245,16 @@
NetworkControllerImpl.Config.add5GIconMapping("not_restricted_rrc_idle:5g", mConfig);
}
+ public void setupDefaultNr5GIconDisplayGracePeriodTime_enableThirtySeconds() {
+ final int enableDisplayGraceTimeSec = 30;
+ NetworkControllerImpl.Config.setDisplayGraceTime(enableDisplayGraceTimeSec, mConfig);
+ }
+
+ public void setupDefaultNr5GIconDisplayGracePeriodTime_disabled() {
+ final int disableDisplayGraceTimeSec = 0;
+ NetworkControllerImpl.Config.setDisplayGraceTime(disableDisplayGraceTimeSec, mConfig);
+ }
+
public void setConnectivityViaBroadcast(
int networkType, boolean validated, boolean isConnected) {
setConnectivityCommon(networkType, validated, isConnected);