diff options
Diffstat (limited to 'framework/java/android')
3 files changed, 53 insertions, 6 deletions
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java index ff8ce5b9ea..0187024ff8 100644 --- a/framework/java/android/bluetooth/BluetoothDevice.java +++ b/framework/java/android/bluetooth/BluetoothDevice.java @@ -19,6 +19,7 @@ package android.bluetooth; import static android.bluetooth.BluetoothUtils.getSyncTimeout; import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; @@ -793,6 +794,15 @@ public final class BluetoothDevice implements Parcelable, Attributable { /** * Broadcast Action: This intent is used to broadcast CONNECTION ACCESS REQUEST * + * This action will trigger a prompt for the user to accept or deny giving the + * permission for this device. Permissions can be specified with + * {@link #EXTRA_ACCESS_REQUEST_TYPE}. + * + * The reply will be an {@link #ACTION_CONNECTION_ACCESS_REPLY} sent to the specified + * {@link #EXTRA_PACKAGE_NAME} and {@link #EXTRA_CLASS_NAME}. + * + * This action can be cancelled with {@link #ACTION_CONNECTION_ACCESS_CANCEL}. + * * @hide */ @SystemApi @@ -806,6 +816,13 @@ public final class BluetoothDevice implements Parcelable, Attributable { /** * Broadcast Action: This intent is used to broadcast CONNECTION ACCESS REPLY * + * This action is the reply from {@link #ACTION_CONNECTION_ACCESS_REQUEST} + * that is sent to the specified {@link #EXTRA_PACKAGE_NAME} + * and {@link #EXTRA_CLASS_NAME}. + * + * See the extra fields {@link #EXTRA_CONNECTION_ACCESS_RESULT} and + * {@link #EXTRA_ALWAYS_ALLOWED} for possible results. + * * @hide */ @SystemApi @@ -843,7 +860,11 @@ public final class BluetoothDevice implements Parcelable, Attributable { "android.bluetooth.device.action.SILENCE_MODE_CHANGED"; /** - * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REQUEST} intent. + * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REQUEST}. + * + * Possible values are {@link #REQUEST_TYPE_PROFILE_CONNECTION}, + * {@link #REQUEST_TYPE_PHONEBOOK_ACCESS}, {@link #REQUEST_TYPE_MESSAGE_ACCESS} + * and {@link #REQUEST_TYPE_SIM_ACCESS} * * @hide */ @@ -887,6 +908,8 @@ public final class BluetoothDevice implements Parcelable, Attributable { /** * Used as an extra field in {@link #ACTION_CONNECTION_ACCESS_REPLY} intent. * + * Possible values are {@link #CONNECTION_ACCESS_YES} and {@link #CONNECTION_ACCESS_NO}. + * * @hide */ @SystemApi @@ -1043,7 +1066,8 @@ public final class BluetoothDevice implements Parcelable, Attributable { public static final int PAIRING_VARIANT_DISPLAY_PIN = 5; /** - * The user will be prompted to accept or deny the OOB pairing request + * The user will be prompted to accept or deny the OOB pairing request. + * This is used for Bluetooth 2.1 secure simple pairing. * * @hide */ @@ -1612,7 +1636,7 @@ public final class BluetoothDevice implements Parcelable, Attributable { @RequiresLegacyBluetoothPermission @RequiresBluetoothConnectPermission @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) - public int getBatteryLevel() { + public @IntRange(from = -100, to = 100) int getBatteryLevel() { if (DBG) log("getBatteryLevel()"); final IBluetooth service = sService; final int defaultValue = BATTERY_LEVEL_BLUETOOTH_OFF; diff --git a/framework/java/android/bluetooth/BluetoothDevicePicker.java b/framework/java/android/bluetooth/BluetoothDevicePicker.java index d17ab8d72a..d1fc0622e4 100644 --- a/framework/java/android/bluetooth/BluetoothDevicePicker.java +++ b/framework/java/android/bluetooth/BluetoothDevicePicker.java @@ -30,15 +30,37 @@ import android.bluetooth.annotations.RequiresBluetoothConnectPermission; */ @SystemApi public interface BluetoothDevicePicker { + + /** + * Extra for filter type used with {@link #ACTION_LAUNCH}. + * The value must be a boolean indicating whether the device should need authentication or not. + */ @SuppressLint("ActionValue") public static final String EXTRA_NEED_AUTH = "android.bluetooth.devicepicker.extra.NEED_AUTH"; + + /** + * Extra for filter type used with {@link #ACTION_LAUNCH}. + * This extra must contain the filter type that will be applied to the device list. + * Possible values are {@link #FILTER_TYPE_ALL}, {@link #FILTER_TYPE_AUDIO}, + * {@link #FILTER_TYPE_TRANSFER}, {@link #FILTER_TYPE_PANU}, and {@link #FILTER_TYPE_NAP}. + */ @SuppressLint("ActionValue") public static final String EXTRA_FILTER_TYPE = "android.bluetooth.devicepicker.extra.FILTER_TYPE"; + + /** + * Extra for filter type used with {@link #ACTION_LAUNCH}. + * This extra must contain the package name that called {@link #ACTION_LAUNCH}. + */ @SuppressLint("ActionValue") public static final String EXTRA_LAUNCH_PACKAGE = "android.bluetooth.devicepicker.extra.LAUNCH_PACKAGE"; + + /** + * Extra for filter type used with {@link #ACTION_LAUNCH}. + * This extra must contain the class name that called {@link #ACTION_LAUNCH}. + */ @SuppressLint("ActionValue") public static final String EXTRA_LAUNCH_CLASS = "android.bluetooth.devicepicker.extra.DEVICE_PICKER_LAUNCH_CLASS"; diff --git a/framework/java/android/bluetooth/BluetoothLeAudio.java b/framework/java/android/bluetooth/BluetoothLeAudio.java index b81a8a43a0..bd6cfaf14e 100644 --- a/framework/java/android/bluetooth/BluetoothLeAudio.java +++ b/framework/java/android/bluetooth/BluetoothLeAudio.java @@ -22,6 +22,7 @@ import static android.bluetooth.BluetoothUtils.getSyncTimeout; import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.IntDef; +import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; @@ -152,7 +153,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { /** * Intent used to broadcast group node status information. * - * <p>This intent will have 3 extra: + * <p>This intent will have 3 extras: * <ul> * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. It can * be null if no device is active. </li> @@ -174,7 +175,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { /** * Intent used to broadcast group status information. * - * <p>This intent will have 4 extra: + * <p>This intent will have 3 extras: * <ul> * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. It can * be null if no device is active. </li> @@ -1161,7 +1162,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED }) - public void setVolume(int volume) { + public void setVolume(@IntRange(from = 0, to = 255) int volume) { if (VDBG) log("setVolume(vol: " + volume + " )"); final IBluetoothLeAudio service = getService(); if (service == null) { |