Merge changes from topic "caitlinshk-wifi-networkid" into main
* changes:
[SB][Wifi] Remove unused networkId from WifiNetworkModel classes.
[SB][Wifi] Remove passpoint-related values from wifi pipeline.
[SB][Wifi] Save WifiEntry.level to local variable to avoid crashes.
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/interactor/InternetTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/interactor/InternetTileDataInteractorTest.kt
index 6f11b2a..aaad0fc 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/interactor/InternetTileDataInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/interactor/InternetTileDataInteractorTest.kt
@@ -185,7 +185,6 @@
val networkModel =
WifiNetworkModel.Active(
- networkId = 1,
level = 4,
ssid = "test ssid",
)
@@ -221,7 +220,6 @@
val networkModel =
WifiNetworkModel.Active(
- networkId = 1,
level = 4,
ssid = "test ssid",
hotspotDeviceType = WifiNetworkModel.HotspotDeviceType.NONE,
@@ -546,7 +544,6 @@
private fun setWifiNetworkWithHotspot(hotspot: WifiNetworkModel.HotspotDeviceType) {
val networkModel =
WifiNetworkModel.Active(
- networkId = 1,
level = 4,
ssid = "test ssid",
hotspotDeviceType = hotspot,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractorImplTest.kt
index 84c728c..b9ca8fc 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractorImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractorImplTest.kt
@@ -93,7 +93,7 @@
fun ssid_carrierMergedNetwork_outputsNull() =
testScope.runTest {
wifiRepository.setWifiNetwork(
- WifiNetworkModel.CarrierMerged(networkId = 1, subscriptionId = 2, level = 1)
+ WifiNetworkModel.CarrierMerged(subscriptionId = 2, level = 1)
)
var latest: String? = "default"
@@ -106,53 +106,10 @@
}
@Test
- fun ssid_isPasspointAccessPoint_outputsPasspointName() =
- testScope.runTest {
- wifiRepository.setWifiNetwork(
- WifiNetworkModel.Active(
- networkId = 1,
- level = 1,
- isPasspointAccessPoint = true,
- passpointProviderFriendlyName = "friendly",
- )
- )
-
- var latest: String? = null
- val job = underTest.ssid.onEach { latest = it }.launchIn(this)
- runCurrent()
-
- assertThat(latest).isEqualTo("friendly")
-
- job.cancel()
- }
-
- @Test
- fun ssid_isOnlineSignUpForPasspoint_outputsPasspointName() =
- testScope.runTest {
- wifiRepository.setWifiNetwork(
- WifiNetworkModel.Active(
- networkId = 1,
- level = 1,
- isOnlineSignUpForPasspointAccessPoint = true,
- passpointProviderFriendlyName = "friendly",
- )
- )
-
- var latest: String? = null
- val job = underTest.ssid.onEach { latest = it }.launchIn(this)
- runCurrent()
-
- assertThat(latest).isEqualTo("friendly")
-
- job.cancel()
- }
-
- @Test
fun ssid_unknownSsid_outputsNull() =
testScope.runTest {
wifiRepository.setWifiNetwork(
WifiNetworkModel.Active(
- networkId = 1,
level = 1,
ssid = WifiManager.UNKNOWN_SSID,
)
@@ -172,7 +129,6 @@
testScope.runTest {
wifiRepository.setWifiNetwork(
WifiNetworkModel.Active(
- networkId = 1,
level = 1,
ssid = "MyAwesomeWifiNetwork",
)
@@ -234,11 +190,9 @@
testScope.runTest {
val wifiNetwork =
WifiNetworkModel.Active(
- networkId = 45,
isValidated = true,
level = 3,
ssid = "AB",
- passpointProviderFriendlyName = "friendly"
)
wifiRepository.setWifiNetwork(wifiNetwork)
@@ -346,7 +300,6 @@
wifiRepository.setWifiNetwork(
WifiNetworkModel.Active(
ssid = "ssid 2",
- networkId = 1,
level = 2,
)
)
@@ -367,7 +320,6 @@
wifiRepository.setWifiNetwork(
WifiNetworkModel.Active(
ssid = "ssid 2",
- networkId = 1,
level = 2,
)
)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelTest.kt
index dc24cf7..72a45b9 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelTest.kt
@@ -115,9 +115,7 @@
val latestKeyguard by collectLastValue(keyguard.wifiIcon)
val latestQs by collectLastValue(qs.wifiIcon)
- wifiRepository.setWifiNetwork(
- WifiNetworkModel.Active(NETWORK_ID, isValidated = true, level = 1)
- )
+ wifiRepository.setWifiNetwork(WifiNetworkModel.Active(isValidated = true, level = 1))
assertThat(latestHome).isInstanceOf(WifiIcon.Visible::class.java)
assertThat(latestHome).isEqualTo(latestKeyguard)
@@ -132,7 +130,6 @@
// Even WHEN the network has a valid hotspot type
wifiRepository.setWifiNetwork(
WifiNetworkModel.Active(
- NETWORK_ID,
isValidated = true,
level = 1,
hotspotDeviceType = WifiNetworkModel.HotspotDeviceType.LAPTOP,
@@ -194,9 +191,7 @@
whenever(connectivityConstants.shouldShowActivityConfig).thenReturn(true)
createAndSetViewModel()
- wifiRepository.setWifiNetwork(
- WifiNetworkModel.Active(NETWORK_ID, ssid = null, level = 1)
- )
+ wifiRepository.setWifiNetwork(WifiNetworkModel.Active(ssid = null, level = 1))
val activityIn by collectLastValue(underTest.isActivityInViewVisible)
val activityOut by collectLastValue(underTest.isActivityOutViewVisible)
@@ -219,9 +214,7 @@
whenever(connectivityConstants.shouldShowActivityConfig).thenReturn(true)
createAndSetViewModel()
- wifiRepository.setWifiNetwork(
- WifiNetworkModel.Active(NETWORK_ID, ssid = null, level = 1)
- )
+ wifiRepository.setWifiNetwork(WifiNetworkModel.Active(ssid = null, level = 1))
val activityIn by collectLastValue(underTest.isActivityInViewVisible)
val activityOut by collectLastValue(underTest.isActivityOutViewVisible)
@@ -470,8 +463,6 @@
}
companion object {
- private const val NETWORK_ID = 2
- private val ACTIVE_VALID_WIFI_NETWORK =
- WifiNetworkModel.Active(NETWORK_ID, ssid = "AB", level = 1)
+ private val ACTIVE_VALID_WIFI_NETWORK = WifiNetworkModel.Active(ssid = "AB", level = 1)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/demo/DemoWifiRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/demo/DemoWifiRepository.kt
index 152d181..7163e67 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/demo/DemoWifiRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/demo/DemoWifiRepository.kt
@@ -101,29 +101,20 @@
private fun FakeWifiEventModel.Wifi.toWifiNetworkModel(): WifiNetworkModel =
WifiNetworkModel.Active(
- networkId = DEMO_NET_ID,
isValidated = validated ?: true,
level = level ?: 0,
ssid = ssid ?: DEMO_NET_SSID,
hotspotDeviceType = hotspotDeviceType,
-
- // These fields below aren't supported in demo mode, since they aren't needed to satisfy
- // the interface.
- isPasspointAccessPoint = false,
- isOnlineSignUpForPasspointAccessPoint = false,
- passpointProviderFriendlyName = null,
)
private fun FakeWifiEventModel.CarrierMerged.toCarrierMergedModel(): WifiNetworkModel =
WifiNetworkModel.CarrierMerged(
- networkId = DEMO_NET_ID,
subscriptionId = subscriptionId,
level = level,
numberOfLevels = numberOfLevels,
)
companion object {
- private const val DEMO_NET_ID = 1234
private const val DEMO_NET_SSID = "Demo SSID"
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt
index 7df4b2c..b6e73e0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImpl.kt
@@ -250,7 +250,6 @@
WifiNetworkModel.Invalid(CARRIER_MERGED_INVALID_SUB_ID_REASON)
} else {
WifiNetworkModel.CarrierMerged(
- networkId = NETWORK_ID,
subscriptionId = this.subscriptionId,
level = this.level,
// WifiManager APIs to calculate the signal level start from 0, so
@@ -261,7 +260,17 @@
}
private fun WifiEntry.convertNormalToModel(): WifiNetworkModel {
- if (this.level == WIFI_LEVEL_UNREACHABLE || this.level !in WIFI_LEVEL_MIN..WIFI_LEVEL_MAX) {
+ // WifiEntry instance values aren't guaranteed to be stable between method calls because
+ // WifiPickerTracker is continuously updating the same object. Save the level in a local
+ // variable so that checking the level validity here guarantees that the level will still be
+ // valid when we create the `WifiNetworkModel.Active` instance later. Otherwise, the level
+ // could be valid here but become invalid later, and `WifiNetworkModel.Active` will throw
+ // an exception. See b/362384551.
+ val currentLevel = this.level
+ if (
+ currentLevel == WIFI_LEVEL_UNREACHABLE ||
+ currentLevel !in WIFI_LEVEL_MIN..WIFI_LEVEL_MAX
+ ) {
// If our level means the network is unreachable or the level is otherwise invalid, we
// don't have an active network.
return WifiNetworkModel.Inactive
@@ -275,19 +284,10 @@
}
return WifiNetworkModel.Active(
- networkId = NETWORK_ID,
isValidated = this.hasInternetAccess(),
- level = this.level,
+ level = currentLevel,
ssid = this.title,
hotspotDeviceType = hotspotDeviceType,
- // With WifiTrackerLib, [WifiEntry.title] will appropriately fetch the SSID for
- // typical wifi networks *and* passpoint/OSU APs. So, the AP-specific values can
- // always be false/null in this repository.
- // TODO(b/292534484): Remove these fields from the wifi network model once this
- // repository is fully enabled.
- isPasspointAccessPoint = false,
- isOnlineSignUpForPasspointAccessPoint = false,
- passpointProviderFriendlyName = null,
)
}
@@ -428,19 +428,5 @@
val ACTIVITY_DEFAULT = DataActivityModel(hasActivityIn = false, hasActivityOut = false)
private const val TAG = "WifiTrackerLibInputLog"
-
- /**
- * [WifiNetworkModel.Active.networkId] is only used at the repository layer. It's used by
- * [WifiRepositoryImpl], which tracks the ID in order to correctly apply the framework
- * callbacks within the repository.
- *
- * Since this class does not need to manually apply framework callbacks and since the
- * network ID is not used beyond the repository, it's safe to use an invalid ID in this
- * repository.
- *
- * The [WifiNetworkModel.Active.networkId] field should be deleted once we've fully migrated
- * to [WifiRepositoryImpl].
- */
- private const val NETWORK_ID = -1
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractor.kt
index 110e339..c0b0c4a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/domain/interactor/WifiInteractor.kt
@@ -83,8 +83,6 @@
is WifiNetworkModel.CarrierMerged -> null
is WifiNetworkModel.Active ->
when {
- info.isPasspointAccessPoint || info.isOnlineSignUpForPasspointAccessPoint ->
- info.passpointProviderFriendlyName
info.hasValidSsid() -> info.ssid
else -> null
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModel.kt
index 7078a2e..39842fb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModel.kt
@@ -24,6 +24,7 @@
import com.android.systemui.log.table.TableRowLogger
import com.android.systemui.statusbar.pipeline.mobile.data.repository.MobileConnectionRepository
import com.android.wifitrackerlib.HotspotNetworkEntry.DeviceType
+import com.android.wifitrackerlib.WifiEntry
/** Provides information about the current wifi network. */
sealed class WifiNetworkModel : Diffable<WifiNetworkModel> {
@@ -38,6 +39,7 @@
*/
object Unavailable : WifiNetworkModel() {
override fun toString() = "WifiNetwork.Unavailable"
+
override fun logDiffs(prevVal: WifiNetworkModel, row: TableRowLogger) {
if (prevVal is Unavailable) {
return
@@ -48,16 +50,12 @@
override fun logFull(row: TableRowLogger) {
row.logChange(COL_NETWORK_TYPE, TYPE_UNAVAILABLE)
- row.logChange(COL_NETWORK_ID, NETWORK_ID_DEFAULT)
row.logChange(COL_SUB_ID, SUB_ID_DEFAULT)
row.logChange(COL_VALIDATED, false)
row.logChange(COL_LEVEL, LEVEL_DEFAULT)
row.logChange(COL_NUM_LEVELS, NUM_LEVELS_DEFAULT)
row.logChange(COL_SSID, null)
row.logChange(COL_HOTSPOT, null)
- row.logChange(COL_PASSPOINT_ACCESS_POINT, false)
- row.logChange(COL_ONLINE_SIGN_UP, false)
- row.logChange(COL_PASSPOINT_NAME, null)
}
}
@@ -67,6 +65,7 @@
val invalidReason: String,
) : WifiNetworkModel() {
override fun toString() = "WifiNetwork.Invalid[$invalidReason]"
+
override fun logDiffs(prevVal: WifiNetworkModel, row: TableRowLogger) {
if (prevVal !is Invalid) {
logFull(row)
@@ -80,16 +79,12 @@
override fun logFull(row: TableRowLogger) {
row.logChange(COL_NETWORK_TYPE, "$TYPE_UNAVAILABLE $invalidReason")
- row.logChange(COL_NETWORK_ID, NETWORK_ID_DEFAULT)
row.logChange(COL_SUB_ID, SUB_ID_DEFAULT)
row.logChange(COL_VALIDATED, false)
row.logChange(COL_LEVEL, LEVEL_DEFAULT)
row.logChange(COL_NUM_LEVELS, NUM_LEVELS_DEFAULT)
row.logChange(COL_SSID, null)
row.logChange(COL_HOTSPOT, null)
- row.logChange(COL_PASSPOINT_ACCESS_POINT, false)
- row.logChange(COL_ONLINE_SIGN_UP, false)
- row.logChange(COL_PASSPOINT_NAME, null)
}
}
@@ -108,16 +103,12 @@
override fun logFull(row: TableRowLogger) {
row.logChange(COL_NETWORK_TYPE, TYPE_INACTIVE)
- row.logChange(COL_NETWORK_ID, NETWORK_ID_DEFAULT)
row.logChange(COL_SUB_ID, SUB_ID_DEFAULT)
row.logChange(COL_VALIDATED, false)
row.logChange(COL_LEVEL, LEVEL_DEFAULT)
row.logChange(COL_NUM_LEVELS, NUM_LEVELS_DEFAULT)
row.logChange(COL_SSID, null)
row.logChange(COL_HOTSPOT, null)
- row.logChange(COL_PASSPOINT_ACCESS_POINT, false)
- row.logChange(COL_ONLINE_SIGN_UP, false)
- row.logChange(COL_PASSPOINT_NAME, null)
}
}
@@ -129,14 +120,6 @@
*/
data class CarrierMerged(
/**
- * The [android.net.Network.netId] we received from
- * [android.net.ConnectivityManager.NetworkCallback] in association with this wifi network.
- *
- * Importantly, **not** [android.net.wifi.WifiInfo.getNetworkId].
- */
- val networkId: Int,
-
- /**
* The subscription ID that this connection represents.
*
* Comes from [android.net.wifi.WifiInfo.getSubscriptionId].
@@ -154,7 +137,8 @@
) : WifiNetworkModel() {
init {
require(level in MIN_VALID_LEVEL..numberOfLevels) {
- "0 <= wifi level <= $numberOfLevels required; level was $level"
+ "CarrierMerged: $MIN_VALID_LEVEL <= wifi level <= $numberOfLevels required; " +
+ "level was $level"
}
require(subscriptionId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
"subscription ID cannot be invalid"
@@ -167,9 +151,6 @@
return
}
- if (prevVal.networkId != networkId) {
- row.logChange(COL_NETWORK_ID, networkId)
- }
if (prevVal.subscriptionId != subscriptionId) {
row.logChange(COL_SUB_ID, subscriptionId)
}
@@ -183,29 +164,17 @@
override fun logFull(row: TableRowLogger) {
row.logChange(COL_NETWORK_TYPE, TYPE_CARRIER_MERGED)
- row.logChange(COL_NETWORK_ID, networkId)
row.logChange(COL_SUB_ID, subscriptionId)
row.logChange(COL_VALIDATED, true)
row.logChange(COL_LEVEL, level)
row.logChange(COL_NUM_LEVELS, numberOfLevels)
row.logChange(COL_SSID, null)
row.logChange(COL_HOTSPOT, null)
- row.logChange(COL_PASSPOINT_ACCESS_POINT, false)
- row.logChange(COL_ONLINE_SIGN_UP, false)
- row.logChange(COL_PASSPOINT_NAME, null)
}
}
/** Provides information about an active wifi network. */
data class Active(
- /**
- * The [android.net.Network.netId] we received from
- * [android.net.ConnectivityManager.NetworkCallback] in association with this wifi network.
- *
- * Importantly, **not** [android.net.wifi.WifiInfo.getNetworkId].
- */
- val networkId: Int,
-
/** See [android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED]. */
val isValidated: Boolean = false,
@@ -220,19 +189,11 @@
* isn't a hotspot connection.
*/
val hotspotDeviceType: HotspotDeviceType = WifiNetworkModel.HotspotDeviceType.NONE,
-
- /** See [android.net.wifi.WifiInfo.isPasspointAp]. */
- val isPasspointAccessPoint: Boolean = false,
-
- /** See [android.net.wifi.WifiInfo.isOsuAp]. */
- val isOnlineSignUpForPasspointAccessPoint: Boolean = false,
-
- /** See [android.net.wifi.WifiInfo.passpointProviderFriendlyName]. */
- val passpointProviderFriendlyName: String? = null,
) : WifiNetworkModel() {
init {
require(level in MIN_VALID_LEVEL..MAX_VALID_LEVEL) {
- "0 <= wifi level <= 4 required; level was $level"
+ "Active: $MIN_VALID_LEVEL <= wifi level <= $MAX_VALID_LEVEL required; " +
+ "level was $level"
}
}
@@ -247,9 +208,6 @@
return
}
- if (prevVal.networkId != networkId) {
- row.logChange(COL_NETWORK_ID, networkId)
- }
if (prevVal.isValidated != isValidated) {
row.logChange(COL_VALIDATED, isValidated)
}
@@ -262,68 +220,25 @@
if (prevVal.hotspotDeviceType != hotspotDeviceType) {
row.logChange(COL_HOTSPOT, hotspotDeviceType.name)
}
-
- // TODO(b/238425913): The passpoint-related values are frequently never used, so it
- // would be great to not log them when they're not used.
- if (prevVal.isPasspointAccessPoint != isPasspointAccessPoint) {
- row.logChange(COL_PASSPOINT_ACCESS_POINT, isPasspointAccessPoint)
- }
- if (
- prevVal.isOnlineSignUpForPasspointAccessPoint !=
- isOnlineSignUpForPasspointAccessPoint
- ) {
- row.logChange(COL_ONLINE_SIGN_UP, isOnlineSignUpForPasspointAccessPoint)
- }
- if (prevVal.passpointProviderFriendlyName != passpointProviderFriendlyName) {
- row.logChange(COL_PASSPOINT_NAME, passpointProviderFriendlyName)
- }
}
override fun logFull(row: TableRowLogger) {
row.logChange(COL_NETWORK_TYPE, TYPE_ACTIVE)
- row.logChange(COL_NETWORK_ID, networkId)
row.logChange(COL_SUB_ID, null)
row.logChange(COL_VALIDATED, isValidated)
row.logChange(COL_LEVEL, level)
row.logChange(COL_NUM_LEVELS, null)
row.logChange(COL_SSID, ssid)
row.logChange(COL_HOTSPOT, hotspotDeviceType.name)
- row.logChange(COL_PASSPOINT_ACCESS_POINT, isPasspointAccessPoint)
- row.logChange(COL_ONLINE_SIGN_UP, isOnlineSignUpForPasspointAccessPoint)
- row.logChange(COL_PASSPOINT_NAME, passpointProviderFriendlyName)
- }
-
- override fun toString(): String {
- // Only include the passpoint-related values in the string if we have them. (Most
- // networks won't have them so they'll be mostly clutter.)
- val passpointString =
- if (
- isPasspointAccessPoint ||
- isOnlineSignUpForPasspointAccessPoint ||
- passpointProviderFriendlyName != null
- ) {
- ", isPasspointAp=$isPasspointAccessPoint, " +
- "isOnlineSignUpForPasspointAp=$isOnlineSignUpForPasspointAccessPoint, " +
- "passpointName=$passpointProviderFriendlyName"
- } else {
- ""
- }
-
- return "WifiNetworkModel.Active(networkId=$networkId, isValidated=$isValidated, " +
- "level=$level, ssid=$ssid$passpointString)"
}
companion object {
- // TODO(b/292534484): Use [com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_MAX] instead
- // once the migration to WifiTrackerLib is complete.
- @VisibleForTesting internal const val MAX_VALID_LEVEL = 4
+ @VisibleForTesting internal const val MAX_VALID_LEVEL = WifiEntry.WIFI_LEVEL_MAX
}
}
companion object {
- // TODO(b/292534484): Use [com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_MIN] instead
- // once the migration to WifiTrackerLib is complete.
- @VisibleForTesting internal const val MIN_VALID_LEVEL = 0
+ @VisibleForTesting internal const val MIN_VALID_LEVEL = WifiEntry.WIFI_LEVEL_MIN
}
/**
@@ -367,18 +282,13 @@
const val TYPE_ACTIVE = "Active"
const val COL_NETWORK_TYPE = "type"
-const val COL_NETWORK_ID = "networkId"
const val COL_SUB_ID = "subscriptionId"
const val COL_VALIDATED = "isValidated"
const val COL_LEVEL = "level"
const val COL_NUM_LEVELS = "maxLevel"
const val COL_SSID = "ssid"
const val COL_HOTSPOT = "hotspot"
-const val COL_PASSPOINT_ACCESS_POINT = "isPasspointAccessPoint"
-const val COL_ONLINE_SIGN_UP = "isOnlineSignUpForPasspointAccessPoint"
-const val COL_PASSPOINT_NAME = "passpointProviderFriendlyName"
val LEVEL_DEFAULT: String? = null
val NUM_LEVELS_DEFAULT: String? = null
-val NETWORK_ID_DEFAULT: String? = null
val SUB_ID_DEFAULT: String? = null
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java
index a8ab922..d85b774 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextManagerTest.java
@@ -446,14 +446,10 @@
assertFalse(mWifiRepository.isWifiConnectedWithValidSsid());
mWifiRepository.setWifiNetwork(
new WifiNetworkModel.Active(
- /* networkId= */ 0,
/* isValidated= */ false,
/* level= */ 0,
/* ssid= */ "",
- /* hotspotDeviceType= */ WifiNetworkModel.HotspotDeviceType.NONE,
- /* isPasspointAccessPoint= */ false,
- /* isOnlineSignUpForPasspointAccessPoint= */ false,
- /* passpointProviderFriendlyName= */ null));
+ /* hotspotDeviceType= */ WifiNetworkModel.HotspotDeviceType.NONE));
assertTrue(mWifiRepository.isWifiConnectedWithValidSsid());
mKeyguardUpdateMonitor.mServiceStates = new HashMap<>();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt
index 828c7b2..e6ec07e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/InternetTileNewImplTest.kt
@@ -259,7 +259,6 @@
const val WIFI_SSID = "test ssid"
val ACTIVE_WIFI =
WifiNetworkModel.Active(
- networkId = 1,
isValidated = true,
level = 4,
ssid = WIFI_SSID,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt
index 237aabc..b6e23c1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/CarrierMergedConnectionRepositoryTest.kt
@@ -104,7 +104,7 @@
underTest.dataConnectionState.onEach { latestConnState = it }.launchIn(this)
val netJob = underTest.resolvedNetworkType.onEach { latestNetType = it }.launchIn(this)
- wifiRepository.setWifiNetwork(WifiNetworkModel.Active(networkId = NET_ID, level = 1))
+ wifiRepository.setWifiNetwork(WifiNetworkModel.Active(level = 1))
assertThat(latestConnState).isEqualTo(DataConnectionState.Disconnected)
assertThat(latestNetType).isNotEqualTo(ResolvedNetworkType.CarrierMergedNetworkType)
@@ -124,7 +124,6 @@
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId = NET_ID,
subscriptionId = SUB_ID,
level = 3,
)
@@ -145,7 +144,6 @@
wifiRepository.setIsWifiDefault(true)
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId = NET_ID,
subscriptionId = SUB_ID,
level = 3,
)
@@ -183,7 +181,6 @@
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId = NET_ID,
subscriptionId = SUB_ID + 10,
level = 3,
)
@@ -205,7 +202,6 @@
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId = NET_ID,
subscriptionId = SUB_ID,
level = 3,
)
@@ -226,7 +222,6 @@
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId = NET_ID,
subscriptionId = SUB_ID,
level = 3,
)
@@ -246,7 +241,6 @@
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId = NET_ID,
subscriptionId = SUB_ID,
level = 1,
numberOfLevels = 6,
@@ -310,7 +304,6 @@
whenever(telephonyManager.simOperatorName).thenReturn("New SIM name")
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId = NET_ID,
subscriptionId = SUB_ID,
level = 3,
)
@@ -331,6 +324,5 @@
private companion object {
const val SUB_ID = 123
- const val NET_ID = 456
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt
index c029850..a03980a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt
@@ -487,10 +487,8 @@
val job = underTest.primaryLevel.launchIn(this)
// WHEN we set up carrier merged info
- val networkId = 2
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId,
SUB_ID,
level = 3,
)
@@ -502,7 +500,6 @@
// WHEN we update the info
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId,
SUB_ID,
level = 1,
)
@@ -540,10 +537,8 @@
assertThat(dumpBuffer()).contains("$COL_PRIMARY_LEVEL${BUFFER_SEPARATOR}1")
// WHEN isCarrierMerged is set to true
- val networkId = 2
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId,
SUB_ID,
level = 3,
)
@@ -556,7 +551,6 @@
// WHEN the carrier merge network is updated
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId,
SUB_ID,
level = 4,
)
@@ -607,10 +601,8 @@
.onSignalStrengthsChanged(signalStrength)
// THEN updates to the carrier merged level aren't logged
- val networkId = 2
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId,
SUB_ID,
level = 4,
)
@@ -619,7 +611,6 @@
wifiRepository.setWifiNetwork(
WifiNetworkModel.CarrierMerged(
- networkId,
SUB_ID,
level = 3,
)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractorTest.kt
index dbb77d5..a1cb29b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/domain/interactor/DeviceBasedSatelliteInteractorTest.kt
@@ -574,7 +574,7 @@
val latest by collectLastValue(underTest.isWifiActive)
// WHEN wifi is active
- wifiRepository.setWifiNetwork(WifiNetworkModel.Active(networkId = 0, level = 1))
+ wifiRepository.setWifiNetwork(WifiNetworkModel.Active(level = 1))
// THEN the interactor returns true due to the wifi network being active
assertThat(latest).isTrue()
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt
index bf31f1e..c1abf98 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/satellite/ui/viewmodel/DeviceBasedSatelliteViewModelTest.kt
@@ -375,7 +375,7 @@
repo.isSatelliteProvisioned.value = true
// GIVEN wifi network is active
- wifiRepository.setWifiNetwork(WifiNetworkModel.Active(networkId = 0, level = 1))
+ wifiRepository.setWifiNetwork(WifiNetworkModel.Active(level = 1))
// THEN icon is null because the device is connected to wifi
assertThat(latest).isNull()
@@ -573,7 +573,7 @@
repo.isSatelliteProvisioned.value = true
// GIVEN wifi network is active
- wifiRepository.setWifiNetwork(WifiNetworkModel.Active(networkId = 0, level = 1))
+ wifiRepository.setWifiNetwork(WifiNetworkModel.Active(level = 1))
// THEN carrier text is null because the device is connected to wifi
assertThat(latest).isNull()
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/InternetTileViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/InternetTileViewModelTest.kt
index 50f262c..fed3317 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/InternetTileViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/InternetTileViewModelTest.kt
@@ -155,7 +155,6 @@
val networkModel =
WifiNetworkModel.Active(
- networkId = 1,
level = 4,
ssid = "test ssid",
)
@@ -185,7 +184,6 @@
val networkModel =
WifiNetworkModel.Active(
- networkId = 1,
level = 4,
ssid = "test ssid",
hotspotDeviceType = WifiNetworkModel.HotspotDeviceType.NONE,
@@ -393,7 +391,6 @@
private fun setWifiNetworkWithHotspot(hotspot: WifiNetworkModel.HotspotDeviceType) {
val networkModel =
WifiNetworkModel.Active(
- networkId = 1,
level = 4,
ssid = "test ssid",
hotspotDeviceType = hotspot,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImplTest.kt
index b9c57d8..46f34e8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/data/repository/prod/WifiRepositoryImplTest.kt
@@ -283,27 +283,6 @@
}
@Test
- fun accessPointInfo_alwaysFalse() =
- testScope.runTest {
- val latest by collectLastValue(underTest.wifiNetwork)
-
- val wifiEntry =
- mock<WifiEntry>().apply {
- whenever(this.isPrimaryNetwork).thenReturn(true)
- whenever(this.level).thenReturn(3)
- whenever(this.title).thenReturn(TITLE)
- }
- whenever(wifiPickerTracker.connectedWifiEntry).thenReturn(wifiEntry)
- getCallback().onWifiEntriesChanged()
-
- assertThat(latest is WifiNetworkModel.Active).isTrue()
- val latestActive = latest as WifiNetworkModel.Active
- assertThat(latestActive.isPasspointAccessPoint).isFalse()
- assertThat(latestActive.isOnlineSignUpForPasspointAccessPoint).isFalse()
- assertThat(latestActive.passpointProviderFriendlyName).isNull()
- }
-
- @Test
fun wifiNetwork_unreachableLevel_inactiveNetwork() =
testScope.runTest {
val latest by collectLastValue(underTest.wifiNetwork)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModelTest.kt
index eb6b068..92860ef 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/shared/model/WifiNetworkModelTest.kt
@@ -34,31 +34,30 @@
@Test
fun active_levelsInValidRange_noException() {
(MIN_VALID_LEVEL..MAX_VALID_LEVEL).forEach { level ->
- WifiNetworkModel.Active(NETWORK_ID, level = level)
+ WifiNetworkModel.Active(level = level)
// No assert, just need no crash
}
}
@Test(expected = IllegalArgumentException::class)
fun active_levelNegative_exceptionThrown() {
- WifiNetworkModel.Active(NETWORK_ID, level = MIN_VALID_LEVEL - 1)
+ WifiNetworkModel.Active(level = MIN_VALID_LEVEL - 1)
}
@Test(expected = IllegalArgumentException::class)
fun active_levelTooHigh_exceptionThrown() {
- WifiNetworkModel.Active(NETWORK_ID, level = MAX_VALID_LEVEL + 1)
+ WifiNetworkModel.Active(level = MAX_VALID_LEVEL + 1)
}
@Test(expected = IllegalArgumentException::class)
fun carrierMerged_invalidSubId_exceptionThrown() {
- WifiNetworkModel.CarrierMerged(NETWORK_ID, INVALID_SUBSCRIPTION_ID, 1)
+ WifiNetworkModel.CarrierMerged(INVALID_SUBSCRIPTION_ID, 1)
}
@Test
fun active_hasValidSsid_nullSsid_false() {
val network =
WifiNetworkModel.Active(
- NETWORK_ID,
level = MAX_VALID_LEVEL,
ssid = null,
)
@@ -70,7 +69,6 @@
fun active_hasValidSsid_unknownSsid_false() {
val network =
WifiNetworkModel.Active(
- NETWORK_ID,
level = MAX_VALID_LEVEL,
ssid = UNKNOWN_SSID,
)
@@ -82,7 +80,6 @@
fun active_hasValidSsid_validSsid_true() {
val network =
WifiNetworkModel.Active(
- NETWORK_ID,
level = MAX_VALID_LEVEL,
ssid = "FakeSsid",
)
@@ -97,7 +94,6 @@
val logger = TestLogger()
val prevVal =
WifiNetworkModel.CarrierMerged(
- networkId = 5,
subscriptionId = 3,
level = 1,
)
@@ -105,7 +101,6 @@
WifiNetworkModel.Inactive.logDiffs(prevVal, logger)
assertThat(logger.changes).contains(Pair(COL_NETWORK_TYPE, TYPE_INACTIVE))
- assertThat(logger.changes).contains(Pair(COL_NETWORK_ID, NETWORK_ID_DEFAULT.toString()))
assertThat(logger.changes).contains(Pair(COL_VALIDATED, "false"))
assertThat(logger.changes).contains(Pair(COL_LEVEL, LEVEL_DEFAULT.toString()))
assertThat(logger.changes).contains(Pair(COL_SSID, "null"))
@@ -116,7 +111,6 @@
val logger = TestLogger()
val carrierMerged =
WifiNetworkModel.CarrierMerged(
- networkId = 6,
subscriptionId = 3,
level = 2,
)
@@ -124,7 +118,6 @@
carrierMerged.logDiffs(prevVal = WifiNetworkModel.Inactive, logger)
assertThat(logger.changes).contains(Pair(COL_NETWORK_TYPE, TYPE_CARRIER_MERGED))
- assertThat(logger.changes).contains(Pair(COL_NETWORK_ID, "6"))
assertThat(logger.changes).contains(Pair(COL_SUB_ID, "3"))
assertThat(logger.changes).contains(Pair(COL_VALIDATED, "true"))
assertThat(logger.changes).contains(Pair(COL_LEVEL, "2"))
@@ -136,7 +129,6 @@
val logger = TestLogger()
val activeNetwork =
WifiNetworkModel.Active(
- networkId = 5,
isValidated = true,
level = 3,
ssid = "Test SSID",
@@ -146,27 +138,21 @@
activeNetwork.logDiffs(prevVal = WifiNetworkModel.Inactive, logger)
assertThat(logger.changes).contains(Pair(COL_NETWORK_TYPE, TYPE_ACTIVE))
- assertThat(logger.changes).contains(Pair(COL_NETWORK_ID, "5"))
assertThat(logger.changes).contains(Pair(COL_VALIDATED, "true"))
assertThat(logger.changes).contains(Pair(COL_LEVEL, "3"))
assertThat(logger.changes).contains(Pair(COL_SSID, "Test SSID"))
assertThat(logger.changes).contains(Pair(COL_HOTSPOT, "LAPTOP"))
}
+
@Test
fun logDiffs_activeToInactive_resetsAllActiveFields() {
val logger = TestLogger()
val activeNetwork =
- WifiNetworkModel.Active(
- networkId = 5,
- isValidated = true,
- level = 3,
- ssid = "Test SSID"
- )
+ WifiNetworkModel.Active(isValidated = true, level = 3, ssid = "Test SSID")
WifiNetworkModel.Inactive.logDiffs(prevVal = activeNetwork, logger)
assertThat(logger.changes).contains(Pair(COL_NETWORK_TYPE, TYPE_INACTIVE))
- assertThat(logger.changes).contains(Pair(COL_NETWORK_ID, NETWORK_ID_DEFAULT.toString()))
assertThat(logger.changes).contains(Pair(COL_VALIDATED, "false"))
assertThat(logger.changes).contains(Pair(COL_LEVEL, LEVEL_DEFAULT.toString()))
assertThat(logger.changes).contains(Pair(COL_SSID, "null"))
@@ -178,7 +164,6 @@
val logger = TestLogger()
val activeNetwork =
WifiNetworkModel.Active(
- networkId = 5,
isValidated = true,
level = 3,
ssid = "Test SSID",
@@ -186,7 +171,6 @@
)
val prevVal =
WifiNetworkModel.CarrierMerged(
- networkId = 5,
subscriptionId = 3,
level = 1,
)
@@ -194,25 +178,19 @@
activeNetwork.logDiffs(prevVal, logger)
assertThat(logger.changes).contains(Pair(COL_NETWORK_TYPE, TYPE_ACTIVE))
- assertThat(logger.changes).contains(Pair(COL_NETWORK_ID, "5"))
assertThat(logger.changes).contains(Pair(COL_VALIDATED, "true"))
assertThat(logger.changes).contains(Pair(COL_LEVEL, "3"))
assertThat(logger.changes).contains(Pair(COL_SSID, "Test SSID"))
assertThat(logger.changes).contains(Pair(COL_HOTSPOT, "AUTO"))
}
+
@Test
fun logDiffs_activeToCarrierMerged_logsAllFields() {
val logger = TestLogger()
val activeNetwork =
- WifiNetworkModel.Active(
- networkId = 5,
- isValidated = true,
- level = 3,
- ssid = "Test SSID"
- )
+ WifiNetworkModel.Active(isValidated = true, level = 3, ssid = "Test SSID")
val carrierMerged =
WifiNetworkModel.CarrierMerged(
- networkId = 6,
subscriptionId = 3,
level = 2,
)
@@ -220,7 +198,6 @@
carrierMerged.logDiffs(prevVal = activeNetwork, logger)
assertThat(logger.changes).contains(Pair(COL_NETWORK_TYPE, TYPE_CARRIER_MERGED))
- assertThat(logger.changes).contains(Pair(COL_NETWORK_ID, "6"))
assertThat(logger.changes).contains(Pair(COL_SUB_ID, "3"))
assertThat(logger.changes).contains(Pair(COL_VALIDATED, "true"))
assertThat(logger.changes).contains(Pair(COL_LEVEL, "2"))
@@ -231,19 +208,9 @@
fun logDiffs_activeChangesLevel_onlyLevelLogged() {
val logger = TestLogger()
val prevActiveNetwork =
- WifiNetworkModel.Active(
- networkId = 5,
- isValidated = true,
- level = 3,
- ssid = "Test SSID"
- )
+ WifiNetworkModel.Active(isValidated = true, level = 3, ssid = "Test SSID")
val newActiveNetwork =
- WifiNetworkModel.Active(
- networkId = 5,
- isValidated = true,
- level = 2,
- ssid = "Test SSID"
- )
+ WifiNetworkModel.Active(isValidated = true, level = 2, ssid = "Test SSID")
newActiveNetwork.logDiffs(prevActiveNetwork, logger)
@@ -265,8 +232,4 @@
changes.add(Pair(columnName, value.toString()))
}
}
-
- companion object {
- private const val NETWORK_ID = 2
- }
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/view/ModernStatusBarWifiViewTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/view/ModernStatusBarWifiViewTest.kt
index 161c4f5..ff398f9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/view/ModernStatusBarWifiViewTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/wifi/ui/view/ModernStatusBarWifiViewTest.kt
@@ -195,9 +195,7 @@
@Test
fun isIconVisible_notEnabled_outputsFalse() {
wifiRepository.setIsWifiEnabled(false)
- wifiRepository.setWifiNetwork(
- WifiNetworkModel.Active(NETWORK_ID, isValidated = true, level = 2)
- )
+ wifiRepository.setWifiNetwork(WifiNetworkModel.Active(isValidated = true, level = 2))
val view = ModernStatusBarWifiView.constructAndBind(context, SLOT_NAME, viewModel)
@@ -212,9 +210,7 @@
@Test
fun isIconVisible_enabled_outputsTrue() {
wifiRepository.setIsWifiEnabled(true)
- wifiRepository.setWifiNetwork(
- WifiNetworkModel.Active(NETWORK_ID, isValidated = true, level = 2)
- )
+ wifiRepository.setWifiNetwork(WifiNetworkModel.Active(isValidated = true, level = 2))
val view = ModernStatusBarWifiView.constructAndBind(context, SLOT_NAME, viewModel)
@@ -272,4 +268,3 @@
}
private const val SLOT_NAME = "TestSlotName"
-private const val NETWORK_ID = 200
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 d2a4bf3..82acb40 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
@@ -206,8 +206,7 @@
// Enabled = false => no networks shown
TestCase(
enabled = false,
- network =
- WifiNetworkModel.CarrierMerged(NETWORK_ID, subscriptionId = 1, level = 1),
+ network = WifiNetworkModel.CarrierMerged(subscriptionId = 1, level = 1),
expected = null,
),
TestCase(
@@ -217,20 +216,19 @@
),
TestCase(
enabled = false,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = false, level = 1),
+ network = WifiNetworkModel.Active(isValidated = false, level = 1),
expected = null,
),
TestCase(
enabled = false,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = true, level = 3),
+ network = WifiNetworkModel.Active(isValidated = true, level = 3),
expected = null,
),
// forceHidden = true => no networks shown
TestCase(
forceHidden = true,
- network =
- WifiNetworkModel.CarrierMerged(NETWORK_ID, subscriptionId = 1, level = 1),
+ network = WifiNetworkModel.CarrierMerged(subscriptionId = 1, level = 1),
expected = null,
),
TestCase(
@@ -240,12 +238,12 @@
),
TestCase(
enabled = false,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = false, level = 2),
+ network = WifiNetworkModel.Active(isValidated = false, level = 2),
expected = null,
),
TestCase(
forceHidden = true,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = true, level = 1),
+ network = WifiNetworkModel.Active(isValidated = true, level = 1),
expected = null,
),
@@ -265,7 +263,7 @@
),
TestCase(
alwaysShowIconWhenEnabled = true,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = false, level = 4),
+ network = WifiNetworkModel.Active(isValidated = false, level = 4),
expected =
Expected(
iconResource = WIFI_NO_INTERNET_ICONS[4],
@@ -278,7 +276,7 @@
),
TestCase(
alwaysShowIconWhenEnabled = true,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = true, level = 2),
+ network = WifiNetworkModel.Active(isValidated = true, level = 2),
expected =
Expected(
iconResource = WIFI_FULL_ICONS[2],
@@ -305,7 +303,7 @@
),
TestCase(
hasDataCapabilities = false,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = false, level = 2),
+ network = WifiNetworkModel.Active(isValidated = false, level = 2),
expected =
Expected(
iconResource = WIFI_NO_INTERNET_ICONS[2],
@@ -318,7 +316,7 @@
),
TestCase(
hasDataCapabilities = false,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = true, level = 0),
+ network = WifiNetworkModel.Active(isValidated = true, level = 0),
expected =
Expected(
iconResource = WIFI_FULL_ICONS[0],
@@ -345,7 +343,7 @@
),
TestCase(
isDefault = true,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = false, level = 3),
+ network = WifiNetworkModel.Active(isValidated = false, level = 3),
expected =
Expected(
iconResource = WIFI_NO_INTERNET_ICONS[3],
@@ -358,7 +356,7 @@
),
TestCase(
isDefault = true,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = true, level = 1),
+ network = WifiNetworkModel.Active(isValidated = true, level = 1),
expected =
Expected(
iconResource = WIFI_FULL_ICONS[1],
@@ -374,8 +372,7 @@
enabled = true,
isDefault = true,
forceHidden = false,
- network =
- WifiNetworkModel.CarrierMerged(NETWORK_ID, subscriptionId = 1, level = 1),
+ network = WifiNetworkModel.CarrierMerged(subscriptionId = 1, level = 1),
expected = null,
),
@@ -392,7 +389,7 @@
),
TestCase(
isDefault = false,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = false, level = 3),
+ network = WifiNetworkModel.Active(isValidated = false, level = 3),
expected = null,
),
@@ -400,7 +397,7 @@
// because wifi isn't the default connection (b/272509965).
TestCase(
isDefault = false,
- network = WifiNetworkModel.Active(NETWORK_ID, isValidated = true, level = 4),
+ network = WifiNetworkModel.Active(isValidated = true, level = 4),
expected = null,
),
)
@@ -408,4 +405,3 @@
}
private val IMMEDIATE = Dispatchers.Main.immediate
-private const val NETWORK_ID = 789