diff options
author | Grzegorz Kołodziejczyk <grzegorz.kolodziejczyk@codecoup.pl> | 2021-05-14 12:19:07 +0000 |
---|---|---|
committer | Jakub Pawlowski <jpawlowski@google.com> | 2021-09-02 18:12:10 +0200 |
commit | f6e7a62747ace70b47cfd8688a6eb950b9e5431c (patch) | |
tree | a09cd6525f94e2b4518608186e922d2a9c44e807 /framework/java/android/bluetooth/BluetoothLeAudio.java | |
parent | efd896722ebd5b315542b36dcc5f45b7bf1d4714 (diff) |
le_audio: Introduce connection state handling for LE Audio group
Patch implements connection state handling for LE Audio device group.
Tag: #feature
Test: Set LE audio device as active
Sponsor: jpawlowski@
Bug: 150670922
Change-Id: I11222ca07e265ac8b6dc3c21650874ebeffa473c
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothLeAudio.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothLeAudio.java | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothLeAudio.java b/framework/java/android/bluetooth/BluetoothLeAudio.java index c438dd34f8..3ea865bfd6 100644 --- a/framework/java/android/bluetooth/BluetoothLeAudio.java +++ b/framework/java/android/bluetooth/BluetoothLeAudio.java @@ -97,12 +97,148 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { "android.bluetooth.action.LE_AUDIO_ACTIVE_DEVICE_CHANGED"; /** + * Intent used to broadcast group node status information. + * + * <p>This intent will have 3 extra: + * <ul> + * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. It can + * be null if no device is active. </li> + * <li> {@link #EXTRA_LE_AUDIO_GROUP_ID} - Group id. </li> + * <li> {@link #EXTRA_LE_AUDIO_GROUP_NODE_STATUS} - Group node status. </li> + * </ul> + * + * @hide + */ + @RequiresPermission(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. + * + * <p>This intent will have 4 extra: + * <ul> + * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. It can + * be null if no device is active. </li> + * <li> {@link #EXTRA_LE_AUDIO_GROUP_ID} - Group id. </li> + * <li> {@link #EXTRA_LE_AUDIO_GROUP_STATUS} - Group status. </li> + * </ul> + * + * @hide + */ + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_LE_AUDIO_GROUP_STATUS_CHANGED = + "android.bluetooth.action.LE_AUDIO_GROUP_STATUS_CHANGED"; + + /** + * Intent used to broadcast group audio configuration changed information. + * + * <p>This intent will have 5 extra: + * <ul> + * <li> {@link #EXTRA_LE_AUDIO_GROUP_ID} - Group id. </li> + * <li> {@link #EXTRA_LE_AUDIO_DIRECTION} - Direction as bit mask. </li> + * <li> {@link #EXTRA_LE_AUDIO_SINK_LOCATION} - Sink location as per Bluetooth Assigned + * Numbers </li> + * <li> {@link #EXTRA_LE_AUDIO_SOURCE_LOCATION} - Source location as per Bluetooth Assigned + * Numbers </li> + * <li> {@link #EXTRA_LE_AUDIO_AVAILABLE_CONTEXTS} - Available contexts for group as per + * Bluetooth Assigned Numbers </li> + * </ul> + * + * @hide + */ + @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED) + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_LE_AUDIO_CONF_CHANGED = + "android.bluetooth.action.LE_AUDIO_CONF_CHANGED"; + + /** + * Indicates conversation between humans as, for example, in telephony or video calls. + * @hide + */ + public static final int CONTEXT_TYPE_COMMUNICATION = 0x0002; + + /** + * Indicates media as, for example, in music, public radio, podcast or video soundtrack. + * @hide + */ + public static final int CONTEXT_TYPE_MEDIA = 0x0004; + + /** * This represents an invalid group ID. * * @hide */ public static final int GROUP_ID_INVALID = IBluetoothLeAudio.LE_AUDIO_GROUP_ID_INVALID; + /** + * Contains group id. + * @hide + */ + public static final String EXTRA_LE_AUDIO_GROUP_ID = + "android.bluetooth.extra.LE_AUDIO_GROUP_ID"; + + /** + * Contains group node status, can be any of + * <p> + * <ul> + * <li> {@link #GROUP_NODE_ADDED} </li> + * <li> {@link #GROUP_NODE_REMOVED} </li> + * </ul> + * <p> + * @hide + */ + public static final String EXTRA_LE_AUDIO_GROUP_NODE_STATUS = + "android.bluetooth.extra.LE_AUDIO_GROUP_NODE_STATUS"; + + /** + * Contains group status, can be any of + * + * <p> + * <ul> + * <li> {@link #GROUP_STATUS_IDLE} </li> + * <li> {@link #GROUP_STATUS_STREAMING} </li> + * <li> {@link #GROUP_STATUS_SUSPENDED} </li> + * <li> {@link #GROUP_STATUS_RECONFIGURED} </li> + * <li> {@link #GROUP_STATUS_DESTROYED} </li> + * </ul> + * <p> + * @hide + */ + public static final String EXTRA_LE_AUDIO_GROUP_STATUS = + "android.bluetooth.extra.LE_AUDIO_GROUP_STATUS"; + + /** + * Contains bit mask for direction, bit 0 set when Sink, bit 1 set when Source. + * @hide + */ + public static final String EXTRA_LE_AUDIO_DIRECTION = + "android.bluetooth.extra.LE_AUDIO_DIRECTION"; + + /** + * Contains source location as per Bluetooth Assigned Numbers + * @hide + */ + public static final String EXTRA_LE_AUDIO_SOURCE_LOCATION = + "android.bluetooth.extra.LE_AUDIO_SOURCE_LOCATION"; + + /** + * Contains sink location as per Bluetooth Assigned Numbers + * @hide + */ + public static final String EXTRA_LE_AUDIO_SINK_LOCATION = + "android.bluetooth.extra.LE_AUDIO_SINK_LOCATION"; + + /** + * Contains available context types for group as per Bluetooth Assigned Numbers + * @hide + */ + public static final String EXTRA_LE_AUDIO_AVAILABLE_CONTEXTS = + "android.bluetooth.extra.LE_AUDIO_AVAILABLE_CONTEXTS"; + private final BluetoothAdapter mAdapter; private final AttributionSource mAttributionSource; private final BluetoothProfileConnector<IBluetoothLeAudio> mProfileConnector = |