diff --git a/README.md b/README.md
index 45f168d3..92418053 100644
--- a/README.md
+++ b/README.md
@@ -159,6 +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`
* (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 33) `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;->BAND_TYPES:[I,blocked`
* (since API 31) `Landroid/net/wifi/SoftApInfo;->getApInstanceIdentifier()Ljava/lang/String;,blocked`
diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt
index 92a6ae29..2f5cfba5 100644
--- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt
+++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetherManager.kt
@@ -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 ->
diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApCapability.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApCapability.kt
index dbed4cc0..1ab5901f 100644
--- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApCapability.kt
+++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/SoftApCapability.kt
@@ -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
+ }
}
diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/util/UnblockCentral.kt b/mobile/src/main/java/be/mygod/vpnhotspot/util/UnblockCentral.kt
index c9a8f74d..24abdfc6 100644
--- a/mobile/src/main/java/be/mygod/vpnhotspot/util/UnblockCentral.kt
+++ b/mobile/src/main/java/be/mygod/vpnhotspot/util/UnblockCentral.kt
@@ -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)
diff --git a/mobile/src/main/res/values-zh-rCN/strings.xml b/mobile/src/main/res/values-zh-rCN/strings.xml
index 685f7586..cfd59791 100644
--- a/mobile/src/main/res/values-zh-rCN/strings.xml
+++ b/mobile/src/main/res/values-zh-rCN/strings.xml
@@ -72,6 +72,7 @@
- 已连接 %d 个设备
\n支持频道: %s
+ \n驱动国家代码:%s
随机接入点 MAC
桥接 AP 并发
STA/AP 并发
diff --git a/mobile/src/main/res/values/strings.xml b/mobile/src/main/res/values/strings.xml
index 24431a38..b0520e4b 100644
--- a/mobile/src/main/res/values/strings.xml
+++ b/mobile/src/main/res/values/strings.xml
@@ -86,6 +86,7 @@
- %1d clients connected
\nSupported channels: %s
+ \nDriver country code: %s
Randomized AP MAC
Bridged AP concurrency
STA + AP concurrency