Misc fixes
This commit is contained in:
@@ -5,7 +5,6 @@ import android.net.LinkProperties
|
||||
import be.mygod.vpnhotspot.App.Companion.app
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import java.net.InetAddress
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
@@ -72,10 +71,6 @@ abstract class UpstreamMonitor {
|
||||
val callbacks = Collections.newSetFromMap(ConcurrentHashMap<Callback, Boolean>())
|
||||
protected abstract val currentLinkProperties: LinkProperties?
|
||||
open val currentIface: String? get() = currentLinkProperties?.interfaceName
|
||||
/**
|
||||
* There's no need for overriding currentDns for now.
|
||||
*/
|
||||
val currentDns: List<InetAddress> get() = currentLinkProperties?.dnsServers ?: emptyList()
|
||||
protected abstract fun registerCallbackLocked(callback: Callback)
|
||||
abstract fun destroyLocked()
|
||||
|
||||
|
||||
@@ -112,7 +112,9 @@ object WifiP2pManagerHelper {
|
||||
*
|
||||
* Source: https://android.googlesource.com/platform/frameworks/base/+/android-4.2_r1/wifi/java/android/net/wifi/p2p/WifiP2pGroup.java#253
|
||||
*/
|
||||
private val getNetworkId by lazy { WifiP2pGroup::class.java.getDeclaredMethod("getNetworkId") }
|
||||
private val getNetworkId by lazy @SuppressLint("DiscouragedPrivateApi") {
|
||||
WifiP2pGroup::class.java.getDeclaredMethod("getNetworkId")
|
||||
}
|
||||
@Deprecated("No longer used since API 29")
|
||||
val WifiP2pGroup.netId get() = getNetworkId.invoke(this) as Int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user