Support driver country code display
This commit is contained in:
@@ -257,6 +257,9 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
|
||||
}.filterNotNull()
|
||||
if (list.isNotEmpty()) result.append(parent.getText(R.string.tethering_manage_wifi_supported_channels)
|
||||
.format(locale, list.joinToString("; ")))
|
||||
if (Build.VERSION.SDK_INT >= 33) capability.countryCode?.let {
|
||||
result.append(parent.getText(R.string.tethering_manage_wifi_country_code).format(locale, it))
|
||||
}
|
||||
}
|
||||
result
|
||||
} ?: numClients?.let { numClients ->
|
||||
|
||||
@@ -3,6 +3,8 @@ package be.mygod.vpnhotspot.net.wifi
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.RequiresApi
|
||||
import be.mygod.vpnhotspot.util.LongConstantLookup
|
||||
import be.mygod.vpnhotspot.util.UnblockCentral
|
||||
import timber.log.Timber
|
||||
|
||||
@JvmInline
|
||||
@RequiresApi(30)
|
||||
@@ -15,6 +17,8 @@ value class SoftApCapability(val inner: Parcelable) {
|
||||
private val getSupportedChannelList by lazy {
|
||||
clazz.getDeclaredMethod("getSupportedChannelList", Int::class.java)
|
||||
}
|
||||
@get:RequiresApi(33)
|
||||
private val getCountryCode by lazy { UnblockCentral.getCountryCode(clazz) }
|
||||
|
||||
@RequiresApi(31)
|
||||
const val SOFTAP_FEATURE_BAND_24G_SUPPORTED = 32L
|
||||
@@ -38,4 +42,11 @@ value class SoftApCapability(val inner: Parcelable) {
|
||||
return supportedFeatures
|
||||
}
|
||||
fun getSupportedChannelList(band: Int) = getSupportedChannelList(inner, band) as IntArray
|
||||
@get:RequiresApi(33)
|
||||
val countryCode: String? get() = try {
|
||||
getCountryCode(inner) as String?
|
||||
} catch (e: ReflectiveOperationException) {
|
||||
Timber.w(e)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ object UnblockCentral {
|
||||
*/
|
||||
private val init by lazy { if (needInit) UnblockHelper(app.deviceStorage) }
|
||||
|
||||
@RequiresApi(33)
|
||||
fun getCountryCode(clazz: Class<*>) = init.let { clazz.getDeclaredMethod("getCountryCode") }
|
||||
|
||||
@RequiresApi(31)
|
||||
fun setUserConfiguration(clazz: Class<*>) = init.let {
|
||||
clazz.getDeclaredMethod("setUserConfiguration", Boolean::class.java)
|
||||
|
||||
Reference in New Issue
Block a user