Try to obtain country code on old devices as well
This commit is contained in:
@@ -159,7 +159,7 @@ Greylisted/blacklisted APIs or internal constants: (some constants are hardcoded
|
|||||||
* (prior to API 30) `Landroid/net/ConnectivityManager;->getLastTetherError(Ljava/lang/String;)I,max-target-r`
|
* (prior to API 30) `Landroid/net/ConnectivityManager;->getLastTetherError(Ljava/lang/String;)I,max-target-r`
|
||||||
* (since API 30) `Landroid/net/ConnectivityModuleConnector;->IN_PROCESS_SUFFIX:Ljava/lang/String;`
|
* (since API 30) `Landroid/net/ConnectivityModuleConnector;->IN_PROCESS_SUFFIX:Ljava/lang/String;`
|
||||||
* (since API 30) `Landroid/net/TetheringManager$TetheringEventCallback;->onTetherableInterfaceRegexpsChanged(Landroid/net/TetheringManager$TetheringInterfaceRegexps;)V,blocked`
|
* (since API 30) `Landroid/net/TetheringManager$TetheringEventCallback;->onTetherableInterfaceRegexpsChanged(Landroid/net/TetheringManager$TetheringInterfaceRegexps;)V,blocked`
|
||||||
* (since API 33) `Landroid/net/wifi/SoftApCapability;->getCountryCode()Ljava/lang/String;,blocked`
|
* (since API 31) `Landroid/net/wifi/SoftApCapability;->getCountryCode()Ljava/lang/String;,blocked`
|
||||||
* (since API 31) `Landroid/net/wifi/SoftApConfiguration$Builder;->setUserConfiguration(Z)Landroid/net/wifi/SoftApConfiguration$Builder;,blocked`
|
* (since API 31) `Landroid/net/wifi/SoftApConfiguration$Builder;->setUserConfiguration(Z)Landroid/net/wifi/SoftApConfiguration$Builder;,blocked`
|
||||||
* (since API 31) `Landroid/net/wifi/SoftApConfiguration;->BAND_TYPES:[I,blocked`
|
* (since API 31) `Landroid/net/wifi/SoftApConfiguration;->BAND_TYPES:[I,blocked`
|
||||||
* (since API 31) `Landroid/net/wifi/SoftApInfo;->getApInstanceIdentifier()Ljava/lang/String;,blocked`
|
* (since API 31) `Landroid/net/wifi/SoftApInfo;->getApInstanceIdentifier()Ljava/lang/String;,blocked`
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
|
|||||||
}.filterNotNull()
|
}.filterNotNull()
|
||||||
if (list.isNotEmpty()) result.append(parent.getText(R.string.tethering_manage_wifi_supported_channels)
|
if (list.isNotEmpty()) result.append(parent.getText(R.string.tethering_manage_wifi_supported_channels)
|
||||||
.format(locale, list.joinToString("; ")))
|
.format(locale, list.joinToString("; ")))
|
||||||
if (Build.VERSION.SDK_INT >= 33) capability.countryCode?.let {
|
capability.countryCode?.let {
|
||||||
result.append(parent.getText(R.string.tethering_manage_wifi_country_code).format(locale, it))
|
result.append(parent.getText(R.string.tethering_manage_wifi_country_code).format(locale, it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package be.mygod.vpnhotspot.net.wifi
|
package be.mygod.vpnhotspot.net.wifi
|
||||||
|
|
||||||
|
import android.annotation.TargetApi
|
||||||
|
import android.os.Build
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import be.mygod.vpnhotspot.util.LongConstantLookup
|
import be.mygod.vpnhotspot.util.LongConstantLookup
|
||||||
@@ -17,7 +19,8 @@ value class SoftApCapability(val inner: Parcelable) {
|
|||||||
private val getSupportedChannelList by lazy {
|
private val getSupportedChannelList by lazy {
|
||||||
clazz.getDeclaredMethod("getSupportedChannelList", Int::class.java)
|
clazz.getDeclaredMethod("getSupportedChannelList", Int::class.java)
|
||||||
}
|
}
|
||||||
@get:RequiresApi(33)
|
@get:RequiresApi(31)
|
||||||
|
@get:TargetApi(33)
|
||||||
private val getCountryCode by lazy { UnblockCentral.getCountryCode(clazz) }
|
private val getCountryCode by lazy { UnblockCentral.getCountryCode(clazz) }
|
||||||
|
|
||||||
@RequiresApi(31)
|
@RequiresApi(31)
|
||||||
@@ -42,11 +45,11 @@ value class SoftApCapability(val inner: Parcelable) {
|
|||||||
return supportedFeatures
|
return supportedFeatures
|
||||||
}
|
}
|
||||||
fun getSupportedChannelList(band: Int) = getSupportedChannelList(inner, band) as IntArray
|
fun getSupportedChannelList(band: Int) = getSupportedChannelList(inner, band) as IntArray
|
||||||
@get:RequiresApi(33)
|
@get:RequiresApi(31)
|
||||||
val countryCode: String? get() = try {
|
val countryCode: String? get() = try {
|
||||||
getCountryCode(inner) as String?
|
getCountryCode(inner) as String?
|
||||||
} catch (e: ReflectiveOperationException) {
|
} catch (e: ReflectiveOperationException) {
|
||||||
Timber.w(e)
|
if (Build.VERSION.SDK_INT >= 33) Timber.w(e)
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user