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        "[email protected]",
26        "[email protected]",
27        "libhidlbase",
28        "libutils",
29    ],
30    static_libs: [
31        "bluetooth_flags_c_lib",
32        "libbluetooth_log",
33        "libbt-common",
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/a2dp_encoding_aidl.cc",
45                "aidl/a2dp/a2dp_provider_info.cc",
46                "aidl/a2dp/bluetooth_audio_port_impl.cc",
47                "aidl/a2dp/client_interface_aidl.cc",
48                "aidl/a2dp/codec_status_aidl.cc",
49                "aidl/bluetooth_audio_port_impl.cc",
50                "aidl/client_interface_aidl.cc",
51                "aidl/hearing_aid_software_encoding_aidl.cc",
52                "aidl/hfp_client_interface_aidl.cc",
53                "aidl/le_audio_software_aidl.cc",
54                "aidl/le_audio_utils.cc",
55                "aidl/provider_info.cc",
56                "hal_version_manager.cc",
57                "hearing_aid_software_encoding.cc",
58                "hfp_client_interface.cc",
59                "hidl/a2dp_encoding_hidl.cc",
60                "hidl/client_interface_hidl.cc",
61                "hidl/codec_status_hidl.cc",
62                "hidl/hearing_aid_software_encoding_hidl.cc",
63                "hidl/le_audio_software_hidl.cc",
64                "le_audio_software.cc",
65            ],
66        },
67        host: {
68            srcs: [
69                "a2dp_encoding_host.cc",
70                "hal_version_manager_host.cc",
71                "hearing_aid_software_encoding_host.cc",
72                "hfp_client_interface_host.cc",
73                "le_audio_software_host.cc",
74                "le_audio_software_host_transport.cc",
75            ],
76        },
77    },
78    host_supported: true,
79    cflags: [
80        "-Wthread-safety",
81    ],
82    apex_available: [
83        "com.android.btservices",
84    ],
85    min_sdk_version: "Tiramisu",
86    header_libs: ["libbluetooth_headers"],
87}
88
89// Bluetooth Audio client interface library unit tests for target and host
90cc_test {
91    name: "bluetooth-test-audio-hal-interface",
92    defaults: [
93        "fluoride_defaults",
94        "latest_android_hardware_audio_common_ndk_static",
95        "latest_android_hardware_bluetooth_audio_ndk_static",
96        "latest_android_media_audio_common_types_ndk_static",
97    ],
98    include_dirs: [
99        "packages/modules/Bluetooth/system",
100        "packages/modules/Bluetooth/system/gd",
101        "packages/modules/Bluetooth/system/stack/include",
102    ],
103    srcs: [
104        "hidl/client_interface_hidl_unittest.cc",
105    ],
106    shared_libs: [
107        "libbase",
108        "libbinder_ndk",
109        "libcutils",
110        "libfmq",
111        "libhidlbase",
112        "liblog",
113        "libutils",
114    ],
115    static_libs: [
116        "[email protected]",
117        "[email protected]",
118        "[email protected]",
119        "android.hardware.common-V2-ndk",
120        "android.hardware.common.fmq-V1-ndk",
121        "libbluetooth_log",
122        "libbt-audio-hal-interface",
123        "libbt-common",
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    ],
143    host_supported: true,
144    test_options: {
145        unit_test: true,
146    },
147    include_dirs: [
148        "packages/modules/Bluetooth/system",
149        "packages/modules/Bluetooth/system/gd",
150        "packages/modules/Bluetooth/system/stack/include",
151    ],
152    sanitize: {
153        cfi: true,
154        scs: true,
155        address: true,
156        all_undefined: true,
157        integer_overflow: true,
158        diag: {
159            undefined: true,
160        },
161    },
162    srcs: [
163        ":TestCommonMockFunctions",
164        ":TestMockAudioHalInterface",
165        "aidl/a2dp/a2dp_provider_info.cc",
166        "aidl/a2dp/a2dp_provider_info_unittest.cc",
167    ],
168    shared_libs: [
169        "libaconfig_storage_read_api_cc",
170        "libbinder_ndk",
171        "libcutils",
172        "libhidlbase",
173        "liblog",
174        "libutils",
175        "server_configurable_flags",
176    ],
177    static_libs: [
178        "[email protected]",
179        "[email protected]",
180        "[email protected]",
181        "[email protected]",
182        "android.hardware.common-V2-ndk",
183        "android.hardware.common.fmq-V1-ndk",
184        "bluetooth_flags_c_lib_for_test",
185        "libbase",
186        "libbluetooth-types",
187        "libbluetooth_log",
188        "libbt-common",
189        "libchrome",
190        "libcom.android.sysprop.bluetooth.wrapped",
191        "libflagtest",
192        "libfmq",
193        "libgmock",
194        "libosi",
195    ],
196    header_libs: ["libbluetooth_headers"],
197}
198
199cc_defaults {
200    name: "libbt_audio_hal_interface_test_defaults",
201    header_libs: [
202        "avrcp_headers",
203        "libbluetooth_headers",
204    ],
205    defaults: [
206        "aconfig_lib_cc_shared_link.defaults",
207        "bluetooth_cflags",
208        "latest_android_hardware_audio_common_ndk_static",
209        "latest_android_hardware_bluetooth_audio_ndk_static",
210        "latest_android_media_audio_common_types_ndk_static",
211    ],
212    shared_libs: [
213        "libPlatformProperties",
214        "libbinder_ndk",
215        "libcrypto",
216        "libfmq",
217        "libstatslog",
218        "libz",
219        "server_configurable_flags",
220    ],
221    static_libs: [
222        "[email protected]",
223        "[email protected]",
224        "[email protected]",
225        "[email protected]",
226        "[email protected]",
227        "android.hardware.common-V2-ndk",
228        "android.hardware.common.fmq-V1-ndk",
229        "libFraunhoferAAC",
230        "libbase",
231        "libbluetooth-protos",
232        "libbluetooth-types",
233        "libbluetooth_core_rs",
234        "libbluetooth_crypto_toolbox",
235        "libbluetooth_gd",
236        "libbluetooth_log",
237        "libbt-common", // needed for MessageLoopThread
238        "libbt-jni-thread",
239        "libbt-sbc-decoder",
240        "libbt-sbc-encoder",
241        "libbt-stack",
242        "libbt-stack-core",
243        "libbtcore",
244        "libbtdevice",
245        "libbte",
246        "libbtif",
247        "libbtif-core",
248        "libchrome",
249        "libcom.android.sysprop.bluetooth.wrapped",
250        "libcutils",
251        "libevent",
252        "libg722codec",
253        "libhidlbase",
254        "libjsoncpp",
255        "liblc3",
256        "liblog",
257        "libopus",
258        "libosi",
259        "libprotobuf-cpp-lite",
260        "libstatslog_bt",
261        "libudrv-uipc",
262        "libutils",
263    ],
264    include_dirs: [
265        "packages/modules/Bluetooth/system",
266        "packages/modules/Bluetooth/system/bta/include",
267        "packages/modules/Bluetooth/system/btif",
268        "packages/modules/Bluetooth/system/gd",
269        "packages/modules/Bluetooth/system/stack/include",
270    ],
271}
272
273// Bluetooth Audio client interface library unit tests
274cc_test {
275    name: "bluetooth-test-audio-hal-aidl-leaudio-utils",
276    host_supported: true,
277    defaults: [
278        "fluoride_defaults",
279        "latest_android_hardware_audio_common_ndk_static",
280        "latest_android_hardware_bluetooth_audio_ndk_static",
281        "latest_android_media_audio_common_types_ndk_static",
282    ],
283    include_dirs: [
284        "packages/modules/Bluetooth/system",
285        "packages/modules/Bluetooth/system/bta/include",
286        "packages/modules/Bluetooth/system/gd",
287        "packages/modules/Bluetooth/system/stack/include",
288    ],
289    srcs: [
290        "aidl/le_audio_utils.cc",
291        "aidl/le_audio_utils_unittest.cc",
292    ],
293    shared_libs: [
294        "libbase",
295        "libbinder",
296        "libbinder_ndk",
297        "libcutils",
298        "libfmq",
299        "liblog",
300        "libstatslog",
301        "libutils",
302        "server_configurable_flags",
303    ],
304    static_libs: [
305        "android.hardware.common-V2-ndk",
306        "android.hardware.common.fmq-V1-ndk",
307        "bluetooth_flags_c_lib_for_test",
308        "libbluetooth-types",
309        "libbluetooth_log",
310        "libbt-bta",
311        "libbt-common",
312        "libbt-platform-protos-lite",
313        "libchrome",
314        "libevent",
315        "libgmock",
316        "server_configurable_flags",
317    ],
318    cflags: [
319        "-DBUILDCFG",
320    ],
321    header_libs: ["libbluetooth_headers"],
322}
323
324// Bluetooth Audio client interface library unit tests
325cc_test {
326    name: "bluetooth-test-audio-hal-le-audio-software",
327    host_supported: true,
328    defaults: [
329        "libbt_audio_hal_interface_test_defaults",
330    ],
331    include_dirs: [
332        "packages/modules/Bluetooth/system/audio_hal_interface",
333        "packages/modules/Bluetooth/system/bta",
334    ],
335    srcs: [
336        ":TestCommonMockFunctions",
337        ":TestMockAudioHalInterface",
338        ":TestMockCodecManager",
339        ":TestMockOsi",
340        "aidl/le_audio_software_aidl.cc",
341        "aidl/le_audio_utils.cc",
342        "hidl/le_audio_software_hidl.cc",
343        "le_audio_software.cc",
344        "le_audio_software_unittest.cc",
345    ],
346    static_libs: [
347        "bluetooth_flags_c_lib_for_test",
348        "libbt-bta",
349        "libbt-platform-protos-lite",
350        "libcutils",
351        "libgmock",
352        "server_configurable_flags",
353    ],
354    header_libs: ["libbluetooth_headers"],
355    cflags: [
356        "-DBUILDCFG",
357    ],
358}
359
360// HFP client interface library unit tests
361cc_test {
362    name: "bluetooth-test-audio-hal-hfp-client-interface",
363    host_supported: true,
364    defaults: [
365        "libbt_audio_hal_interface_test_defaults",
366    ],
367    include_dirs: [
368        "packages/modules/Bluetooth/system/audio_hal_interface",
369        "packages/modules/Bluetooth/system/audio_hal_interface/aidl",
370        "packages/modules/Bluetooth/system/bta",
371    ],
372    srcs: [
373        "hfp_client_interface.cc",
374        "hfp_client_interface_unittest.cc",
375    ],
376    static_libs: [
377        "server_configurable_flags",
378    ],
379    header_libs: ["libbluetooth_headers"],
380    cflags: [
381        "-DBUILDCFG",
382    ],
383}
384