diff options
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 068188c92e..ee9c691134 100644 --- a/framework/java/android/bluetooth/BluetoothGatt.java +++ b/framework/java/android/bluetooth/BluetoothGatt.java @@ -214,7 +214,7 @@ public final class BluetoothGatt implements BluetoothProfile { return; } try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); // autoConnect is inverse of "isDirect" mService.clientConnect(mClientIf, mDevice.getAddress(), !mAutoConnect, mTransport, mOpportunistic, mPhy, mAttributionSource, recv); @@ -396,7 +396,7 @@ public final class BluetoothGatt implements BluetoothProfile { try { final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE) ? AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM; - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.readCharacteristic( mClientIf, address, handle, authReq, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -464,7 +464,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 = - SynchronousResultReceiver.get(); + new SynchronousResultReceiver(); mService.writeCharacteristic(mClientIf, address, handle, characteristic.getWriteType(), authReq, value, mAttributionSource, recv); @@ -559,7 +559,7 @@ public final class BluetoothGatt implements BluetoothProfile { try { final int authReq = (mAuthRetryState == AUTH_RETRY_STATE_IDLE) ? AUTHENTICATION_NO_MITM : AUTHENTICATION_MITM; - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.readDescriptor(mClientIf, address, handle, authReq, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -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 = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.writeDescriptor(mClientIf, address, handle, authReq, value, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -913,7 +913,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (DBG) Log.d(TAG, "registerApp() - UUID=" + uuid); try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.registerClient(new ParcelUuid(uuid), mBluetoothGattCallback, eatt_support, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -937,7 +937,7 @@ public final class BluetoothGatt implements BluetoothProfile { try { mCallback = null; - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.unregisterClient(mClientIf, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); mClientIf = 0; @@ -1009,7 +1009,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return; try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.clientDisconnect(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1031,7 +1031,7 @@ public final class BluetoothGatt implements BluetoothProfile { public boolean connect() { try { // autoConnect is inverse of "isDirect" - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.clientConnect(mClientIf, mDevice.getAddress(), false, mTransport, mOpportunistic, mPhy, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1064,7 +1064,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 = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.clientSetPreferredPhy(mClientIf, mDevice.getAddress(), txPhy, rxPhy, phyOptions, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1081,7 +1081,7 @@ public final class BluetoothGatt implements BluetoothProfile { @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void readPhy() { try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.clientReadPhy(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1120,7 +1120,7 @@ public final class BluetoothGatt implements BluetoothProfile { mServices.clear(); try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.discoverServices(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1149,7 +1149,7 @@ public final class BluetoothGatt implements BluetoothProfile { mServices.clear(); try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.discoverServiceByUuid(mClientIf, mDevice.getAddress(), new ParcelUuid(uuid), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1243,7 +1243,7 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.readCharacteristic(mClientIf, device.getAddress(), characteristic.getInstanceId(), AUTHENTICATION_NONE, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1282,7 +1282,7 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.readUsingCharacteristicUuid(mClientIf, mDevice.getAddress(), new ParcelUuid(uuid), startHandle, endHandle, AUTHENTICATION_NONE, mAttributionSource, recv); @@ -1391,7 +1391,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 = SynchronousResultReceiver.get(); + final SynchronousResultReceiver<Integer> recv = new SynchronousResultReceiver(); mService.writeCharacteristic(mClientIf, device.getAddress(), characteristic.getInstanceId(), writeType, AUTHENTICATION_NONE, value, mAttributionSource, recv); @@ -1453,7 +1453,7 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.readDescriptor(mClientIf, device.getAddress(), descriptor.getInstanceId(), AUTHENTICATION_NONE, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1542,7 +1542,7 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver<Integer> recv = new SynchronousResultReceiver(); mService.writeDescriptor(mClientIf, device.getAddress(), descriptor.getInstanceId(), AUTHENTICATION_NONE, value, mAttributionSource, recv); @@ -1589,7 +1589,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.beginReliableWrite(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1624,7 +1624,7 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.endReliableWrite(mClientIf, mDevice.getAddress(), true, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1653,7 +1653,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return; try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.endReliableWrite(mClientIf, mDevice.getAddress(), false, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1702,7 +1702,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (device == null) return false; try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.registerForNotification(mClientIf, device.getAddress(), characteristic.getInstanceId(), enable, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1728,7 +1728,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.refreshDevice(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1755,7 +1755,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.readRemoteRssi(mClientIf, mDevice.getAddress(), mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1789,7 +1789,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.configureMTU(mClientIf, mDevice.getAddress(), mtu, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } catch (RemoteException | TimeoutException e) { @@ -1823,7 +1823,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.connectionParameterUpdate(mClientIf, mDevice.getAddress(), connectionPriority, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); @@ -1859,7 +1859,7 @@ public final class BluetoothGatt implements BluetoothProfile { if (mService == null || mClientIf == 0) return false; try { - final SynchronousResultReceiver recv = SynchronousResultReceiver.get(); + final SynchronousResultReceiver recv = new SynchronousResultReceiver(); mService.leConnectionUpdate(mClientIf, mDevice.getAddress(), minConnectionInterval, maxConnectionInterval, slaveLatency, supervisionTimeout, |