Fix auto not existing on API 27-
This commit is contained in:
@@ -63,17 +63,22 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
|||||||
listOf(ChannelOption(SoftApConfigurationCompat.BAND_LEGACY)) +
|
listOf(ChannelOption(SoftApConfigurationCompat.BAND_LEGACY)) +
|
||||||
channels2G + (15..165).map { ChannelOption(SoftApConfigurationCompat.BAND_5GHZ, it) }
|
channels2G + (15..165).map { ChannelOption(SoftApConfigurationCompat.BAND_5GHZ, it) }
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Also used for legacy soft ap.
|
|
||||||
*/
|
|
||||||
private val p2pSafeOptions by lazy { genAutoOptions(SoftApConfigurationCompat.BAND_LEGACY) + channels5G }
|
private val p2pSafeOptions by lazy { genAutoOptions(SoftApConfigurationCompat.BAND_LEGACY) + channels5G }
|
||||||
@get:RequiresApi(30)
|
@get:RequiresApi(30)
|
||||||
private val softApOptions by lazy {
|
private val softApOptions by lazy {
|
||||||
val channels6G = channels5G + (1..233).map { ChannelOption(SoftApConfigurationCompat.BAND_6GHZ, it) }
|
when (Build.VERSION.SDK_INT) {
|
||||||
if (Build.VERSION.SDK_INT >= 31) {
|
in 30..Int.MAX_VALUE -> {
|
||||||
genAutoOptions(SoftApConfigurationCompat.BAND_ANY_31) +
|
val channels6G = channels5G +
|
||||||
channels6G + (1..6).map { ChannelOption(SoftApConfigurationCompat.BAND_60GHZ, it) }
|
(1..233).map { ChannelOption(SoftApConfigurationCompat.BAND_6GHZ, it) }
|
||||||
} else genAutoOptions(SoftApConfigurationCompat.BAND_ANY_30) + channels6G
|
if (Build.VERSION.SDK_INT >= 31) {
|
||||||
|
genAutoOptions(SoftApConfigurationCompat.BAND_ANY_31) +
|
||||||
|
channels6G + (1..6).map { ChannelOption(SoftApConfigurationCompat.BAND_60GHZ, it) }
|
||||||
|
} else genAutoOptions(SoftApConfigurationCompat.BAND_ANY_30) + channels6G
|
||||||
|
}
|
||||||
|
in 28 until 30 -> p2pSafeOptions
|
||||||
|
else -> listOf(ChannelOption(SoftApConfigurationCompat.BAND_2GHZ),
|
||||||
|
ChannelOption(SoftApConfigurationCompat.BAND_5GHZ)) + channels5G
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,9 +110,9 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
|
|||||||
private lateinit var base: SoftApConfigurationCompat
|
private lateinit var base: SoftApConfigurationCompat
|
||||||
private var started = false
|
private var started = false
|
||||||
private val currentChannels get() = when {
|
private val currentChannels get() = when {
|
||||||
arg.p2pMode && !RepeaterService.safeMode -> p2pUnsafeOptions
|
!arg.p2pMode -> softApOptions
|
||||||
arg.p2pMode || Build.VERSION.SDK_INT < 30 -> p2pSafeOptions
|
RepeaterService.safeMode -> p2pSafeOptions
|
||||||
else -> softApOptions
|
else -> p2pUnsafeOptions
|
||||||
}
|
}
|
||||||
override val ret get() = Arg(generateConfig())
|
override val ret get() = Arg(generateConfig())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user