diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-07-28 22:21:24 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-07-28 22:21:24 +0000 |
commit | 2530cb53c684bd5e50bbdf83fa0ce86975504f6c (patch) | |
tree | 03285c59b9d8c4ce6c782a1244e8e1f5c36d7515 /framework/java/android/bluetooth/BluetoothGatt.java | |
parent | b1e38fa8d7ebbd4b3f84fb2dc34280124fa2f05a (diff) | |
parent | 60b9334f11e8692c826ee77aeba457bb8b331f72 (diff) |
Snap for 8881298 from 60b9334f11e8692c826ee77aeba457bb8b331f72 to t-keystone-qcom-release
Change-Id: I7be128124191aa71047dea3d74e837cb26051b96
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothGatt.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothGatt.java | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/framework/java/android/bluetooth/BluetoothGatt.java b/framework/java/android/bluetooth/BluetoothGatt.java index edfd8ba91f..22cd999a59 100644 --- a/framework/java/android/bluetooth/BluetoothGatt.java +++ b/framework/java/android/bluetooth/BluetoothGatt.java @@ -270,7 +270,7 @@ public final class BluetoothGatt implements BluetoothProfile { return; } try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); // autoConnect is inverse of "isDirect" mService.clientConnect(mClientIf, mDevice.getAddress(), !mAutoConnect, mTransport, mOpportunistic, mPhy, mAttributionSource, recv); @@ -452,7 +452,7 @@ public final class BluetoothGatt implements BluetoothProfile { try { final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE) ? AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM; - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.readCharacteristic( mClientIf, address, handle, authReq, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -520,7 +520,7 @@ public final class BluetoothGatt implements BluetoothProfile { int requestStatus = BluetoothStatusCodes.ERROR_UNKNOWN; for (int i = 0; i < WRITE_CHARACTERISTIC_MAX_RETRIES; i++) { final SynchronousResultReceiver<Integer> recv = - new SynchronousResultReceiver(); + SynchronousResultReceiver.get(); mService.writeCharacteristic(mClientIf, address, handle, characteristic.getWriteType(), authReq, value, mAttributionSource, recv); @@ -615,7 +615,7 @@ public final class BluetoothGatt implements BluetoothProfile { try { final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE) ? AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM; - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.readDescriptor(mClientIf, address, handle, authReq, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -671,7 +671,7 @@ public final class BluetoothGatt implements BluetoothProfile { try { final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE) ? AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM; - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.writeDescriptor(mClientIf, address, handle, authReq, value, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -997,7 +997,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (DBG) Log.d(TAG, "registerApp() - UUID=" + uuid); try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.registerClient(new ParcelUuid(uuid), mBluetoothGattCallback, eatt_support, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1021,7 +1021,7 @@ public final class BluetoothGatt implements BluetoothProfile { try { mCallback = null; - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.unregisterClient(mClientIf, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); mClientIf = 0; @@ -1129,7 +1129,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return; try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.clientDisconnect(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1151,7 +1151,7 @@ public final class BluetoothGatt implements BluetoothProfile { public boolean connect() { try { // autoConnect is inverse of "isDirect" - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.clientConnect(mClientIf, mDevice.getAddress(), false, mTransport, mOpportunistic, mPhy, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1184,7 +1184,7 @@ public final class BluetoothGatt implements BluetoothProfile { @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void setPreferredPhy(int txPhy, int rxPhy, int phyOptions) { try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.clientSetPreferredPhy(mClientIf, mDevice.getAddress(), txPhy, rxPhy, phyOptions, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1201,7 +1201,7 @@ public final class BluetoothGatt implements BluetoothProfile { @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void readPhy() { try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.clientReadPhy(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1240,7 +1240,7 @@ public final class BluetoothGatt implements BluetoothProfile { mServices.clear(); try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.discoverServices(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1269,7 +1269,7 @@ public final class BluetoothGatt implements BluetoothProfile { mServices.clear(); try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.discoverServiceByUuid(mClientIf, mDevice.getAddress(), new ParcelUuid(uuid), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1363,7 +1363,7 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.readCharacteristic(mClientIf, device.getAddress(), characteristic.getInstanceId(), AUTHENTICATION_NONE, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1402,7 +1402,7 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.readUsingCharacteristicUuid(mClientIf, mDevice.getAddress(), new ParcelUuid(uuid), startHandle, endHandle, AUTHENTICATION_NONE, mAttributionSource, recv); @@ -1511,7 +1511,7 @@ public final class BluetoothGatt implements BluetoothProfile { int requestStatus = BluetoothStatusCodes.ERROR_UNKNOWN; try { for (int i = 0; i < WRITE_CHARACTERISTIC_MAX_RETRIES; i++) { - final SynchronousResultReceiver<Integer> recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); mService.writeCharacteristic(mClientIf, device.getAddress(), characteristic.getInstanceId(), writeType, AUTHENTICATION_NONE, value, mAttributionSource, recv); @@ -1573,7 +1573,7 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.readDescriptor(mClientIf, device.getAddress(), descriptor.getInstanceId(), AUTHENTICATION_NONE, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1662,7 +1662,7 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - final SynchronousResultReceiver<Integer> recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); mService.writeDescriptor(mClientIf, device.getAddress(), descriptor.getInstanceId(), AUTHENTICATION_NONE, value, mAttributionSource, recv); @@ -1709,7 +1709,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.beginReliableWrite(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1744,7 +1744,7 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.endReliableWrite(mClientIf, mDevice.getAddress(), true, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1773,7 +1773,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return; try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.endReliableWrite(mClientIf, mDevice.getAddress(), false, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1822,7 +1822,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (device == null) return false; try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.registerForNotification(mClientIf, device.getAddress(), characteristic.getInstanceId(), enable, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1848,7 +1848,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.refreshDevice(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1875,7 +1875,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.readRemoteRssi(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1909,7 +1909,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.configureMTU(mClientIf, mDevice.getAddress(), mtu, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1943,7 +1943,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.connectionParameterUpdate(mClientIf, mDevice.getAddress(), connectionPriority, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1979,7 +1979,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = new SynchronousResultReceiver(); + final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); mService.leConnectionUpdate(mClientIf, mDevice.getAddress(), minConnectionInterval, maxConnectionInterval, slaveLatency, supervisionTimeout, |