diff options
| author | 2021-09-06 22:32:10 +0800 | |
|---|---|---|
| committer | 2021-09-07 08:16:23 +0000 | |
| commit | 8447f1a19ea806f49b96de0c4d38ede752b5ed86 (patch) | |
| tree | cc4598c668d5afae369af2f712320efaf8f12bc8 | |
| parent | a0cb9839d26cbe6574274daa9219cc663683cecd (diff) | |
[Provider Model] Don't show Wi-Fi icon if the level is -1
- Since WIFI_LEVEL_UNREACHABLE (-1) is not 100% avoidable
- Don't show Wi-Fi icon if it's no level.
Bug: 198742993
Test: manual test
atest -c InternetDialogControllerTest
Change-Id: I9496d371a4ddfb71fd8e0c742c8e0d60a356a456
2 files changed, 13 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java index 5acfa55277ce..d0d021c65e8a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/InternetDialogController.java @@ -337,6 +337,9 @@ public class InternetDialogController implements WifiEntry.DisconnectCallback, } Drawable getInternetWifiDrawable(@NonNull WifiEntry wifiEntry) { + if (wifiEntry.getLevel() == WifiEntry.WIFI_LEVEL_UNREACHABLE) { + return null; + } final Drawable drawable = mWifiIconInjector.getIcon(wifiEntry.shouldShowXLevelIcon(), wifiEntry.getLevel()); if (drawable == null) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogControllerTest.java index 0f22e575beb6..baddacc3e6f5 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/dialog/InternetDialogControllerTest.java @@ -259,7 +259,7 @@ public class InternetDialogControllerTest extends SysuiTestCase { } @Test - public void getWifiDrawable_withConnectedEntry_returnIntentIconWithCorrectColor() { + public void getInternetWifiDrawable_withConnectedEntry_returnIntentIconWithCorrectColor() { final Drawable drawable = mock(Drawable.class); when(mWifiIconInjector.getIcon(anyBoolean(), anyInt())).thenReturn(drawable); @@ -270,6 +270,15 @@ public class InternetDialogControllerTest extends SysuiTestCase { } @Test + public void getInternetWifiDrawable_withWifiLevelUnreachable_returnNull() { + when(mConnectedEntry.getLevel()).thenReturn(WifiEntry.WIFI_LEVEL_UNREACHABLE); + + Drawable drawable = mInternetDialogController.getInternetWifiDrawable(mConnectedEntry); + + assertThat(drawable).isNull(); + } + + @Test public void launchWifiNetworkDetailsSetting_withNoWifiEntryKey_doNothing() { mInternetDialogController.launchWifiNetworkDetailsSetting(null /* key */); |