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 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 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_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;->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_NONE:I,sdk,system-api,test-api`
|
||||||
* (since API 31) `Landroid/net/wifi/SoftApConfiguration;->RANDOMIZATION_PERSISTENT: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) }
|
set(value) = app.pref.edit { putString(KEY_PASSPHRASE, value) }
|
||||||
var operatingBand: Int
|
var operatingBand: Int
|
||||||
@SuppressLint("InlinedApi")
|
@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) }
|
set(value) = app.pref.edit { putInt(KEY_OPERATING_BAND, value) }
|
||||||
var operatingChannel: Int
|
var operatingChannel: Int
|
||||||
get() {
|
get() {
|
||||||
|
|||||||
@@ -63,8 +63,7 @@ data class SoftApConfigurationCompat(
|
|||||||
const val BAND_6GHZ = 4
|
const val BAND_6GHZ = 4
|
||||||
@TargetApi(31)
|
@TargetApi(31)
|
||||||
const val BAND_60GHZ = 8
|
const val BAND_60GHZ = 8
|
||||||
private const val BAND_LEGACY = BAND_2GHZ or BAND_5GHZ
|
const val BAND_LEGACY = BAND_2GHZ or BAND_5GHZ
|
||||||
const val BAND_ANY = BAND_LEGACY or BAND_6GHZ
|
|
||||||
val BAND_TYPES by lazy {
|
val BAND_TYPES by lazy {
|
||||||
if (BuildCompat.isAtLeastS()) try {
|
if (BuildCompat.isAtLeastS()) try {
|
||||||
return@lazy UnblockCentral.SoftApConfiguration_BAND_TYPES
|
return@lazy UnblockCentral.SoftApConfiguration_BAND_TYPES
|
||||||
@@ -282,7 +281,7 @@ data class SoftApConfigurationCompat(
|
|||||||
hiddenSSID,
|
hiddenSSID,
|
||||||
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/wifi/java/android/net/wifi/SoftApConfToXmlMigrationUtil.java;l=87;drc=aa6527cf41671d1ed417b8ebdb6b3aa614f62344
|
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/wifi/java/android/net/wifi/SoftApConfToXmlMigrationUtil.java;l=87;drc=aa6527cf41671d1ed417b8ebdb6b3aa614f62344
|
||||||
SparseIntArray(1).apply {
|
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
|
0 -> BAND_2GHZ
|
||||||
1 -> BAND_5GHZ
|
1 -> BAND_5GHZ
|
||||||
-1 -> BAND_LEGACY
|
-1 -> BAND_LEGACY
|
||||||
@@ -358,7 +357,7 @@ data class SoftApConfigurationCompat(
|
|||||||
}
|
}
|
||||||
return result
|
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) }
|
channels = SparseIntArray(1).apply { put(band, channel) }
|
||||||
}
|
}
|
||||||
fun optimizeChannels(channels: SparseIntArray = this.channels) {
|
fun optimizeChannels(channels: SparseIntArray = this.channels) {
|
||||||
|
|||||||
Reference in New Issue
Block a user