diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/MacAddressCompat.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/MacAddressCompat.kt index d3123188..f74f5409 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/MacAddressCompat.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/MacAddressCompat.kt @@ -10,8 +10,7 @@ import java.nio.ByteOrder /** * Compat support class for [MacAddress]. */ -@Parcelize -inline class MacAddressCompat(val addr: Long) : Parcelable { +inline class MacAddressCompat(val addr: Long) { companion object { private const val ETHER_ADDR_LEN = 6 /** diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt index 073ce00c..8a04f4c4 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApConfigurationCompat.kt @@ -20,7 +20,8 @@ data class SoftApConfigurationCompat( var band: Int, @RequiresApi(23) var channel: Int, - var bssid: MacAddressCompat?, + @Deprecated("Workaround for using inline class with Parcelize, use bssid") + var bssidAddr: Long?, var maxNumberOfClients: Int, @RequiresApi(28) var shutdownTimeoutMillis: Long, @@ -184,7 +185,7 @@ data class SoftApConfigurationCompat( preSharedKey, if (Build.VERSION.SDK_INT >= 23) apBand.getInt(this) else BAND_ANY, // TODO if (Build.VERSION.SDK_INT >= 23) apChannel.getInt(this) else CH_INVALID, // TODO - BSSID?.let { MacAddressCompat.fromString(it) }, + BSSID?.let { MacAddressCompat.fromString(it) }?.addr, 0, // TODO: unsupported field should have @RequiresApi? if (Build.VERSION.SDK_INT >= 28) { TetherTimeoutMonitor.timeout.toLong() @@ -204,7 +205,7 @@ data class SoftApConfigurationCompat( passphrase, getBand(this) as Int, getChannel(this) as Int, - bssid?.toCompat(), + bssid?.toCompat()?.addr, getMaxNumberOfClients(this) as Int, getShutdownTimeoutMillis(this) as Long, isAutoShutdownEnabled(this) as Boolean, @@ -222,6 +223,13 @@ data class SoftApConfigurationCompat( if (Build.VERSION.SDK_INT >= 28) TetherTimeoutMonitor.enabled else false, false, false, null, null) } + @Suppress("DEPRECATION") + var bssid: MacAddressCompat? + get() = bssidAddr?.let { MacAddressCompat(it) } + set(value) { + bssidAddr = value?.addr + } + /** * Based on: * https://android.googlesource.com/platform/packages/apps/Settings/+/android-5.0.0_r1/src/com/android/settings/wifi/WifiApDialog.java#88 diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt index c38ffd33..f2d45c25 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiApDialogFragment.kt @@ -81,8 +81,8 @@ class WifiApDialogFragment : AlertDialogFragment