Stop using BAND_ANY
This commit is contained in:
@@ -262,7 +262,6 @@ Greylisted/blacklisted APIs or internal constants: (some constants are hardcoded
|
||||
* (since API 30) `Landroid/net/wifi/SoftApConfiguration;->BAND_5GHZ:I,sdk,system-api,test-api`
|
||||
* (since API 31) `Landroid/net/wifi/SoftApConfiguration;->BAND_60GHZ:I,sdk,system-api,test-api`
|
||||
* (since API 30) `Landroid/net/wifi/SoftApConfiguration;->BAND_6GHZ:I,sdk,system-api,test-api`
|
||||
* (since API 30) `Landroid/net/wifi/SoftApConfiguration;->BAND_ANY:I,sdk,system-api,test-api`
|
||||
* (since API 31) `Landroid/net/wifi/SoftApConfiguration;->BAND_*:I,sdk,system-api,test-api`
|
||||
* (since API 31) `Landroid/net/wifi/SoftApConfiguration;->RANDOMIZATION_NONE:I,sdk,system-api,test-api`
|
||||
* (since API 31) `Landroid/net/wifi/SoftApConfiguration;->RANDOMIZATION_PERSISTENT:I,sdk,system-api,test-api`
|
||||
|
||||
@@ -71,7 +71,7 @@ class RepeaterService : Service(), CoroutineScope, WifiP2pManager.ChannelListene
|
||||
set(value) = app.pref.edit { putString(KEY_PASSPHRASE, value) }
|
||||
var operatingBand: Int
|
||||
@SuppressLint("InlinedApi")
|
||||
get() = app.pref.getInt(KEY_OPERATING_BAND, SoftApConfigurationCompat.BAND_ANY)
|
||||
get() = app.pref.getInt(KEY_OPERATING_BAND, SoftApConfigurationCompat.BAND_LEGACY)
|
||||
set(value) = app.pref.edit { putInt(KEY_OPERATING_BAND, value) }
|
||||
var operatingChannel: Int
|
||||
get() {
|
||||
|
||||
@@ -63,8 +63,7 @@ data class SoftApConfigurationCompat(
|
||||
const val BAND_6GHZ = 4
|
||||
@TargetApi(31)
|
||||
const val BAND_60GHZ = 8
|
||||
private const val BAND_LEGACY = BAND_2GHZ or BAND_5GHZ
|
||||
const val BAND_ANY = BAND_LEGACY or BAND_6GHZ
|
||||
const val BAND_LEGACY = BAND_2GHZ or BAND_5GHZ
|
||||
val BAND_TYPES by lazy {
|
||||
if (BuildCompat.isAtLeastS()) try {
|
||||
return@lazy UnblockCentral.SoftApConfiguration_BAND_TYPES
|
||||
@@ -282,7 +281,7 @@ data class SoftApConfigurationCompat(
|
||||
hiddenSSID,
|
||||
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/wifi/java/android/net/wifi/SoftApConfToXmlMigrationUtil.java;l=87;drc=aa6527cf41671d1ed417b8ebdb6b3aa614f62344
|
||||
SparseIntArray(1).apply {
|
||||
if (Build.VERSION.SDK_INT < 23) put(BAND_ANY, 0) else put(when (val band = apBand.getInt(this)) {
|
||||
if (Build.VERSION.SDK_INT < 23) put(BAND_LEGACY, 0) else put(when (val band = apBand.getInt(this)) {
|
||||
0 -> BAND_2GHZ
|
||||
1 -> BAND_5GHZ
|
||||
-1 -> BAND_LEGACY
|
||||
@@ -358,7 +357,7 @@ data class SoftApConfigurationCompat(
|
||||
}
|
||||
return result
|
||||
}
|
||||
fun setChannel(channel: Int, band: Int = BAND_ANY) {
|
||||
fun setChannel(channel: Int, band: Int = BAND_LEGACY) {
|
||||
channels = SparseIntArray(1).apply { put(band, channel) }
|
||||
}
|
||||
fun optimizeChannels(channels: SparseIntArray = this.channels) {
|
||||
|
||||
Reference in New Issue
Block a user