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

Commit 407f69fe authored by Weng Su's avatar Weng Su
Browse files

Fix WifiPrivacy for special SSID AP

- root cause: specail SSID AP(contain '%', end with '\' or '/' and end with '???'), andriodx Navigation cannot find destination

- changes: use Base64 UrlEncode replace String

Bug: 360304229
Flag: EXEMPT bugfix
Test: Manual testing
atest -c WifiPrivacyPageProviderTest

Change-Id: Ifb89451477f2ba143f504b94c8d4d9167aee2c2e
parent bb8199e8
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import com.android.settingslib.spa.widget.ui.CategoryTitle
import com.android.wifitrackerlib.WifiEntry
import java.time.Clock
import java.time.ZoneOffset
import java.util.Base64

const val WIFI_ENTRY_KEY = "wifiEntryKey"

@@ -68,7 +69,8 @@ object WifiPrivacyPageProvider : SettingsPageProvider {

    @Composable
    override fun Page(arguments: Bundle?) {
        val wifiEntryKey = arguments!!.getString(WIFI_ENTRY_KEY)
        val wifiEntryKey =
            String(Base64.getUrlDecoder().decode(arguments!!.getString(WIFI_ENTRY_KEY)))
        if (wifiEntryKey != null) {
            val context = LocalContext.current
            val lifecycle = LocalLifecycleOwner.current.lifecycle
@@ -81,7 +83,7 @@ object WifiPrivacyPageProvider : SettingsPageProvider {

    fun getRoute(
        wifiEntryKey: String,
    ): String = "${name}/$wifiEntryKey"
    ): String = "${name}/${Base64.getUrlEncoder().encodeToString(wifiEntryKey.toByteArray())}"
}

@Composable