summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothLeAudio.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@google.com>2021-04-23 19:38:54 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-04-23 19:38:54 +0000
commit995557650f13f2ee98a4bdeaa8096c78658ef1b1 (patch)
tree0bca20468489fa6064bd73e4a720cc013c4fa12a /framework/java/android/bluetooth/BluetoothLeAudio.java
parent26a3a23d4c105c5ccd1b98ce0f83b21ee3b1ffe4 (diff)
parentf9e176c3dcafb82f251a123751578539e3484deb (diff)
Merge changes from topic "btapiattribution" into sc-dev
* changes: More AttributionSource plumbing. Pass attribution source to BT APIs.
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothLeAudio.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudio.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/framework/java/android/bluetooth/BluetoothLeAudio.java b/framework/java/android/bluetooth/BluetoothLeAudio.java
index 462c7b7ede..a8ca9a8ada 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudio.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudio.java
@@ -26,6 +26,7 @@ import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SuppressLint;
import android.bluetooth.annotations.RequiresBluetoothConnectPermission;
import android.bluetooth.annotations.RequiresLegacyBluetoothPermission;
+import android.content.AttributionSource;
import android.content.Context;
import android.os.Binder;
import android.os.IBinder;
@@ -101,7 +102,8 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
*/
public static final int GROUP_ID_INVALID = IBluetoothLeAudio.LE_AUDIO_GROUP_ID_INVALID;
- private BluetoothAdapter mAdapter;
+ private final BluetoothAdapter mAdapter;
+ private final AttributionSource mAttributionSource;
private final BluetoothProfileConnector<IBluetoothLeAudio> mProfileConnector =
new BluetoothProfileConnector(this, BluetoothProfile.LE_AUDIO, "BluetoothLeAudio",
IBluetoothLeAudio.class.getName()) {
@@ -115,8 +117,10 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
* Create a BluetoothLeAudio proxy object for interacting with the local
* Bluetooth LeAudio service.
*/
- /*package*/ BluetoothLeAudio(Context context, ServiceListener listener) {
- mAdapter = BluetoothAdapter.getDefaultAdapter();
+ /* package */ BluetoothLeAudio(Context context, ServiceListener listener,
+ BluetoothAdapter adapter) {
+ mAdapter = adapter;
+ mAttributionSource = adapter.getAttributionSource();
mProfileConnector.connect(context, listener);
mCloseGuard = new CloseGuard();
mCloseGuard.open("close");
@@ -223,7 +227,8 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
try {
final IBluetoothLeAudio service = getService();
if (service != null && mAdapter.isEnabled()) {
- return service.getConnectedDevices();
+ return BluetoothDevice.setAttributionSource(
+ service.getConnectedDevices(), mAttributionSource);
}
if (service == null) Log.w(TAG, "Proxy not attached to service");
return new ArrayList<BluetoothDevice>();
@@ -245,7 +250,8 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
try {
final IBluetoothLeAudio service = getService();
if (service != null && mAdapter.isEnabled()) {
- return service.getDevicesMatchingConnectionStates(states);
+ return BluetoothDevice.setAttributionSource(
+ service.getDevicesMatchingConnectionStates(states), mAttributionSource);
}
if (service == null) Log.w(TAG, "Proxy not attached to service");
return new ArrayList<BluetoothDevice>();