diff --git a/README.md b/README.md index f9ba8375..08868651 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt index 25b2cf3a..683848b0 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/RepeaterService.kt @@ -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() { 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 8ac6149e..59a60d05 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 @@ -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) {