Skip to content

Commit bc400af

Browse files
Johanna YeGenkzsz11
authored andcommitted
Add synchronization to all mDeviceBusy state changes.
Tag: #stability Test: make Bug: 169559728 Change-Id: I5c1b926a4c774b4bc5f24a9aaa66aa5f7780e121
1 parent 30f36b1 commit bc400af

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

core/java/android/bluetooth/BluetoothGatt.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,9 @@ public boolean readCharacteristic(BluetoothGattCharacteristic characteristic) {
11671167
characteristic.getInstanceId(), AUTHENTICATION_NONE);
11681168
} catch (RemoteException e) {
11691169
Log.e(TAG, "", e);
1170-
mDeviceBusy = false;
1170+
synchronized (mDeviceBusyLock) {
1171+
mDeviceBusy = false;
1172+
}
11711173
return false;
11721174
}
11731175

@@ -1201,7 +1203,9 @@ public boolean readUsingCharacteristicUuid(UUID uuid, int startHandle, int endHa
12011203
new ParcelUuid(uuid), startHandle, endHandle, AUTHENTICATION_NONE);
12021204
} catch (RemoteException e) {
12031205
Log.e(TAG, "", e);
1204-
mDeviceBusy = false;
1206+
synchronized (mDeviceBusyLock) {
1207+
mDeviceBusy = false;
1208+
}
12051209
return false;
12061210
}
12071211

@@ -1248,7 +1252,9 @@ public boolean writeCharacteristic(BluetoothGattCharacteristic characteristic) {
12481252
AUTHENTICATION_NONE, characteristic.getValue());
12491253
} catch (RemoteException e) {
12501254
Log.e(TAG, "", e);
1251-
mDeviceBusy = false;
1255+
synchronized (mDeviceBusyLock) {
1256+
mDeviceBusy = false;
1257+
}
12521258
return false;
12531259
}
12541260

@@ -1290,7 +1296,9 @@ public boolean readDescriptor(BluetoothGattDescriptor descriptor) {
12901296
descriptor.getInstanceId(), AUTHENTICATION_NONE);
12911297
} catch (RemoteException e) {
12921298
Log.e(TAG, "", e);
1293-
mDeviceBusy = false;
1299+
synchronized (mDeviceBusyLock) {
1300+
mDeviceBusy = false;
1301+
}
12941302
return false;
12951303
}
12961304

@@ -1331,7 +1339,9 @@ public boolean writeDescriptor(BluetoothGattDescriptor descriptor) {
13311339
AUTHENTICATION_NONE, descriptor.getValue());
13321340
} catch (RemoteException e) {
13331341
Log.e(TAG, "", e);
1334-
mDeviceBusy = false;
1342+
synchronized (mDeviceBusyLock) {
1343+
mDeviceBusy = false;
1344+
}
13351345
return false;
13361346
}
13371347

@@ -1398,7 +1408,9 @@ public boolean executeReliableWrite() {
13981408
mService.endReliableWrite(mClientIf, mDevice.getAddress(), true);
13991409
} catch (RemoteException e) {
14001410
Log.e(TAG, "", e);
1401-
mDeviceBusy = false;
1411+
synchronized (mDeviceBusyLock) {
1412+
mDeviceBusy = false;
1413+
}
14021414
return false;
14031415
}
14041416

0 commit comments

Comments
 (0)