summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothLeAudio.java
diff options
context:
space:
mode:
authorJakub Tyszkowski <jakub.tyszkowski@codecoup.pl>2022-01-27 13:23:05 +0000
committerJack He <siyuanh@google.com>2022-02-02 15:19:01 -0800
commit421c8fbdde31f1146bd6f2d93589e2c10b314bb5 (patch)
treec5bb4d6472db04e6185587c2b26f37717dec7fa2 /framework/java/android/bluetooth/BluetoothLeAudio.java
parentb87fc995f2e21c0cbcac9b0f9374203f90c9ece8 (diff)
LE Audio: Expose more system APIs
* Expose two intentss: * ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED * ACTION_LE_AUDIO_GROUP_NODE_STATUS_CHANGED * Settings and Telecom are interested in the group node status information, therefore lets expose the API as a SystemApi * Reduce scope of HAP connection state API to system API * Expose more system APIs for HAP client * To select different hearing presets * To get notified about changes in hearing presets * To get all available hearing presets * Expose more system APIs for CSIP * To make error codes more visible for the API caller * Expose GROUP_ID_INVALID to public API for getGroupId() Bug: 150670922 Test: atest BluetoothInstrumentationTests Tag: #feature Sponsor: siyuanh@ Ignore-AOSP-First: earlier change merged on internal Change-Id: If87e0863f23b989632603ac1253e4a77bfff028d Merged-In: If87e0863f23b989632603ac1253e4a77bfff028d (cherry picked from commit a89f2e1a02f986de04078ee399f39ad09d0c53f8)
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothLeAudio.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothLeAudio.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/framework/java/android/bluetooth/BluetoothLeAudio.java b/framework/java/android/bluetooth/BluetoothLeAudio.java
index cb543bdbb9..aa34d0d323 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudio.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudio.java
@@ -92,9 +92,13 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
*
* @hide
*/
+ @SystemApi
@RequiresLegacyBluetoothPermission
@RequiresBluetoothConnectPermission
- @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
+ @RequiresPermission(allOf = {
+ android.Manifest.permission.BLUETOOTH_CONNECT,
+ android.Manifest.permission.BLUETOOTH_PRIVILEGED,
+ })
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED =
"android.bluetooth.action.LE_AUDIO_ACTIVE_DEVICE_CHANGED";
@@ -112,12 +116,15 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
*
* @hide
*/
- @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
+ @SystemApi
+ @RequiresPermission(allOf = {
+ android.Manifest.permission.BLUETOOTH_CONNECT,
+ android.Manifest.permission.BLUETOOTH_PRIVILEGED,
+ })
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_LE_AUDIO_GROUP_NODE_STATUS_CHANGED =
"android.bluetooth.action.LE_AUDIO_GROUP_NODE_STATUS_CHANGED";
-
/**
* Intent used to broadcast group status information.
*
@@ -256,8 +263,6 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
/**
* This represents an invalid group ID.
- *
- * @hide
*/
public static final int GROUP_ID_INVALID = IBluetoothLeAudio.LE_AUDIO_GROUP_ID_INVALID;
@@ -272,6 +277,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
* Contains group id.
* @hide
*/
+ @SystemApi
public static final String EXTRA_LE_AUDIO_GROUP_ID =
"android.bluetooth.extra.LE_AUDIO_GROUP_ID";
@@ -285,6 +291,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
* <p>
* @hide
*/
+ @SystemApi
public static final String EXTRA_LE_AUDIO_GROUP_NODE_STATUS =
"android.bluetooth.extra.LE_AUDIO_GROUP_NODE_STATUS";
@@ -348,12 +355,14 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
* Indicating that node has been added to the group.
* @hide
*/
+ @SystemApi
public static final int GROUP_NODE_ADDED = IBluetoothLeAudio.GROUP_NODE_ADDED;
/**
* Indicating that node has been removed from the group.
* @hide
*/
+ @SystemApi
public static final int GROUP_NODE_REMOVED = IBluetoothLeAudio.GROUP_NODE_REMOVED;
private final BluetoothProfileConnector<IBluetoothLeAudio> mProfileConnector =
@@ -675,7 +684,8 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
* Get device group id. Devices with same group id belong to same group (i.e left and right
* earbud)
* @param device LE Audio capable device
- * @return group id that this device currently belongs to
+ * @return group id that this device currently belongs to, {@link #GROUP_ID_INVALID} when this
+ * device does not belong to any group
*/
@RequiresLegacyBluetoothPermission
@RequiresBluetoothConnectPermission