summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothHidHost.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/BluetoothHidHost.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/BluetoothHidHost.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothHidHost.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/framework/java/android/bluetooth/BluetoothHidHost.java b/framework/java/android/bluetooth/BluetoothHidHost.java
index 68a9d371d3..c655422dbb 100644
--- a/framework/java/android/bluetooth/BluetoothHidHost.java
+++ b/framework/java/android/bluetooth/BluetoothHidHost.java
@@ -26,6 +26,7 @@ import android.bluetooth.annotations.RequiresLegacyBluetoothAdminPermission;
import android.bluetooth.annotations.RequiresLegacyBluetoothPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
+import android.content.AttributionSource;
import android.content.Context;
import android.os.Binder;
import android.os.IBinder;
@@ -236,7 +237,8 @@ public final class BluetoothHidHost implements BluetoothProfile {
public static final String EXTRA_IDLE_TIME =
"android.bluetooth.BluetoothHidHost.extra.IDLE_TIME";
- private BluetoothAdapter mAdapter;
+ private final BluetoothAdapter mAdapter;
+ private final AttributionSource mAttributionSource;
private final BluetoothProfileConnector<IBluetoothHidHost> mProfileConnector =
new BluetoothProfileConnector(this, BluetoothProfile.HID_HOST,
"BluetoothHidHost", IBluetoothHidHost.class.getName()) {
@@ -250,8 +252,10 @@ public final class BluetoothHidHost implements BluetoothProfile {
* Create a BluetoothHidHost proxy object for interacting with the local
* Bluetooth Service which handles the InputDevice profile
*/
- /*package*/ BluetoothHidHost(Context context, ServiceListener listener) {
- mAdapter = BluetoothAdapter.getDefaultAdapter();
+ /* package */ BluetoothHidHost(Context context, ServiceListener listener,
+ BluetoothAdapter adapter) {
+ mAdapter = adapter;
+ mAttributionSource = adapter.getAttributionSource();
mProfileConnector.connect(context, listener);
}
@@ -348,7 +352,8 @@ public final class BluetoothHidHost implements BluetoothProfile {
final IBluetoothHidHost service = getService();
if (service != null && isEnabled()) {
try {
- return service.getConnectedDevices();
+ return BluetoothDevice.setAttributionSource(
+ service.getConnectedDevices(), mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
return new ArrayList<BluetoothDevice>();
@@ -371,7 +376,8 @@ public final class BluetoothHidHost implements BluetoothProfile {
final IBluetoothHidHost service = getService();
if (service != null && isEnabled()) {
try {
- return service.getDevicesMatchingConnectionStates(states);
+ return BluetoothDevice.setAttributionSource(
+ service.getDevicesMatchingConnectionStates(states), mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
return new ArrayList<BluetoothDevice>();