summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/le/BluetoothLeScanner.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2021-06-03 09:26:53 -0600
committerJeff Sharkey <jsharkey@android.com>2021-06-03 12:14:17 -0600
commit98f3044ce87c7ab9d2a0efbfb8ef6a16872262df (patch)
tree2f734517e7538b0509c34657c49522518d51f4a1 /framework/java/android/bluetooth/le/BluetoothLeScanner.java
parent0cc9fe2cb3763a0f76e3d6078724edc73c3a9a40 (diff)
More Binder call AttributionSource assignment.
Since developers can use a BluetoothDevice object can make remote calls, it needs to have an accurate AttributionSource. Previous CLs had updated many places where these BluetoothDevice instances were passed across Binder interfaces, but this change updates several remaining locations which had been missed. Introduces new "Attributable" marker interface to offer consistent tooling when applying AttributionSource updates. Bug: 187097694 Test: atest BluetoothInstrumentationTests Change-Id: Icad3b9726591f0fbad58a493cefa5a0af7648280
Diffstat (limited to 'framework/java/android/bluetooth/le/BluetoothLeScanner.java')
-rw-r--r--framework/java/android/bluetooth/le/BluetoothLeScanner.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/le/BluetoothLeScanner.java b/framework/java/android/bluetooth/le/BluetoothLeScanner.java
index 60d4e2d6d2..34aac8bfdb 100644
--- a/framework/java/android/bluetooth/le/BluetoothLeScanner.java
+++ b/framework/java/android/bluetooth/le/BluetoothLeScanner.java
@@ -30,6 +30,7 @@ import android.bluetooth.IBluetoothManager;
import android.bluetooth.annotations.RequiresBluetoothLocationPermission;
import android.bluetooth.annotations.RequiresBluetoothScanPermission;
import android.bluetooth.annotations.RequiresLegacyBluetoothAdminPermission;
+import android.content.Attributable;
import android.content.AttributionSource;
import android.os.Handler;
import android.os.Looper;
@@ -516,6 +517,7 @@ public final class BluetoothLeScanner {
*/
@Override
public void onScanResult(final ScanResult scanResult) {
+ Attributable.setAttributionSource(scanResult, mAttributionSource);
if (VDBG) Log.d(TAG, "onScanResult() - " + scanResult.toString());
// Check null in case the scan has been stopped
@@ -533,6 +535,7 @@ public final class BluetoothLeScanner {
@Override
public void onBatchScanResults(final List<ScanResult> results) {
+ Attributable.setAttributionSource(results, mAttributionSource);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
@@ -544,6 +547,7 @@ public final class BluetoothLeScanner {
@Override
public void onFoundOrLost(final boolean onFound, final ScanResult scanResult) {
+ Attributable.setAttributionSource(scanResult, mAttributionSource);
if (VDBG) {
Log.d(TAG, "onFoundOrLost() - onFound = " + onFound + " " + scanResult.toString());
}