Loading core/java/android/bluetooth/BluetoothLeAudio.java +132 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,12 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { public static final String ACTION_LE_AUDIO_CONF_CHANGED = "android.bluetooth.action.LE_AUDIO_CONF_CHANGED"; /** * Indicates unspecified audio content. * @hide */ public static final int CONTEXT_TYPE_UNSPECIFIED = 0x0001; /** * Indicates conversation between humans as, for example, in telephony or video calls. * @hide Loading @@ -167,6 +173,66 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { */ public static final int CONTEXT_TYPE_MEDIA = 0x0004; /** * Indicates instructional audio as, for example, in navigation, traffic announcements * or user guidance. * @hide */ public static final int CONTEXT_TYPE_INSTRUCTIONAL = 0x0008; /** * Indicates attention seeking audio as, for example, in beeps signalling arrival of a message * or keyboard clicks. * @hide */ public static final int CONTEXT_TYPE_ATTENTION_SEEKING = 0x0010; /** * Indicates immediate alerts as, for example, in a low battery alarm, timer expiry or alarm * clock. * @hide */ public static final int CONTEXT_TYPE_IMMEDIATE_ALERT = 0x0020; /** * Indicates man machine communication as, for example, with voice recognition or virtual * assistant. * @hide */ public static final int CONTEXT_TYPE_MAN_MACHINE = 0x0040; /** * Indicates emergency alerts as, for example, with fire alarms or other urgent alerts. * @hide */ public static final int CONTEXT_TYPE_EMERGENCY_ALERT = 0x0080; /** * Indicates ringtone as in a call alert. * @hide */ public static final int CONTEXT_TYPE_RINGTONE = 0x0100; /** * Indicates audio associated with a television program and/or with metadata conforming to the * Bluetooth Broadcast TV profile. * @hide */ public static final int CONTEXT_TYPE_TV = 0x0200; /** * Indicates audio associated with a low latency live audio stream. * * @hide */ public static final int CONTEXT_TYPE_LIVE = 0x0400; /** * Indicates audio associated with a video game stream. * @hide */ public static final int CONTEXT_TYPE_GAME = 0x0800; /** * This represents an invalid group ID. * Loading Loading @@ -250,6 +316,17 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { */ public static final int GROUP_STATUS_INACTIVE = IBluetoothLeAudio.GROUP_STATUS_INACTIVE; /** * Indicating that node has been added to the group. * @hide */ public static final int GROUP_NODE_ADDED = IBluetoothLeAudio.GROUP_NODE_ADDED; /** * Indicating that node has been removed from the group. * @hide */ public static final int GROUP_NODE_REMOVED = IBluetoothLeAudio.GROUP_NODE_REMOVED; private final BluetoothProfileConnector<IBluetoothLeAudio> mProfileConnector = new BluetoothProfileConnector(this, BluetoothProfile.LE_AUDIO, "BluetoothLeAudio", Loading Loading @@ -545,6 +622,61 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { } } /** * Add device to the given group. * @param group_id group ID the device is being added to * @param device the active device * @return true on success, otherwise false * @hide */ @RequiresBluetoothConnectPermission @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED }) public boolean groupAddNode(int group_id, @NonNull BluetoothDevice device) { if (VDBG) log("groupAddNode()"); final IBluetoothLeAudio service = getService(); try { if (service != null && mAdapter.isEnabled()) { return service.groupAddNode(group_id, device, mAttributionSource); } if (service == null) Log.w(TAG, "Proxy not attached to service"); return false; } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } /** * Remove device from a given group. * @param group_id group ID the device is being removed from * @param device the active device * @return true on success, otherwise false * * @hide */ @RequiresBluetoothConnectPermission @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED }) public boolean groupRemoveNode(int group_id, @NonNull BluetoothDevice device) { if (VDBG) log("groupRemoveNode()"); final IBluetoothLeAudio service = getService(); try { if (service != null && mAdapter.isEnabled()) { return service.groupRemoveNode(group_id, device, mAttributionSource); } if (service == null) Log.w(TAG, "Proxy not attached to service"); return false; } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } /** * Set connection policy of the profile * Loading Loading
core/java/android/bluetooth/BluetoothLeAudio.java +132 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,12 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { public static final String ACTION_LE_AUDIO_CONF_CHANGED = "android.bluetooth.action.LE_AUDIO_CONF_CHANGED"; /** * Indicates unspecified audio content. * @hide */ public static final int CONTEXT_TYPE_UNSPECIFIED = 0x0001; /** * Indicates conversation between humans as, for example, in telephony or video calls. * @hide Loading @@ -167,6 +173,66 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { */ public static final int CONTEXT_TYPE_MEDIA = 0x0004; /** * Indicates instructional audio as, for example, in navigation, traffic announcements * or user guidance. * @hide */ public static final int CONTEXT_TYPE_INSTRUCTIONAL = 0x0008; /** * Indicates attention seeking audio as, for example, in beeps signalling arrival of a message * or keyboard clicks. * @hide */ public static final int CONTEXT_TYPE_ATTENTION_SEEKING = 0x0010; /** * Indicates immediate alerts as, for example, in a low battery alarm, timer expiry or alarm * clock. * @hide */ public static final int CONTEXT_TYPE_IMMEDIATE_ALERT = 0x0020; /** * Indicates man machine communication as, for example, with voice recognition or virtual * assistant. * @hide */ public static final int CONTEXT_TYPE_MAN_MACHINE = 0x0040; /** * Indicates emergency alerts as, for example, with fire alarms or other urgent alerts. * @hide */ public static final int CONTEXT_TYPE_EMERGENCY_ALERT = 0x0080; /** * Indicates ringtone as in a call alert. * @hide */ public static final int CONTEXT_TYPE_RINGTONE = 0x0100; /** * Indicates audio associated with a television program and/or with metadata conforming to the * Bluetooth Broadcast TV profile. * @hide */ public static final int CONTEXT_TYPE_TV = 0x0200; /** * Indicates audio associated with a low latency live audio stream. * * @hide */ public static final int CONTEXT_TYPE_LIVE = 0x0400; /** * Indicates audio associated with a video game stream. * @hide */ public static final int CONTEXT_TYPE_GAME = 0x0800; /** * This represents an invalid group ID. * Loading Loading @@ -250,6 +316,17 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { */ public static final int GROUP_STATUS_INACTIVE = IBluetoothLeAudio.GROUP_STATUS_INACTIVE; /** * Indicating that node has been added to the group. * @hide */ public static final int GROUP_NODE_ADDED = IBluetoothLeAudio.GROUP_NODE_ADDED; /** * Indicating that node has been removed from the group. * @hide */ public static final int GROUP_NODE_REMOVED = IBluetoothLeAudio.GROUP_NODE_REMOVED; private final BluetoothProfileConnector<IBluetoothLeAudio> mProfileConnector = new BluetoothProfileConnector(this, BluetoothProfile.LE_AUDIO, "BluetoothLeAudio", Loading Loading @@ -545,6 +622,61 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable { } } /** * Add device to the given group. * @param group_id group ID the device is being added to * @param device the active device * @return true on success, otherwise false * @hide */ @RequiresBluetoothConnectPermission @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED }) public boolean groupAddNode(int group_id, @NonNull BluetoothDevice device) { if (VDBG) log("groupAddNode()"); final IBluetoothLeAudio service = getService(); try { if (service != null && mAdapter.isEnabled()) { return service.groupAddNode(group_id, device, mAttributionSource); } if (service == null) Log.w(TAG, "Proxy not attached to service"); return false; } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } /** * Remove device from a given group. * @param group_id group ID the device is being removed from * @param device the active device * @return true on success, otherwise false * * @hide */ @RequiresBluetoothConnectPermission @RequiresPermission(allOf = { android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED }) public boolean groupRemoveNode(int group_id, @NonNull BluetoothDevice device) { if (VDBG) log("groupRemoveNode()"); final IBluetoothLeAudio service = getService(); try { if (service != null && mAdapter.isEnabled()) { return service.groupRemoveNode(group_id, device, mAttributionSource); } if (service == null) Log.w(TAG, "Proxy not attached to service"); return false; } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } /** * Set connection policy of the profile * Loading