Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f33f1b91 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB][Wifi] Remove passpoint-related values from wifi pipeline.

[WifiEntry.title] correctly fetches the SSID for both typical wifi
networks and for passpoint/OSU APs. Now that we're fully moved over to
WifiTrackerLib, we can remove all the passpoint/OSU-specific logic.

Bug: 292534484
Flag: EXEMPT refactor
Test: atest WifiRepositoryImplTest WifiInteractorImplTest
Test: smoke test of Internet tile when wifi is connected
Change-Id: I0ca61f351e1e7a1dc39174a2e221832a4ea69497
parent 6114e164
Loading
Loading
Loading
Loading
+0 −43
Original line number Diff line number Diff line
@@ -105,48 +105,6 @@ class WifiInteractorImplTest : SysuiTestCase() {
            job.cancel()
        }

    @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 {
@@ -238,7 +196,6 @@ class WifiInteractorImplTest : SysuiTestCase() {
                    isValidated = true,
                    level = 3,
                    ssid = "AB",
                    passpointProviderFriendlyName = "friendly"
                )
            wifiRepository.setWifiNetwork(wifiNetwork)

+0 −6
Original line number Diff line number Diff line
@@ -106,12 +106,6 @@ constructor(
            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 =
+0 −8
Original line number Diff line number Diff line
@@ -300,14 +300,6 @@ constructor(
            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,
        )
    }

+0 −2
Original line number Diff line number Diff line
@@ -83,8 +83,6 @@ constructor(
                is WifiNetworkModel.CarrierMerged -> null
                is WifiNetworkModel.Active ->
                    when {
                        info.isPasspointAccessPoint || info.isOnlineSignUpForPasspointAccessPoint ->
                            info.passpointProviderFriendlyName
                        info.hasValidSsid() -> info.ssid
                        else -> null
                    }
+0 −62
Original line number Diff line number Diff line
@@ -57,9 +57,6 @@ sealed class WifiNetworkModel : Diffable<WifiNetworkModel> {
            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)
        }
    }

@@ -90,9 +87,6 @@ sealed class WifiNetworkModel : Diffable<WifiNetworkModel> {
            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)
        }
    }

@@ -118,9 +112,6 @@ sealed class WifiNetworkModel : Diffable<WifiNetworkModel> {
            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)
        }
    }

@@ -194,9 +185,6 @@ sealed class WifiNetworkModel : Diffable<WifiNetworkModel> {
            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)
        }
    }

@@ -224,15 +212,6 @@ sealed class WifiNetworkModel : Diffable<WifiNetworkModel> {
         * 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) {
@@ -267,21 +246,6 @@ sealed class WifiNetworkModel : Diffable<WifiNetworkModel> {
            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) {
@@ -293,29 +257,6 @@ sealed class WifiNetworkModel : Diffable<WifiNetworkModel> {
            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 {
@@ -375,9 +316,6 @@ 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
Loading