From 581ae211a28b984c8ea2f4f354bc82e5a6c1352b Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Thu, 9 Mar 2023 20:48:39 +0000 Subject: [PATCH] [SB Refactor] Don't display the wifi icon if wifi isn't default. Fixes: 272509965 Test: atest WifiViewModelTest Test: on a device with no or invalid mobile connection, turn wifi off then back on. Verify that you still see a wifi icon with the exclamation mark first, then a wifi icon with no exclamation mark. Test: on a device with a valid mobile connection, turn wifi off then back on. Verify that you only see the wifi icon when the wifi is fully connected (never see wifi icon with no exclamation mark) Test: on a device with a valid mobile connection, enter an area with low quality wifi. verify that you never see both the RAT icon ("LTE", "5G", etc.) *and* the wifi icon at the same time. Change-Id: I6693a03e8894c2e8eb8c08e528d6e53eae533d9b --- .../wifi/ui/viewmodel/WifiViewModel.kt | 3 ++- .../WifiViewModelIconParameterizedTest.kt | 25 ++++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt index 105723156b50b..4b24e7a390e49 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt @@ -124,7 +124,8 @@ constructor( isDefault -> icon wifiConstants.alwaysShowIconIfEnabled -> icon !connectivityConstants.hasDataCapabilities -> icon - wifiNetwork is WifiNetworkModel.Active && wifiNetwork.isValidated -> icon + // See b/272509965: Even if we have an active and validated wifi network, we + // don't want to show the icon if wifi isn't the default network. else -> WifiIcon.Hidden } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelIconParameterizedTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelIconParameterizedTest.kt index 12b16640c0c22..1c71f8ba0aa3d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelIconParameterizedTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelIconParameterizedTest.kt @@ -368,40 +368,37 @@ internal class WifiViewModelIconParameterizedTest(private val testCase: TestCase // network = CarrierMerged => not shown TestCase( + enabled = true, + isDefault = true, + forceHidden = false, network = WifiNetworkModel.CarrierMerged(NETWORK_ID, subscriptionId = 1, level = 1), expected = null, ), - // network = Inactive => not shown + // isDefault = false => no networks shown TestCase( + isDefault = false, network = WifiNetworkModel.Inactive, expected = null, ), - - // network = Unavailable => not shown TestCase( + isDefault = false, network = WifiNetworkModel.Unavailable, expected = null, ), - - // network = Active & validated = false => not shown TestCase( + isDefault = false, network = WifiNetworkModel.Active(NETWORK_ID, isValidated = false, level = 3), expected = null, ), - // network = Active & validated = true => shown + // Even though this network is active and validated, we still doesn't want it shown + // because wifi isn't the default connection (b/272509965). TestCase( + isDefault = false, network = WifiNetworkModel.Active(NETWORK_ID, isValidated = true, level = 4), - expected = - Expected( - iconResource = WIFI_FULL_ICONS[4], - contentDescription = { context -> - context.getString(WIFI_CONNECTION_STRENGTH[4]) - }, - description = "Full internet level 4 icon", - ), + expected = null, ), ) }