summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothDevicePicker.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2021-04-20 12:30:37 -0600
committerJeff Sharkey <jsharkey@android.com>2021-04-21 12:59:38 -0600
commitd7c55664839ca7e6237cd0ef0f36eb51a4ee7ae6 (patch)
tree39d443fcfc78b04e5c6b517e47e443ff5309ba69 /framework/java/android/bluetooth/BluetoothDevicePicker.java
parent69a12631db6e521d753211fedc7da3ac7d6e6f85 (diff)
Annotations for Bluetooth broadcast intents.
Recent work has been using Error Prone rules and annotations to reflect the current state of permission enforcement across the Bluetooth stack, and we're now in a position were we can add new permission enforcement that had been missing. We've currently standardized on saying that APIs that return device or Bluetooth state information (without sharing details about any particular remote Bluetooth device) do not need to be permission protected. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: I53ac7a4fe1dea57316048c3cac4fa237b6ba3d38
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothDevicePicker.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothDevicePicker.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothDevicePicker.java b/framework/java/android/bluetooth/BluetoothDevicePicker.java
index 09b0a80313..26e46573dd 100644
--- a/framework/java/android/bluetooth/BluetoothDevicePicker.java
+++ b/framework/java/android/bluetooth/BluetoothDevicePicker.java
@@ -16,8 +16,10 @@
package android.bluetooth;
+import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
+import android.bluetooth.annotations.RequiresBluetoothConnectPermission;
/**
* A helper to show a system "Device Picker" activity to the user.
@@ -39,6 +41,8 @@ public interface BluetoothDevicePicker {
* Selected {@link BluetoothDevice} is returned in extra data named
* {@link BluetoothDevice#EXTRA_DEVICE}.
*/
+ @RequiresBluetoothConnectPermission
+ @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_DEVICE_SELECTED =
"android.bluetooth.devicepicker.action.DEVICE_SELECTED";
@@ -54,6 +58,8 @@ public interface BluetoothDevicePicker {
* - {@link #EXTRA_LAUNCH_CLASS} (string): where(which class) this intent
* come from
*/
+ @RequiresBluetoothConnectPermission
+ @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_LAUNCH =
"android.bluetooth.devicepicker.action.LAUNCH";