Skip to content

Commit 555a000

Browse files
committed
add A16QPR3 constructor for ATT
i really need to clean this up
1 parent 45f53d5 commit 555a000

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2419,7 +2419,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
24192419

24202420
BluetoothConnectionManager.setCurrentConnection(socket, device)
24212421

2422-
attManager = ATTManager(device)
2422+
attManager = ATTManager(adapter, device)
24232423
attManager!!.connect()
24242424

24252425
// Create AirPodsInstance from stored config if available

android/app/src/main/java/me/kavishdevar/librepods/utils/ATTManager.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
package me.kavishdevar.librepods.utils
2525

2626
import android.annotation.SuppressLint
27+
import android.bluetooth.BluetoothAdapter
2728
import android.bluetooth.BluetoothDevice
2829
import android.bluetooth.BluetoothSocket
2930
import android.os.ParcelUuid
@@ -49,7 +50,7 @@ enum class ATTCCCDHandles(val value: Int) {
4950
HEARING_AID(ATTHandles.HEARING_AID.value + 1),
5051
}
5152

52-
class ATTManager(private val device: BluetoothDevice) {
53+
class ATTManager(private val adapter: BluetoothAdapter, private val device: BluetoothDevice) {
5354
companion object {
5455
private const val TAG = "ATTManager"
5556

@@ -72,7 +73,7 @@ class ATTManager(private val device: BluetoothDevice) {
7273
HiddenApiBypass.addHiddenApiExemptions("Landroid/bluetooth/BluetoothSocket;")
7374
val uuid = ParcelUuid.fromString("00000000-0000-0000-0000-000000000000")
7475

75-
socket = createBluetoothSocket(device, uuid)
76+
socket = createBluetoothSocket(adapter, device, uuid)
7677
socket!!.connect()
7778
input = socket!!.inputStream
7879
output = socket!!.outputStream
@@ -195,9 +196,10 @@ class ATTManager(private val device: BluetoothDevice) {
195196
}
196197
}
197198

198-
private fun createBluetoothSocket(device: BluetoothDevice, uuid: ParcelUuid): BluetoothSocket {
199+
private fun createBluetoothSocket(adapter: BluetoothAdapter, device: BluetoothDevice, uuid: ParcelUuid): BluetoothSocket {
199200
val type = 3 // L2CAP
200201
val constructorSpecs = listOf(
202+
arrayOf(adapter, device, type, true, 31, uuid),
201203
arrayOf(device, type, true, true, 31, uuid),
202204
arrayOf(device, type, 1, true, true, 31, uuid),
203205
arrayOf(type, 1, true, true, device, 31, uuid),

0 commit comments

Comments
 (0)