Skip to content

Commit 0af60cd

Browse files
committed
android: fix ATT on A16QPR3+
1 parent be29a46 commit 0af60cd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • android/app/src/main/java/me/kavishdevar/librepods/bluetooth

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ class ATTManager(private val adapter: BluetoothAdapter, private val device: Blue
7272
fun connect() {
7373
val uuid = ParcelUuid.fromString("00000000-0000-0000-0000-000000000000")
7474

75-
socket = createBluetoothSocket(adapter, device, uuid)
75+
try {
76+
socket = createBluetoothSocket(adapter, device, uuid)
77+
} catch (e: Exception) {
78+
Log.w(TAG, "Failed to create socket")
79+
}
7680
try {
7781
socket!!.connect()
7882
} catch (e: Exception) {
@@ -203,7 +207,7 @@ class ATTManager(private val adapter: BluetoothAdapter, private val device: Blue
203207
private fun createBluetoothSocket(adapter: BluetoothAdapter, device: BluetoothDevice, uuid: ParcelUuid): BluetoothSocket {
204208
val type = 3 // L2CAP
205209
val constructorSpecs = listOf(
206-
arrayOf(adapter, device, type, true, 31, uuid),
210+
arrayOf(adapter, device, type, true, true, 31, uuid),
207211
arrayOf(device, type, true, true, 31, uuid),
208212
arrayOf(device, type, 1, true, true, 31, uuid),
209213
arrayOf(type, 1, true, true, device, 31, uuid),

0 commit comments

Comments
 (0)