Test platform validity of bssid
This commit is contained in:
@@ -353,6 +353,8 @@ data class SoftApConfigurationCompat(
|
||||
private val staticBuilder by lazy { classBuilder.newInstance() }
|
||||
@RequiresApi(30)
|
||||
fun testPlatformValidity(channels: SparseIntArray) = setChannelsCompat(staticBuilder, channels)
|
||||
@RequiresApi(30)
|
||||
fun testPlatformValidity(bssid: MacAddress) = setBssid(staticBuilder, bssid)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
|
||||
@@ -306,9 +306,12 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
||||
dialogView.bandError.text = bandError
|
||||
dialogView.bssidWrapper.error = null
|
||||
val bssidValid = dialogView.bssid.length() == 0 || try {
|
||||
MacAddressCompat.fromString(dialogView.bssid.text.toString())
|
||||
val mac = MacAddressCompat.fromString(dialogView.bssid.text.toString())
|
||||
if (Build.VERSION.SDK_INT >= 30 && !arg.p2pMode) {
|
||||
SoftApConfigurationCompat.testPlatformValidity(mac.toPlatform())
|
||||
}
|
||||
true
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (e: Exception) {
|
||||
dialogView.bssidWrapper.error = e.readableMessage
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user