1 /* 2 * Copyright 2020 HIMSA II K/S - www.himsa.com. 3 * Represented by EHIMA - www.ehima.com 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package android.bluetooth; 19 20 import android.bluetooth.BluetoothDevice; 21 import android.bluetooth.BluetoothLeAudioCodecConfig; 22 import android.bluetooth.BluetoothLeAudioCodecStatus; 23 import android.bluetooth.BluetoothLeAudioContentMetadata; 24 import android.bluetooth.BluetoothLeBroadcastMetadata; 25 import android.bluetooth.BluetoothLeBroadcastSettings; 26 import android.bluetooth.IBluetoothLeAudioCallback; 27 import android.bluetooth.IBluetoothLeBroadcastCallback; 28 import android.content.AttributionSource; 29 30 import android.os.ParcelUuid; 31 32 /** 33 * APIs for Bluetooth LE Audio service 34 * 35 * @hide 36 */ 37 interface IBluetoothLeAudio { 38 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") connect(in BluetoothDevice device, in AttributionSource attributionSource)39 boolean connect(in BluetoothDevice device, in AttributionSource attributionSource); 40 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") disconnect(in BluetoothDevice device, in AttributionSource attributionSource)41 boolean disconnect(in BluetoothDevice device, in AttributionSource attributionSource); 42 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getConnectedDevices(in AttributionSource attributionSource)43 List<BluetoothDevice> getConnectedDevices(in AttributionSource attributionSource); 44 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getDevicesMatchingConnectionStates(in int[] states, in AttributionSource attributionSource)45 List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states, in AttributionSource attributionSource); 46 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getConnectionState(in BluetoothDevice device, in AttributionSource attributionSource)47 int getConnectionState(in BluetoothDevice device, in AttributionSource attributionSource); 48 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") setActiveDevice(in BluetoothDevice device, in AttributionSource attributionSource)49 boolean setActiveDevice(in BluetoothDevice device, in AttributionSource attributionSource); 50 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getActiveDevices(in AttributionSource attributionSource)51 List<BluetoothDevice> getActiveDevices(in AttributionSource attributionSource); 52 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource)53 boolean setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource); 54 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource)55 int getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource); 56 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getConnectedGroupLeadDevice(int groupId, in AttributionSource attributionSource)57 BluetoothDevice getConnectedGroupLeadDevice(int groupId, in AttributionSource attributionSource); 58 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getCodecStatus(in int groupId, in AttributionSource source)59 BluetoothLeAudioCodecStatus getCodecStatus(in int groupId, in AttributionSource source); 60 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") setCodecConfigPreference(in int groupId, in BluetoothLeAudioCodecConfig inputCodecConfig, in BluetoothLeAudioCodecConfig outputCodecConfig, in AttributionSource source)61 void setCodecConfigPreference(in int groupId, in BluetoothLeAudioCodecConfig inputCodecConfig, in BluetoothLeAudioCodecConfig outputCodecConfig, in AttributionSource source); 62 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") registerCallback(in IBluetoothLeAudioCallback callback, in AttributionSource attributionSource)63 void registerCallback(in IBluetoothLeAudioCallback callback, in AttributionSource attributionSource); 64 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") unregisterCallback(in IBluetoothLeAudioCallback callback, in AttributionSource attributionSource)65 void unregisterCallback(in IBluetoothLeAudioCallback callback, in AttributionSource attributionSource); 66 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") setCcidInformation(in ParcelUuid userUuid, in int ccid, in int contextType, in AttributionSource attributionSource)67 void setCcidInformation(in ParcelUuid userUuid, in int ccid, in int contextType, in AttributionSource attributionSource); 68 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") setInCall(in boolean inCall, in AttributionSource attributionSource)69 void setInCall(in boolean inCall, in AttributionSource attributionSource); 70 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") setInactiveForHfpHandover(in BluetoothDevice device, in AttributionSource attributionSource)71 void setInactiveForHfpHandover(in BluetoothDevice device, in AttributionSource attributionSource); 72 73 /* Same value as bluetooth::groups::kGroupUnknown */ 74 const int LE_AUDIO_GROUP_ID_INVALID = -1; 75 76 const int GROUP_STATUS_INACTIVE = 0; 77 const int GROUP_STATUS_ACTIVE = 1; 78 const int GROUP_STATUS_TURNED_IDLE_DURING_CALL = 2; 79 80 const int GROUP_NODE_ADDED = 1; 81 const int GROUP_NODE_REMOVED = 2; 82 83 const int GROUP_STREAM_STATUS_IDLE = 0; 84 const int GROUP_STREAM_STATUS_STREAMING = 1; 85 86 /** 87 * Get device group id. Devices with same group id belong to same group (i.e left and right 88 * earbud) 89 */ 90 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getGroupId(in BluetoothDevice device, in AttributionSource attributionSource)91 int getGroupId(in BluetoothDevice device, in AttributionSource attributionSource); 92 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") setVolume(int volume, in AttributionSource attributionSource)93 oneway void setVolume(int volume, in AttributionSource attributionSource); 94 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") groupAddNode(int group_id, in BluetoothDevice device, in AttributionSource attributionSource)95 boolean groupAddNode(int group_id, in BluetoothDevice device, in AttributionSource attributionSource); 96 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") groupRemoveNode(int group_id, in BluetoothDevice device, in AttributionSource attributionSource)97 boolean groupRemoveNode(int group_id, in BluetoothDevice device, in AttributionSource attributionSource); 98 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") getAudioLocation(in BluetoothDevice device, in AttributionSource attributionSource)99 int getAudioLocation(in BluetoothDevice device, in AttributionSource attributionSource); 100 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") isInbandRingtoneEnabled(in AttributionSource attributionSource, int groupId)101 boolean isInbandRingtoneEnabled(in AttributionSource attributionSource, int groupId); 102 103 // Broadcaster API 104 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") registerLeBroadcastCallback(in IBluetoothLeBroadcastCallback callback, in AttributionSource attributionSource)105 void registerLeBroadcastCallback(in IBluetoothLeBroadcastCallback callback, in AttributionSource attributionSource); 106 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") unregisterLeBroadcastCallback(in IBluetoothLeBroadcastCallback callback, in AttributionSource attributionSource)107 void unregisterLeBroadcastCallback(in IBluetoothLeBroadcastCallback callback, in AttributionSource attributionSource); 108 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") startBroadcast(in BluetoothLeBroadcastSettings broadcastSettings, in AttributionSource attributionSource)109 void startBroadcast(in BluetoothLeBroadcastSettings broadcastSettings, in AttributionSource attributionSource); 110 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") stopBroadcast(int broadcastId, in AttributionSource attributionSource)111 void stopBroadcast(int broadcastId, in AttributionSource attributionSource); 112 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") updateBroadcast(int broadcastId, in BluetoothLeBroadcastSettings broadcastSettings, in AttributionSource attributionSource)113 void updateBroadcast(int broadcastId, in BluetoothLeBroadcastSettings broadcastSettings, in AttributionSource attributionSource); 114 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT})") isPlaying(int broadcastId, in AttributionSource attributionSource)115 boolean isPlaying(int broadcastId, in AttributionSource attributionSource); 116 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") getAllBroadcastMetadata(in AttributionSource attributionSource)117 List<BluetoothLeBroadcastMetadata> getAllBroadcastMetadata(in AttributionSource attributionSource); 118 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT})") getMaximumNumberOfBroadcasts(in AttributionSource attributionSource)119 int getMaximumNumberOfBroadcasts(in AttributionSource attributionSource); 120 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT})") getMaximumStreamsPerBroadcast(in AttributionSource attributionSource)121 int getMaximumStreamsPerBroadcast(in AttributionSource attributionSource); 122 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT})") getMaximumSubgroupsPerBroadcast(in AttributionSource attributionSource)123 int getMaximumSubgroupsPerBroadcast(in AttributionSource attributionSource); 124 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") isBroadcastActive(in AttributionSource attributionSource)125 boolean isBroadcastActive(in AttributionSource attributionSource); 126 } 127