summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothGatt.java
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2022-08-10 11:15:16 -0700
committerLinux Build Service Account <lnxbuild@localhost>2022-08-10 11:15:16 -0700
commitfd44afebdcad9cfcaf4b29e979f1d6acc6c917f2 (patch)
tree05fcdd928bf675083b34ec65486e95226d9a2054 /framework/java/android/bluetooth/BluetoothGatt.java
parent7b2835c88cb8d1733d60d7a558d80d9fc0d05150 (diff)
parent7c361396d2c2fbf58423d45d5c54792a69bade75 (diff)
Merge 7c361396d2c2fbf58423d45d5c54792a69bade75 on remote branch
Change-Id: Ib46c197d57679181b505738ad576adf0779e68a0
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothGatt.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothGatt.java54
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,