diff options
author | Alice Kuo <aliceypkuo@google.com> | 2022-03-11 13:39:21 +0800 |
---|---|---|
committer | Alice Kuo <aliceypkuo@google.com> | 2022-03-11 05:56:58 +0000 |
commit | 29f38f456357c1583f11a6f4f2d249727f57572d (patch) | |
tree | 4750959423c96ef51057bbdda2f0d553ae7ffd82 /framework/java/android/bluetooth/BluetoothLeAudio.java | |
parent | 6cdc37eb3cba8d2b9424f8df08a9febf25ecac50 (diff) |
Add getAudioLocation implementation
The change contains
1. Update the sink audio location as it is obtained from the remote device's PACS record
2. Store the audio location in the deviceAudioLocationMap
3. Clear the audio location as device unbonded
4. Support getAudioLocation function to return the sink audio location
Bug: 197199736
Test: build pass
Change-Id: I565f52b3b26afcc4990b5bb89ccc550e7db3607a
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothLeAudio.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothLeAudio.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/framework/java/android/bluetooth/BluetoothLeAudio.java b/framework/java/android/bluetooth/BluetoothLeAudio.java index 56dc9b6510..1999b00984 100644 --- a/framework/java/android/bluetooth/BluetoothLeAudio.java +++ b/framework/java/android/bluetooth/BluetoothLeAudio.java @@ -1268,9 +1268,14 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { if (service == null) { Log.w(TAG, "Proxy not attached to service"); if (DBG) log(Log.getStackTraceString(new Throwable())); - } else if (mAdapter.isEnabled()) { - //TODO: add the implementation. - if (VDBG) log("getAudioLocation() from LE audio service"); + } else if (mAdapter.isEnabled() && isValidDevice(device)) { + try { + final SynchronousResultReceiver<Integer> recv = new SynchronousResultReceiver(); + service.getAudioLocation(device, mAttributionSource, recv); + return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(defaultLocation); + } catch (RemoteException | TimeoutException e) { + Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); + } } return defaultLocation; } |