Support WiGig tethering

As per: https://android-review.googlesource.com/c/platform/frameworks/base/+/1177323
This commit is contained in:
Mygod
2020-07-01 13:15:47 -04:00
parent a76145c8dc
commit 5e4cebc346
10 changed files with 60 additions and 2 deletions

View File

@@ -20,16 +20,18 @@ enum class TetherType(@DrawableRes val icon: Int) {
// if you have an issue with these Ethernet icon namings, blame Google
NCM(R.drawable.ic_action_settings_ethernet),
ETHERNET(R.drawable.ic_content_inbox),
WIGIG(R.drawable.ic_image_flash_on),
;
val isWifi get() = when (this) {
WIFI_P2P, WIFI, WIMAX -> true
WIFI_P2P, WIFI, WIMAX, WIGIG -> true
else -> false
}
companion object : TetheringManager.TetheringEventCallback {
private lateinit var usbRegexs: List<Pattern>
private lateinit var wifiRegexs: List<Pattern>
private var wigigRegexs = emptyList<Pattern>()
private var wifiP2pRegexs = emptyList<Pattern>()
private val wimaxRegexs: List<Pattern>
private lateinit var bluetoothRegexs: List<Pattern>
@@ -54,6 +56,7 @@ enum class TetherType(@DrawableRes val icon: Int) {
TetheringManager.resolvedService.serviceInfo.applicationInfo)
usbRegexs = tethering.getRegexs("config_tether_usb_regexs")
wifiRegexs = tethering.getRegexs("config_tether_wifi_regexs")
wigigRegexs = tethering.getRegexs("config_tether_wigig_regexs")
wifiP2pRegexs = tethering.getRegexs("config_tether_wifi_p2p_regexs")
bluetoothRegexs = tethering.getRegexs("config_tether_bluetooth_regexs")
ncmRegexs = tethering.getRegexs("config_tether_ncm_regexs")
@@ -100,6 +103,7 @@ enum class TetherType(@DrawableRes val icon: Int) {
ofInterfaceImpl(iface, p2pDev)
}
wifiRegexs.any { it.matcher(iface).matches() } -> WIFI
wigigRegexs.any { it.matcher(iface).matches() } -> WIGIG
wifiP2pRegexs.any { it.matcher(iface).matches() } -> WIFI_P2P
usbRegexs.any { it.matcher(iface).matches() } -> USB
bluetoothRegexs.any { it.matcher(iface).matches() } -> BLUETOOTH

View File

@@ -153,6 +153,14 @@ object TetheringManager {
*/
@RequiresApi(30)
const val TETHERING_ETHERNET = 5
/**
* WIGIG tethering type. Use a separate type to prevent
* conflicts with TETHERING_WIFI
* This type is only used internally by the tethering module
* @hide
*/
@RequiresApi(30)
const val TETHERING_WIGIG = 6
@get:RequiresApi(30)
private val clazz by lazy { Class.forName("android.net.TetheringManager") }