summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/le/AdvertisingSet.java
diff options
context:
space:
mode:
authorOli Lan <olilan@google.com>2021-04-22 19:05:17 +0100
committerJeff Sharkey <jsharkey@android.com>2021-04-22 14:47:39 -0600
commit4dabcb764f1948823dcd74eefb3440afcab07db2 (patch)
tree32b0d4ad5c2e3f8d37a08b619d7d78bcd4e2a295 /framework/java/android/bluetooth/le/AdvertisingSet.java
parent4e4c9c4796c2c16d32e87417e084a1f724e9f258 (diff)
Pass attribution source to BT APIs.
This adds attribution source to BT method calls. This is now required to allow the app ops for the new BT permissions (BLUETOOTH_CONNECT, BLUETOOTH_ADVERTISE, and BLUETOOTH_SCAN) to be noted. Bug: 183626112 Test: atest BluetoothInstrumentationTests Change-Id: I81598553b762e491d6364064a2e1ef41dec89bf9
Diffstat (limited to 'framework/java/android/bluetooth/le/AdvertisingSet.java')
-rw-r--r--framework/java/android/bluetooth/le/AdvertisingSet.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/framework/java/android/bluetooth/le/AdvertisingSet.java b/framework/java/android/bluetooth/le/AdvertisingSet.java
index d7e48ca543..caa91fb239 100644
--- a/framework/java/android/bluetooth/le/AdvertisingSet.java
+++ b/framework/java/android/bluetooth/le/AdvertisingSet.java
@@ -18,12 +18,12 @@ package android.bluetooth.le;
import android.annotation.RequiresNoPermission;
import android.annotation.RequiresPermission;
-import android.annotation.SuppressLint;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.IBluetoothGatt;
import android.bluetooth.IBluetoothManager;
import android.bluetooth.annotations.RequiresBluetoothAdvertisePermission;
import android.bluetooth.annotations.RequiresLegacyBluetoothAdminPermission;
+import android.content.AttributionSource;
import android.os.RemoteException;
import android.util.Log;
@@ -40,11 +40,12 @@ public final class AdvertisingSet {
private final IBluetoothGatt mGatt;
private int mAdvertiserId;
+ private AttributionSource mAttributionSource;
- /* package */ AdvertisingSet(int advertiserId,
- IBluetoothManager bluetoothManager) {
+ /* package */ AdvertisingSet(int advertiserId, IBluetoothManager bluetoothManager,
+ AttributionSource attributionSource) {
mAdvertiserId = advertiserId;
-
+ mAttributionSource = attributionSource;
try {
mGatt = bluetoothManager.getBluetoothGatt();
} catch (RemoteException e) {
@@ -75,7 +76,7 @@ public final class AdvertisingSet {
int maxExtendedAdvertisingEvents) {
try {
mGatt.enableAdvertisingSet(mAdvertiserId, enable, duration,
- maxExtendedAdvertisingEvents);
+ maxExtendedAdvertisingEvents, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -98,7 +99,7 @@ public final class AdvertisingSet {
@RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE)
public void setAdvertisingData(AdvertiseData advertiseData) {
try {
- mGatt.setAdvertisingData(mAdvertiserId, advertiseData);
+ mGatt.setAdvertisingData(mAdvertiserId, advertiseData, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -118,7 +119,7 @@ public final class AdvertisingSet {
@RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE)
public void setScanResponseData(AdvertiseData scanResponse) {
try {
- mGatt.setScanResponseData(mAdvertiserId, scanResponse);
+ mGatt.setScanResponseData(mAdvertiserId, scanResponse, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -136,7 +137,7 @@ public final class AdvertisingSet {
@RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE)
public void setAdvertisingParameters(AdvertisingSetParameters parameters) {
try {
- mGatt.setAdvertisingParameters(mAdvertiserId, parameters);
+ mGatt.setAdvertisingParameters(mAdvertiserId, parameters, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -152,7 +153,7 @@ public final class AdvertisingSet {
@RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE)
public void setPeriodicAdvertisingParameters(PeriodicAdvertisingParameters parameters) {
try {
- mGatt.setPeriodicAdvertisingParameters(mAdvertiserId, parameters);
+ mGatt.setPeriodicAdvertisingParameters(mAdvertiserId, parameters, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -173,7 +174,7 @@ public final class AdvertisingSet {
@RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE)
public void setPeriodicAdvertisingData(AdvertiseData periodicData) {
try {
- mGatt.setPeriodicAdvertisingData(mAdvertiserId, periodicData);
+ mGatt.setPeriodicAdvertisingData(mAdvertiserId, periodicData, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -191,7 +192,7 @@ public final class AdvertisingSet {
@RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE)
public void setPeriodicAdvertisingEnabled(boolean enable) {
try {
- mGatt.setPeriodicAdvertisingEnable(mAdvertiserId, enable);
+ mGatt.setPeriodicAdvertisingEnable(mAdvertiserId, enable, mAttributionSource);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}