1// Bluetooth Audio library for target
2package {
3    // See: http://go/android-license-faq
4    // A large-scale-change added 'default_applicable_licenses' to import
5    // all of the 'license_kinds' from "system_bt_license"
6    // to get the below license kinds:
7    //   SPDX-license-identifier-Apache-2.0
8    default_applicable_licenses: ["system_bt_license"],
9}
10
11cc_library_static {
12    name: "libbt-audio-hal-interface",
13    defaults: [
14        "fluoride_defaults",
15        "latest_android_hardware_bluetooth_audio_ndk_android_shared",
16    ],
17    include_dirs: [
18        "packages/modules/Bluetooth/system",
19        "packages/modules/Bluetooth/system/bta/include",
20        "packages/modules/Bluetooth/system/bta/sys",
21        "packages/modules/Bluetooth/system/gd",
22        "packages/modules/Bluetooth/system/stack/include",
23    ],
24    shared_libs: [
25        "android.hardware.bluetooth.audio@2.0",
26        "android.hardware.bluetooth.audio@2.1",
27        "libhidlbase",
28        "libutils",
29    ],
30    static_libs: [
31        "libbluetooth_log",
32        "libbt-common",
33        "libbt_shim_bridge",
34        "libosi",
35    ],
36    target: {
37        android: {
38            shared_libs: [
39                "libbinder_ndk",
40                "libfmq",
41            ],
42            srcs: [
43                "a2dp_encoding.cc",
44                "aidl/a2dp_encoding_aidl.cc",
45                "aidl/a2dp_provider_info.cc",
46                "aidl/bluetooth_audio_port_impl.cc",
47                "aidl/client_interface_aidl.cc",
48                "aidl/codec_status_aidl.cc",
49                "aidl/hearing_aid_software_encoding_aidl.cc",
50                "aidl/hfp_client_interface_aidl.cc",
51                "aidl/le_audio_software_aidl.cc",
52                "aidl/le_audio_utils.cc",
53                "aidl/provider_info.cc",
54                "hal_version_manager.cc",
55                "hearing_aid_software_encoding.cc",
56                "hfp_client_interface.cc",
57                "hidl/a2dp_encoding_hidl.cc",
58                "hidl/client_interface_hidl.cc",
59                "hidl/codec_status_hidl.cc",
60                "hidl/hearing_aid_software_encoding_hidl.cc",
61                "hidl/le_audio_software_hidl.cc",
62                "le_audio_software.cc",
63            ],
64        },
65        host: {
66            srcs: [
67                "a2dp_encoding_host.cc",
68                "hal_version_manager_host.cc",
69                "hearing_aid_software_encoding_host.cc",
70                "hfp_client_interface_host.cc",
71                "le_audio_software_host.cc",
72                "le_audio_software_host_transport.cc",
73            ],
74        },
75    },
76    host_supported: true,
77    cflags: [
78        "-Wno-unused-parameter",
79        "-Wthread-safety",
80    ],
81    apex_available: [
82        "com.android.btservices",
83    ],
84    min_sdk_version: "Tiramisu",
85    header_libs: ["libbluetooth_headers"],
86}
87
88// Bluetooth Audio client interface library unit tests for target and host
89cc_test {
90    name: "bluetooth-test-audio-hal-interface",
91    defaults: [
92        "fluoride_defaults",
93        "latest_android_hardware_audio_common_ndk_static",
94        "latest_android_hardware_bluetooth_audio_ndk_static",
95        "latest_android_media_audio_common_types_ndk_static",
96    ],
97    include_dirs: [
98        "packages/modules/Bluetooth/system",
99        "packages/modules/Bluetooth/system/gd",
100        "packages/modules/Bluetooth/system/stack/include",
101    ],
102    srcs: [
103        "hidl/client_interface_hidl_unittest.cc",
104    ],
105    shared_libs: [
106        "libbase",
107        "libbinder_ndk",
108        "libcutils",
109        "libfmq",
110        "libhidlbase",
111        "liblog",
112        "libutils",
113    ],
114    static_libs: [
115        "android.hardware.audio.common@5.0",
116        "android.hardware.bluetooth.audio@2.0",
117        "android.hardware.bluetooth.audio@2.1",
118        "android.hardware.common-V2-ndk",
119        "android.hardware.common.fmq-V1-ndk",
120        "libbluetooth_log",
121        "libbt-audio-hal-interface",
122        "libbt-common",
123        "libbt_shim_bridge",
124        "libchrome",
125    ],
126    header_libs: ["libbluetooth_headers"],
127}
128
129// Bluetooth Audio Provider Info unit tests for target and host
130cc_test {
131    name: "bluetooth-test-audio-hal-a2dp-provider-info",
132    test_suites: ["general-tests"],
133    defaults: [
134        "fluoride_defaults",
135        "latest_android_hardware_audio_common_ndk_static",
136        "latest_android_hardware_bluetooth_audio_ndk_static",
137        "latest_android_media_audio_common_types_ndk_static",
138        "mts_defaults",
139    ],
140    cflags: [
141        "-DUNIT_TESTS",
142        "-Wno-unused-parameter",
143    ],
144    host_supported: true,
145    test_options: {
146        unit_test: true,
147    },
148    include_dirs: [
149        "packages/modules/Bluetooth/system",
150        "packages/modules/Bluetooth/system/gd",
151        "packages/modules/Bluetooth/system/stack/include",
152    ],
153    sanitize: {
154        cfi: true,
155        scs: true,
156        address: true,
157        all_undefined: true,
158        integer_overflow: true,
159        diag: {
160            undefined: true,
161        },
162    },
163    srcs: [
164        ":TestCommonMockFunctions",
165        ":TestMockAudioHalInterface",
166        "aidl/a2dp_provider_info.cc",
167        "aidl/a2dp_provider_info_unittest.cc",
168    ],
169    shared_libs: [
170        "libaconfig_storage_read_api_cc",
171        "libbinder_ndk",
172        "libcutils",
173        "libhidlbase",
174        "liblog",
175        "libutils",
176        "server_configurable_flags",
177    ],
178    static_libs: [
179        "android.hardware.bluetooth.audio@2.0",
180        "android.hardware.bluetooth.audio@2.1",
181        "android.hardware.bluetooth@1.0",
182        "android.hardware.bluetooth@1.1",
183        "android.hardware.common-V2-ndk",
184        "android.hardware.common.fmq-V1-ndk",
185        "bluetooth_flags_c_lib",
186        "libbase",
187        "libbluetooth-types",
188        "libbluetooth_log",
189        "libbt-common",
190        "libbt_shim_bridge",
191        "libchrome",
192        "libflagtest",
193        "libfmq",
194        "libgmock",
195        "libosi",
196    ],
197    header_libs: ["libbluetooth_headers"],
198}
199
200cc_defaults {
201    name: "libbt_audio_hal_interface_test_defaults",
202    header_libs: [
203        "avrcp_headers",
204        "libbluetooth_headers",
205    ],
206    defaults: [
207        "latest_android_hardware_audio_common_ndk_static",
208        "latest_android_hardware_bluetooth_audio_ndk_static",
209        "latest_android_media_audio_common_types_ndk_static",
210    ],
211    shared_libs: [
212        "libPlatformProperties",
213        "libbinder_ndk",
214        "libcrypto",
215        "libfmq",
216        "libstatslog",
217        "libz",
218        "server_configurable_flags",
219    ],
220    static_libs: [
221        "android.hardware.audio.common@5.0",
222        "android.hardware.bluetooth.a2dp@1.0",
223        "android.hardware.bluetooth.audio@2.0",
224        "android.hardware.bluetooth.audio@2.1",
225        "android.hardware.bluetooth@1.0",
226        "android.hardware.bluetooth@1.1",
227        "android.hardware.common-V2-ndk",
228        "android.hardware.common.fmq-V1-ndk",
229        "libFraunhoferAAC",
230        "libaudio-a2dp-hw-utils",
231        "libbase",
232        "libbluetooth-dumpsys",
233        "libbluetooth-gdx",
234        "libbluetooth-protos",
235        "libbluetooth-types",
236        "libbluetooth_core_rs",
237        "libbluetooth_crypto_toolbox",
238        "libbluetooth_gd",
239        "libbluetooth_log",
240        "libbluetooth_rust_interop",
241        "libbt-common", // needed for MessageLoopThread
242        "libbt-jni-thread",
243        "libbt-sbc-decoder",
244        "libbt-sbc-encoder",
245        "libbt-stack",
246        "libbt-stack-core",
247        "libbt_shim_bridge",
248        "libbtcore",
249        "libbtdevice",
250        "libbte",
251        "libbtif",
252        "libbtif-core",
253        "libcgrouprc",
254        "libcgrouprc_format",
255        "libchrome",
256        "libcutils",
257        "libevent",
258        "libg722codec",
259        "libhidlbase",
260        "libjsoncpp",
261        "liblc3",
262        "liblog",
263        "libopus",
264        "libosi",
265        "libprotobuf-cpp-lite",
266        "libstatslog_bt",
267        "libudrv-uipc",
268        "libutils",
269    ],
270    include_dirs: [
271        "packages/modules/Bluetooth/system",
272        "packages/modules/Bluetooth/system/bta/include",
273        "packages/modules/Bluetooth/system/btif",
274        "packages/modules/Bluetooth/system/gd",
275        "packages/modules/Bluetooth/system/stack/include",
276    ],
277}
278
279// Bluetooth Audio client interface library unit tests
280cc_test {
281    name: "bluetooth-test-audio-hal-aidl-leaudio-utils",
282    host_supported: true,
283    defaults: [
284        "fluoride_defaults",
285        "latest_android_hardware_audio_common_ndk_static",
286        "latest_android_hardware_bluetooth_audio_ndk_static",
287        "latest_android_media_audio_common_types_ndk_static",
288    ],
289    include_dirs: [
290        "packages/modules/Bluetooth/system",
291        "packages/modules/Bluetooth/system/bta/include",
292        "packages/modules/Bluetooth/system/gd",
293        "packages/modules/Bluetooth/system/stack/include",
294    ],
295    srcs: [
296        "aidl/le_audio_utils.cc",
297        "aidl/le_audio_utils_unittest.cc",
298    ],
299    shared_libs: [
300        "libbase",
301        "libbinder",
302        "libbinder_ndk",
303        "libfmq",
304        "liblog",
305        "libstatslog",
306        "libutils",
307        "server_configurable_flags",
308    ],
309    static_libs: [
310        "android.hardware.common-V2-ndk",
311        "android.hardware.common.fmq-V1-ndk",
312        "bluetooth_flags_c_lib",
313        "libbluetooth-types",
314        "libbluetooth_log",
315        "libbt-bta",
316        "libbt-common",
317        "libbt-platform-protos-lite",
318        "libbt_shim_bridge",
319        "libchrome",
320        "libevent",
321        "libgmock",
322    ],
323    cflags: [
324        "-DBUILDCFG",
325    ],
326    header_libs: ["libbluetooth_headers"],
327}
328
329// Bluetooth Audio client interface library unit tests
330cc_test {
331    name: "bluetooth-test-audio-hal-le-audio-software",
332    host_supported: true,
333    defaults: [
334        "libbt_audio_hal_interface_test_defaults",
335    ],
336    include_dirs: [
337        "packages/modules/Bluetooth/system/audio_hal_interface",
338        "packages/modules/Bluetooth/system/bta",
339    ],
340    srcs: [
341        ":TestCommonMockFunctions",
342        ":TestMockAudioHalInterface",
343        ":TestMockCodecManager",
344        ":TestMockOsi",
345        "aidl/le_audio_software_aidl.cc",
346        "aidl/le_audio_utils.cc",
347        "hidl/le_audio_software_hidl.cc",
348        "le_audio_software.cc",
349        "le_audio_software_unittest.cc",
350    ],
351    static_libs: [
352        "libbt-bta",
353        "libbt-platform-protos-lite",
354        "libgmock",
355    ],
356    header_libs: ["libbluetooth_headers"],
357    cflags: [
358        "-DBUILDCFG",
359    ],
360}
361