Make BluetoothPan accessible

This commit is contained in:
Mygod
2020-06-24 06:56:17 +08:00
parent 0ca7c632ba
commit 659c1a34e0

View File

@@ -24,7 +24,9 @@ class BluetoothTethering(context: Context, val stateListener: () -> Unit) :
private const val PAN = 5
private val clazz by lazy { Class.forName("android.bluetooth.BluetoothPan") }
private val constructor by lazy {
clazz.getDeclaredConstructor(Context::class.java, BluetoothProfile.ServiceListener::class.java)
clazz.getDeclaredConstructor(Context::class.java, BluetoothProfile.ServiceListener::class.java).apply {
isAccessible = true
}
}
private val isTetheringOn by lazy { clazz.getDeclaredMethod("isTetheringOn") }