1package {
2    // See: http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // all of the 'license_kinds' from "system_bt_license"
5    // to get the below license kinds:
6    //   SPDX-license-identifier-Apache-2.0
7    default_applicable_licenses: ["system_bt_license"],
8}
9
10cc_defaults {
11    name: "fluoride_bta_defaults",
12    defaults: ["fluoride_defaults"],
13    local_include_dirs: [
14        "dm",
15        "hd",
16        "hh",
17        "include",
18        "sys",
19    ],
20    include_dirs: [
21        "packages/modules/Bluetooth/system",
22        "packages/modules/Bluetooth/system/bta/include",
23        "packages/modules/Bluetooth/system/btif/avrcp",
24        "packages/modules/Bluetooth/system/gd",
25        "packages/modules/Bluetooth/system/stack/btm",
26        "packages/modules/Bluetooth/system/stack/include",
27        "packages/modules/Bluetooth/system/udrv/include",
28    ],
29    header_libs: ["libbluetooth_headers"],
30    generated_headers: [
31        "BluetoothGeneratedDumpsysDataSchema_h",
32    ],
33}
34
35filegroup {
36    name: "BtaDmSources",
37    srcs: [
38        "dm/bta_dm_act.cc",
39        "dm/bta_dm_api.cc",
40        "dm/bta_dm_cfg.cc",
41        "dm/bta_dm_ci.cc",
42        "dm/bta_dm_device_search.cc",
43        "dm/bta_dm_disc.cc",
44        "dm/bta_dm_disc_legacy.cc",
45        "dm/bta_dm_disc_sdp.cc",
46        "dm/bta_dm_gatt_client.cc",
47        "dm/bta_dm_main.cc",
48        "dm/bta_dm_pm.cc",
49        "dm/bta_dm_sec.cc",
50        "dm/bta_dm_sec_api.cc",
51    ],
52}
53
54// BTA static library for target
55cc_library_static {
56    name: "libbt-bta",
57    defaults: ["fluoride_bta_defaults"],
58    srcs: [
59        "ag/bta_ag_act.cc",
60        "ag/bta_ag_api.cc",
61        "ag/bta_ag_at.cc",
62        "ag/bta_ag_cfg.cc",
63        "ag/bta_ag_cmd.cc",
64        "ag/bta_ag_main.cc",
65        "ag/bta_ag_rfc.cc",
66        "ag/bta_ag_sco.cc",
67        "ag/bta_ag_sdp.cc",
68        "ag/bta_ag_swb_aptx.cc",
69        "ar/bta_ar.cc",
70        "av/bta_av_aact.cc",
71        "av/bta_av_act.cc",
72        "av/bta_av_api.cc",
73        "av/bta_av_cfg.cc",
74        "av/bta_av_ci.cc",
75        "av/bta_av_main.cc",
76        "av/bta_av_ssm.cc",
77        "csis/csis_client.cc",
78        "groups/groups.cc",
79        "has/has_client.cc",
80        "has/has_ctp.cc",
81        "has/has_journal.cc",
82        "has/has_preset.cc",
83        "has/has_types.cc",
84        "hd/bta_hd_act.cc",
85        "hd/bta_hd_api.cc",
86        "hd/bta_hd_main.cc",
87        "hearing_aid/hearing_aid.cc",
88        "hearing_aid/hearing_aid_audio_source.cc",
89        "hf_client/bta_hf_client_act.cc",
90        "hf_client/bta_hf_client_api.cc",
91        "hf_client/bta_hf_client_at.cc",
92        "hf_client/bta_hf_client_main.cc",
93        "hf_client/bta_hf_client_rfc.cc",
94        "hf_client/bta_hf_client_sco.cc",
95        "hf_client/bta_hf_client_sdp.cc",
96        "hfp/bta_hfp_api.cc",
97        "hh/bta_hh_act.cc",
98        "hh/bta_hh_api.cc",
99        "hh/bta_hh_cfg.cc",
100        "hh/bta_hh_headtracker.cc",
101        "hh/bta_hh_le.cc",
102        "hh/bta_hh_main.cc",
103        "hh/bta_hh_utils.cc",
104        "le_audio/audio_hal_client/audio_sink_hal_client.cc",
105        "le_audio/audio_hal_client/audio_source_hal_client.cc",
106        "le_audio/broadcaster/broadcast_configuration_provider.cc",
107        "le_audio/broadcaster/broadcaster.cc",
108        "le_audio/broadcaster/broadcaster_types.cc",
109        "le_audio/broadcaster/state_machine.cc",
110        "le_audio/client.cc",
111        "le_audio/client_parser.cc",
112        "le_audio/codec_interface.cc",
113        "le_audio/codec_manager.cc",
114        "le_audio/content_control_id_keeper.cc",
115        "le_audio/device_groups.cc",
116        "le_audio/devices.cc",
117        "le_audio/hal_verifier.cc",
118        "le_audio/le_audio_health_status.cc",
119        "le_audio/le_audio_log_history.cc",
120        "le_audio/le_audio_set_configuration_provider_json.cc",
121        "le_audio/le_audio_types.cc",
122        "le_audio/le_audio_utils.cc",
123        "le_audio/metrics_collector.cc",
124        "le_audio/state_machine.cc",
125        "le_audio/storage_helper.cc",
126        "pan/bta_pan_act.cc",
127        "pan/bta_pan_api.cc",
128        "pan/bta_pan_ci.cc",
129        "pan/bta_pan_main.cc",
130        "ras/ras_client.cc",
131        "ras/ras_server.cc",
132        "ras/ras_utils.cc",
133        "vc/device.cc",
134        "vc/vc.cc",
135    ],
136    cflags: [
137        "-Wno-unused-parameter",
138        /* we export all classes, so change default visibility, instead of having EXPORT_SYMBOL on each class*/
139        "-fvisibility=default",
140    ],
141    static_libs: [
142        "android.hardware.audio.common@5.0",
143        "android.hardware.bluetooth.audio@2.0",
144        "android.hardware.bluetooth.audio@2.1",
145        "avrcp-target-service",
146        "bluetooth_flags_c_lib",
147        "lib-bt-packets",
148        "libbluetooth_crypto_toolbox",
149        "libbluetooth_gd",
150        "libbluetooth_log",
151        "libbt-audio-asrc",
152        "libbt-bta-core",
153        "libbt-platform-protos-lite",
154        "libbt_shim_bridge",
155        "libcom.android.sysprop.bluetooth.wrapped",
156        "liblc3",
157    ],
158    shared_libs: [
159        "libcrypto",
160    ],
161    generated_headers: [
162        "LeAudioSetConfigSchemas_h",
163    ],
164    target: {
165        android: {
166            whole_static_libs: [
167                "libPlatformProperties",
168            ],
169        },
170    },
171    apex_available: [
172        "com.android.btservices",
173    ],
174    host_supported: true,
175    min_sdk_version: "Tiramisu",
176}
177
178cc_library_static {
179    name: "libbt-bta-core",
180    defaults: ["fluoride_bta_defaults"],
181    srcs: [
182        ":BtaDmSources",
183        "gatt/bta_gattc_act.cc",
184        "gatt/bta_gattc_api.cc",
185        "gatt/bta_gattc_cache.cc",
186        "gatt/bta_gattc_db_storage.cc",
187        "gatt/bta_gattc_main.cc",
188        "gatt/bta_gattc_queue.cc",
189        "gatt/bta_gattc_utils.cc",
190        "gatt/bta_gatts_act.cc",
191        "gatt/bta_gatts_api.cc",
192        "gatt/bta_gatts_main.cc",
193        "gatt/bta_gatts_queue.cc",
194        "gatt/bta_gatts_utils.cc",
195        "gatt/database.cc",
196        "gatt/database_builder.cc",
197        "jv/bta_jv_act.cc",
198        "jv/bta_jv_api.cc",
199        "rfcomm/bta_rfcomm_scn.cc",
200        "sdp/bta_sdp.cc",
201        "sdp/bta_sdp_act.cc",
202        "sdp/bta_sdp_api.cc",
203        "sdp/bta_sdp_cfg.cc",
204        "sys/bta_sys_conn.cc",
205        "sys/bta_sys_main.cc",
206        "sys/utl.cc",
207    ],
208    cflags: [
209        "-Wno-unused-parameter",
210        /* we export all classes, so change default visibility, instead of having EXPORT_SYMBOL on each class*/
211        "-fvisibility=default",
212    ],
213    static_libs: [
214        "bluetooth_flags_c_lib",
215        "lib-bt-packets",
216        "libaconfig_storage_read_api_cc",
217        "libbase",
218        "libbluetooth_hci_pdl",
219        "libbluetooth_log",
220        "libbt-audio-hal-interface",
221        "libbt-platform-protos-lite",
222        "libbt_shim_bridge",
223        "libcom.android.sysprop.bluetooth.wrapped",
224        "libflatbuffers-cpp",
225        "server_configurable_flags",
226    ],
227    shared_libs: [
228        "libcrypto",
229    ],
230    apex_available: [
231        "com.android.btservices",
232    ],
233    host_supported: true,
234    min_sdk_version: "Tiramisu",
235}
236
237cc_test {
238    name: "net_test_bta",
239    defaults: [
240        "bluetooth_flatbuffer_bundler_defaults",
241        "fluoride_bta_defaults",
242        "latest_android_hardware_audio_common_ndk_static",
243        "latest_android_hardware_bluetooth_audio_ndk_static",
244        "latest_android_media_audio_common_types_ndk_static",
245        "mts_defaults",
246    ],
247    test_suites: ["general-tests"],
248    host_supported: true,
249    srcs: [
250        ":LegacyStackSdp",
251        ":OsiCompatSources",
252        ":TestCommonMockFunctions",
253        ":TestCommonSyncMainHandler",
254        ":TestFakeOsi",
255        ":TestMockAudioHalInterface",
256        ":TestMockBtif",
257        ":TestMockDevice",
258        ":TestMockMainShim",
259        ":TestMockMainShimEntry",
260        ":TestMockStackA2dp",
261        ":TestMockStackAcl",
262        ":TestMockStackAvct",
263        ":TestMockStackAvdt",
264        ":TestMockStackAvrc",
265        ":TestMockStackBtm",
266        ":TestMockStackGap",
267        ":TestMockStackGatt",
268        ":TestMockStackHid",
269        ":TestMockStackL2cap",
270        ":TestMockStackMetrics",
271        ":TestMockStackPan",
272        ":TestMockStackRfcomm",
273        "test/bta_ag_sco_test.cc",
274        "test/bta_ag_test.cc",
275        "test/bta_api_test.cc",
276        "test/bta_av_test.cc",
277        "test/bta_dip_test.cc",
278        "test/bta_disc_test.cc",
279        "test/bta_dm_cust_uuid_test.cc",
280        "test/bta_dm_test.cc",
281        "test/bta_gatt_test.cc",
282        "test/bta_hf_client_add_record_test.cc",
283        "test/bta_hf_client_test.cc",
284        "test/bta_pan_test.cc",
285        "test/bta_sdp_test.cc",
286        "test/bta_sec_test.cc",
287    ],
288    generated_headers: [
289        "BluetoothGeneratedDumpsysDataSchema_h",
290    ],
291    shared_libs: [
292        "libaconfig_storage_read_api_cc",
293        "libcrypto",
294        "libcutils",
295        "libhidlbase",
296        "liblog",
297        "libutils",
298        "server_configurable_flags",
299    ],
300    static_libs: [
301        "android.hardware.audio.common@5.0",
302        "android.hardware.bluetooth.audio@2.0",
303        "android.hardware.bluetooth.audio@2.1",
304        "android.hardware.common-V2-ndk",
305        "android.hardware.common.fmq-V1-ndk",
306        "bluetooth_flags_c_lib",
307        "libaconfig_storage_read_api_cc",
308        "libbase",
309        "libbluetooth-types",
310        "libbluetooth_crypto_toolbox",
311        "libbluetooth_gd",
312        "libbluetooth_hci_pdl",
313        "libbluetooth_log",
314        "libbt-audio-hal-interface",
315        "libbt-bta",
316        "libbt-bta-core",
317        "libbt-btu-main-thread",
318        "libbt-common",
319        "libbt-platform-protos-lite",
320        "libbt_shim_bridge",
321        "libbt_shim_ffi",
322        "libbtcore",
323        "libbtdevice",
324        "libchrome",
325        "libcom.android.sysprop.bluetooth.wrapped",
326        "libevent",
327        "libflagtest",
328        "libfmq",
329        "libgmock",
330        "server_configurable_flags",
331    ],
332    data: [
333        ":audio_set_configurations_bfbs",
334        ":audio_set_configurations_json",
335        ":audio_set_scenarios_bfbs",
336        ":audio_set_scenarios_json",
337    ],
338    cflags: [
339        "-Wno-macro-redefined",
340        "-Wno-unused-parameter",
341    ],
342    target: {
343        android: {
344            shared_libs: [
345                "libbinder_ndk",
346            ],
347        },
348        host: {
349            static_libs: [
350                "libbinder_ndk",
351            ],
352        },
353    },
354}
355
356// bta GATT unit tests
357cc_test {
358    name: "net_test_bta_gatt",
359    defaults: [
360        "fluoride_bta_defaults",
361        "mts_defaults",
362    ],
363    test_suites: ["general-tests"],
364    srcs: [
365        ":LegacyStackSdp",
366        ":TestCommonMockFunctions",
367        ":TestFakeOsi",
368        ":TestMockBtif",
369        ":TestMockDevice",
370        ":TestMockMainShim",
371        ":TestMockMainShimEntry",
372        ":TestMockStackBtm",
373        ":TestMockStackL2cap",
374        ":TestMockStackMetrics",
375        "test/gatt/database_builder_sample_device_test.cc",
376        "test/gatt/database_builder_test.cc",
377        "test/gatt/database_test.cc",
378    ],
379    generated_headers: [
380        "BluetoothGeneratedDumpsysDataSchema_h",
381    ],
382    shared_libs: [
383        "libaconfig_storage_read_api_cc",
384        "libbase",
385        "libcrypto",
386        "liblog",
387        "server_configurable_flags",
388    ],
389    static_libs: [
390        "bluetooth_flags_c_lib",
391        "libbluetooth-types",
392        "libbluetooth_crypto_toolbox",
393        "libbluetooth_gd",
394        "libbluetooth_hci_pdl",
395        "libbluetooth_log",
396        "libbt-audio-hal-interface",
397        "libbt-bta",
398        "libbt-bta-core",
399        "libbt-common",
400        "libbt-platform-protos-lite",
401        "libbt_shim_bridge",
402        "libbt_shim_ffi",
403        "libbtcore",
404        "libchrome",
405        "libcom.android.sysprop.bluetooth.wrapped",
406        "libgmock",
407    ],
408    cflags: ["-Wno-unused-parameter"],
409}
410
411// bta unit tests for target
412cc_test {
413    name: "net_test_bta_security",
414    defaults: [
415        "fluoride_bta_defaults",
416        "mts_defaults",
417    ],
418    test_suites: ["general-tests"],
419    srcs: [
420        ":TestCommonMockFunctions",
421        ":TestMockBtif",
422        ":TestMockDevice",
423        ":TestMockMainShim",
424        ":TestMockMainShimEntry",
425        ":TestMockStack",
426        "test/bta_hf_client_security_test.cc",
427    ],
428    shared_libs: [
429        "libaconfig_storage_read_api_cc",
430        "libbase",
431        "libcrypto",
432        "libcutils",
433        "liblog",
434        "libprotobuf-cpp-lite",
435        "libstatssocket",
436        "server_configurable_flags",
437    ],
438    static_libs: [
439        "bluetooth_flags_c_lib",
440        "libbluetooth-types",
441        "libbluetooth_crypto_toolbox",
442        "libbluetooth_gd",
443        "libbluetooth_log",
444        "libbt-audio-hal-interface",
445        "libbt-bta",
446        "libbt-bta-core",
447        "libbt-btu-main-thread",
448        "libbt-common",
449        "libbt-platform-protos-lite",
450        "libbt_shim_bridge",
451        "libbt_shim_ffi",
452        "libbtcore",
453        "libchrome",
454        "libgmock",
455        "libosi",
456        "libstatslog_bt",
457    ],
458    cflags: ["-Wno-unused-parameter"],
459}
460
461cc_test {
462    name: "bt_host_test_bta_scn",
463    defaults: [
464        "fluoride_bta_defaults",
465        "mts_defaults",
466    ],
467    test_suites: ["general-tests"],
468    host_supported: true,
469    include_dirs: [
470        "packages/modules/Bluetooth/system",
471        "packages/modules/Bluetooth/system/gd",
472    ],
473    generated_headers: [
474        "BluetoothGeneratedDumpsysDataSchema_h",
475    ],
476    srcs: [
477        ":BluetoothLogRedactionSources",
478        ":TestCommonMockFunctions",
479        ":TestFakeOsi",
480        ":TestMockBtaSys",
481        ":TestMockBtif",
482        ":TestMockStackBtm",
483        ":TestMockStackGap",
484        ":TestMockStackL2cap",
485        ":TestMockStackRfcomm",
486        ":TestMockStackSdp",
487        "jv/bta_jv_act.cc",
488        "rfcomm/bta_rfcomm_scn.cc",
489        "test/bta_rfcomm_scn_test.cc",
490    ],
491    shared_libs: [
492        "libaconfig_storage_read_api_cc",
493        "libbase",
494        "libcrypto",
495        "libcutils",
496        "liblog",
497        "server_configurable_flags",
498    ],
499    static_libs: [
500        "bluetooth_flags_c_lib",
501        "libbluetooth-types",
502        "libbluetooth_log",
503        "libbt-common",
504        "libbt-platform-protos-lite",
505        "libbt_shim_bridge",
506        "libbt_shim_ffi",
507        "libbtcore",
508        "libbtdevice",
509        "libchrome",
510        "libcom.android.sysprop.bluetooth.wrapped",
511        "libevent",
512        "libgmock",
513    ],
514    sanitize: {
515        address: true,
516        cfi: true,
517        misc_undefined: ["bounds"],
518    },
519    target: {
520        android: {
521            static_libs: [
522                "libPlatformProperties",
523            ],
524        },
525    },
526    cflags: ["-Wno-unused-parameter"],
527}
528
529// csis unit tests for host
530cc_test {
531    name: "bluetooth_csis_test",
532    test_suites: ["general-tests"],
533    defaults: [
534        "fluoride_bta_defaults",
535        "mts_defaults",
536    ],
537    host_supported: true,
538    include_dirs: [
539        "packages/modules/Bluetooth/system",
540        "packages/modules/Bluetooth/system/bta/groups",
541        "packages/modules/Bluetooth/system/bta/include",
542        "packages/modules/Bluetooth/system/bta/test/common",
543        "packages/modules/Bluetooth/system/osi/include",
544    ],
545    srcs: [
546        ":TestCommonMockFunctions",
547        ":TestMockBtif",
548        ":TestMockMainShimLeScanning",
549        ":TestMockStackBtmInterface",
550        "csis/csis_client.cc",
551        "csis/csis_client_test.cc",
552        "gatt/database.cc",
553        "gatt/database_builder.cc",
554        "groups/groups.cc",
555        "test/common/bta_dm_api_mock.cc",
556        "test/common/bta_gatt_api_mock.cc",
557        "test/common/bta_gatt_queue_mock.cc",
558        "test/common/btm_api_mock.cc",
559    ],
560    shared_libs: [
561        "libaconfig_storage_read_api_cc",
562        "libbase",
563        "libcrypto",
564        "liblog",
565        "server_configurable_flags",
566    ],
567    static_libs: [
568        "libbluetooth-types",
569        "libbluetooth_crypto_toolbox",
570        "libbluetooth_gd",
571        "libbluetooth_log",
572        "libbt-common",
573        "libbt_shim_bridge",
574        "libbt_shim_ffi",
575        "libchrome",
576        "libcutils",
577        "libgmock",
578        "libosi",
579    ],
580    sanitize: {
581        cfi: true,
582        scs: true,
583        address: true,
584        all_undefined: true,
585        integer_overflow: true,
586        diag: {
587            undefined: true,
588        },
589    },
590    cflags: ["-Wno-unused-parameter"],
591}
592
593// groups unit tests for host
594cc_test {
595    name: "bluetooth_groups_test",
596    test_suites: ["general-tests"],
597    defaults: [
598        "fluoride_bta_defaults",
599        "mts_defaults",
600    ],
601    host_supported: true,
602    include_dirs: [
603        "packages/modules/Bluetooth/system",
604        "packages/modules/Bluetooth/system/bta/include",
605    ],
606    srcs: [
607        ":TestCommonMockFunctions",
608        ":TestMockBtif",
609        "groups/groups.cc",
610        "groups/groups_test.cc",
611    ],
612    shared_libs: [
613        "libbase",
614        "libcrypto",
615        "liblog",
616    ],
617    static_libs: [
618        "libbluetooth-types",
619        "libbluetooth_crypto_toolbox",
620        "libbluetooth_gd",
621        "libbluetooth_log",
622        "libbt-common",
623        "libbt_shim_bridge",
624        "libbt_shim_ffi",
625        "libchrome",
626        "libgmock",
627        "libosi",
628    ],
629    sanitize: {
630        cfi: true,
631        scs: true,
632        address: true,
633        all_undefined: true,
634        integer_overflow: true,
635        diag: {
636            undefined: true,
637        },
638    },
639    cflags: ["-Wno-unused-parameter"],
640}
641
642// bta unit tests for host
643cc_test {
644    name: "bluetooth_vc_test",
645    test_suites: ["general-tests"],
646    defaults: [
647        "fluoride_bta_defaults",
648        "mts_defaults",
649    ],
650    host_supported: true,
651    include_dirs: [
652        "packages/modules/Bluetooth/system",
653        "packages/modules/Bluetooth/system/bta/include",
654        "packages/modules/Bluetooth/system/bta/test/common",
655        "packages/modules/Bluetooth/system/gd",
656        "packages/modules/Bluetooth/system/stack/include",
657    ],
658    srcs: [
659        ":TestCommonMockFunctions",
660        ":TestStubOsi",
661        "gatt/database.cc",
662        "gatt/database_builder.cc",
663        "test/common/bta_gatt_api_mock.cc",
664        "test/common/bta_gatt_queue_mock.cc",
665        "test/common/btm_api_mock.cc",
666        "test/common/mock_csis_client.cc",
667        "vc/device.cc",
668        "vc/devices_test.cc",
669        "vc/vc.cc",
670        "vc/vc_test.cc",
671    ],
672    shared_libs: [
673        "libbase",
674        "libcrypto",
675        "liblog",
676    ],
677    static_libs: [
678        "libbluetooth-types",
679        "libbluetooth_crypto_toolbox",
680        "libbluetooth_gd",
681        "libbluetooth_log",
682        "libbt-common",
683        "libbt-platform-protos-lite",
684        "libbt_shim_bridge",
685        "libbt_shim_ffi",
686        "libchrome",
687        "libgmock",
688        "libosi",
689    ],
690    sanitize: {
691        cfi: false,
692    },
693    cflags: ["-Wno-unused-parameter"],
694}
695
696genrule {
697    name: "LeAudioSetConfigSchemas_h",
698    tools: [
699        "flatc",
700    ],
701    cmd: "$(location flatc) -I packages/modules/Bluetooth/system/ -o $(genDir) --cpp $(in) ",
702    srcs: [
703        "le_audio/audio_set_configurations.fbs",
704        "le_audio/audio_set_scenarios.fbs",
705    ],
706    out: [
707        "audio_set_configurations_generated.h",
708        "audio_set_scenarios_generated.h",
709    ],
710}
711
712genrule {
713    name: "LeAudioSetScenariosSchema_bfbs",
714    tools: [
715        "flatc",
716    ],
717    cmd: "$(location flatc) -I packages/modules/Bluetooth/system/ -b --schema -o $(genDir) $(in) ",
718    srcs: [
719        "le_audio/audio_set_scenarios.fbs",
720    ],
721    out: [
722        "audio_set_scenarios.bfbs",
723    ],
724}
725
726genrule {
727    name: "LeAudioSetConfigsSchema_bfbs",
728    tools: [
729        "flatc",
730    ],
731    cmd: "$(location flatc) -I packages/modules/Bluetooth/system/ -b --schema -o $(genDir) $(in) ",
732    srcs: [
733        "le_audio/audio_set_configurations.fbs",
734    ],
735    out: [
736        "audio_set_configurations.bfbs",
737    ],
738}
739
740prebuilt_etc {
741    name: "audio_set_scenarios_bfbs",
742    src: ":LeAudioSetScenariosSchema_bfbs",
743    filename: "audio_set_scenarios.bfbs",
744    sub_dir: "bluetooth/le_audio",
745}
746
747prebuilt_etc {
748    name: "audio_set_scenarios_json",
749    src: "le_audio/audio_set_scenarios.json",
750    filename_from_src: true,
751    sub_dir: "bluetooth/le_audio",
752}
753
754prebuilt_etc {
755    name: "audio_set_configurations_bfbs",
756    src: ":LeAudioSetConfigsSchema_bfbs",
757    filename: "audio_set_configurations.bfbs",
758    sub_dir: "bluetooth/le_audio",
759}
760
761prebuilt_etc {
762    name: "audio_set_configurations_json",
763    src: "le_audio/audio_set_configurations.json",
764    filename_from_src: true,
765    sub_dir: "bluetooth/le_audio",
766}
767
768// bta unit tests for LE Audio
769// ========================================================
770cc_test {
771    name: "bluetooth_le_audio_codec_manager_test",
772    test_suites: ["general-tests"],
773    defaults: [
774        "bluetooth_flatbuffer_bundler_defaults",
775        "fluoride_defaults",
776        "mts_defaults",
777    ],
778    host_supported: true,
779    target: {
780        darwin: {
781            enabled: false,
782        },
783        android: {
784            sanitize: {
785                misc_undefined: ["bounds"],
786            },
787            static_libs: [
788                "libPlatformProperties",
789            ],
790        },
791    },
792    include_dirs: [
793        "packages/modules/Bluetooth/system",
794        "packages/modules/Bluetooth/system/bta/include",
795        "packages/modules/Bluetooth/system/bta/test/common",
796        "packages/modules/Bluetooth/system/gd",
797        "packages/modules/Bluetooth/system/stack/include",
798    ],
799    srcs: [
800        ":TestCommonMockFunctions",
801        ":TestMockBtaLeAudioHalVerifier",
802        ":TestMockLegacyHciInterface",
803        ":TestMockMainShim",
804        ":TestMockMainShimEntry",
805        ":TestStubOsi",
806        "le_audio/broadcaster/broadcast_configuration_provider.cc",
807        "le_audio/broadcaster/broadcaster_types.cc",
808        "le_audio/codec_manager.cc",
809        "le_audio/codec_manager_test.cc",
810        "le_audio/le_audio_set_configuration_provider_json.cc",
811        "le_audio/le_audio_types.cc",
812        "le_audio/le_audio_utils.cc",
813    ],
814    data: [
815        ":audio_set_configurations_bfbs",
816        ":audio_set_configurations_json",
817        ":audio_set_scenarios_bfbs",
818        ":audio_set_scenarios_json",
819    ],
820    generated_headers: [
821        "BluetoothGeneratedDumpsysDataSchema_h",
822        "LeAudioSetConfigSchemas_h",
823    ],
824    shared_libs: [
825        "libbase",
826        "libcrypto",
827        "libhidlbase",
828        "liblog", // __android_log_print
829    ],
830    static_libs: [
831        "libbluetooth-types",
832        "libbluetooth_crypto_toolbox",
833        "libbluetooth_gd",
834        "libbluetooth_log",
835        "libbt-audio-hal-interface",
836        "libbt-common",
837        "libbt-platform-protos-lite",
838        "libbt_shim_bridge",
839        "libbt_shim_ffi",
840        "libchrome",
841        "libevent",
842        "libflatbuffers-cpp",
843        "libgmock",
844        "libosi",
845    ],
846    sanitize: {
847        cfi: false,
848    },
849    header_libs: ["libbluetooth_headers"],
850    cflags: ["-Wno-unused-parameter"],
851}
852
853cc_test {
854    name: "bluetooth_le_audio_test",
855    test_suites: ["general-tests"],
856    defaults: [
857        "bluetooth_flatbuffer_bundler_defaults",
858        "fluoride_defaults",
859        "mts_defaults",
860    ],
861    host_supported: true,
862    target: {
863        darwin: {
864            enabled: false,
865        },
866        android: {
867            sanitize: {
868                misc_undefined: ["bounds"],
869            },
870            static_libs: [
871                "libPlatformProperties",
872            ],
873        },
874    },
875    include_dirs: [
876        "packages/modules/Bluetooth/system",
877        "packages/modules/Bluetooth/system/bta/include",
878        "packages/modules/Bluetooth/system/bta/test/common",
879        "packages/modules/Bluetooth/system/gd",
880        "packages/modules/Bluetooth/system/stack/include",
881    ],
882    srcs: [
883        ":TestCommonMockFunctions",
884        ":TestMockBtaLeAudioHalVerifier",
885        ":TestMockMainShim",
886        ":TestMockMainShimEntry",
887        ":TestMockStackBtmInterface",
888        ":TestMockStackBtmIso",
889        ":TestMockStackL2cap",
890        ":TestStubOsi",
891        "le_audio/audio_hal_client/audio_hal_client_test.cc",
892        "le_audio/audio_hal_client/audio_sink_hal_client.cc",
893        "le_audio/audio_hal_client/audio_source_hal_client.cc",
894        "le_audio/broadcaster/broadcast_configuration_provider.cc",
895        "le_audio/broadcaster/broadcaster_types.cc",
896        "le_audio/client_parser.cc",
897        "le_audio/client_parser_test.cc",
898        "le_audio/content_control_id_keeper.cc",
899        "le_audio/content_control_id_keeper_test.cc",
900        "le_audio/device_groups.cc",
901        "le_audio/devices.cc",
902        "le_audio/devices_test.cc",
903        "le_audio/le_audio_health_status.cc",
904        "le_audio/le_audio_log_history.cc",
905        "le_audio/le_audio_set_configuration_provider_json.cc",
906        "le_audio/le_audio_types.cc",
907        "le_audio/le_audio_types_test.cc",
908        "le_audio/le_audio_utils.cc",
909        "le_audio/metrics_collector_linux.cc",
910        "le_audio/mock_codec_interface.cc",
911        "le_audio/mock_codec_manager.cc",
912        "le_audio/state_machine.cc",
913        "le_audio/state_machine_test.cc",
914        "le_audio/storage_helper.cc",
915        "le_audio/storage_helper_test.cc",
916        "test/common/bta_gatt_api_mock.cc",
917        "test/common/bta_gatt_queue_mock.cc",
918        "test/common/btif_storage_mock.cc",
919        "test/common/btm_api_mock.cc",
920        "test/common/mock_csis_client.cc",
921    ],
922    data: [
923        ":audio_set_configurations_bfbs",
924        ":audio_set_configurations_json",
925        ":audio_set_scenarios_bfbs",
926        ":audio_set_scenarios_json",
927    ],
928    generated_headers: [
929        "BluetoothGeneratedDumpsysDataSchema_h",
930        "LeAudioSetConfigSchemas_h",
931    ],
932    shared_libs: [
933        "libaconfig_storage_read_api_cc",
934        "libbase",
935        "libcrypto",
936        "libhidlbase",
937        "liblog", // __android_log_print
938        "server_configurable_flags",
939    ],
940    static_libs: [
941        "libbluetooth-types",
942        "libbluetooth_crypto_toolbox",
943        "libbluetooth_gd",
944        "libbluetooth_log",
945        "libbt-audio-asrc",
946        "libbt-common",
947        "libbt-platform-protos-lite",
948        "libbt_shim_bridge",
949        "libbt_shim_ffi",
950        "libchrome",
951        "libevent",
952        "libflatbuffers-cpp",
953        "libgmock",
954        "libgtest",
955        "libosi",
956    ],
957    sanitize: {
958        cfi: false,
959    },
960    header_libs: ["libbluetooth_headers"],
961    cflags: ["-Wno-unused-parameter"],
962}
963
964cc_test {
965    name: "bluetooth_le_audio_client_test",
966    test_suites: ["general-tests"],
967    defaults: [
968        "bluetooth_flatbuffer_bundler_defaults",
969        "fluoride_bta_defaults",
970        "mts_defaults",
971    ],
972    host_supported: true,
973    // TODO(b/231993739): Reenable isolated:true by deleting the explicit disable below
974    isolated: false,
975    include_dirs: [
976        "packages/modules/Bluetooth/system",
977        "packages/modules/Bluetooth/system/bta/include",
978        "packages/modules/Bluetooth/system/bta/test/common",
979        "packages/modules/Bluetooth/system/stack/include",
980    ],
981    srcs: [
982        ":TestCommonMockFunctions",
983        ":TestMockBtaLeAudioHalVerifier",
984        ":TestMockMainShim",
985        ":TestMockMainShimEntry",
986        ":TestMockStackBtmInterface",
987        ":TestMockStackBtmIso",
988        ":TestMockStackL2cap",
989        ":TestStubOsi",
990        "gatt/database.cc",
991        "gatt/database_builder.cc",
992        "le_audio/broadcaster/broadcast_configuration_provider.cc",
993        "le_audio/broadcaster/broadcaster_types.cc",
994        "le_audio/client.cc",
995        "le_audio/client_parser.cc",
996        "le_audio/content_control_id_keeper.cc",
997        "le_audio/device_groups.cc",
998        "le_audio/devices.cc",
999        "le_audio/le_audio_client_test.cc",
1000        "le_audio/le_audio_health_status.cc",
1001        "le_audio/le_audio_health_status_test.cc",
1002        "le_audio/le_audio_log_history.cc",
1003        "le_audio/le_audio_set_configuration_provider_json.cc",
1004        "le_audio/le_audio_types.cc",
1005        "le_audio/le_audio_utils.cc",
1006        "le_audio/metrics_collector.cc",
1007        "le_audio/metrics_collector_test.cc",
1008        "le_audio/mock_codec_interface.cc",
1009        "le_audio/mock_codec_manager.cc",
1010        "le_audio/mock_state_machine.cc",
1011        "le_audio/storage_helper.cc",
1012        "test/common/bta_gatt_api_mock.cc",
1013        "test/common/bta_gatt_queue_mock.cc",
1014        "test/common/btif_storage_mock.cc",
1015        "test/common/btm_api_mock.cc",
1016        "test/common/mock_csis_client.cc",
1017        "test/common/mock_device_groups.cc",
1018    ],
1019    shared_libs: [
1020        "libaconfig_storage_read_api_cc",
1021        "libbase",
1022        "libcrypto",
1023        "libhidlbase",
1024        "liblog",
1025        "server_configurable_flags",
1026    ],
1027    static_libs: [
1028        "libbluetooth-types",
1029        "libbluetooth_crypto_toolbox",
1030        "libbluetooth_gd",
1031        "libbluetooth_log",
1032        "libbt-audio-hal-interface",
1033        "libbt-common",
1034        "libbt-platform-protos-lite",
1035        "libbt_shim_bridge",
1036        "libbt_shim_ffi",
1037        "libchrome",
1038        "libevent",
1039        "libflagtest",
1040        "libflatbuffers-cpp",
1041        "libgmock",
1042        "libgtest",
1043        "liblc3",
1044        "libosi",
1045    ],
1046    data: [
1047        ":audio_set_configurations_bfbs",
1048        ":audio_set_configurations_json",
1049        ":audio_set_scenarios_bfbs",
1050        ":audio_set_scenarios_json",
1051    ],
1052    generated_headers: [
1053        "LeAudioSetConfigSchemas_h",
1054    ],
1055    target: {
1056        android: {
1057            shared_libs: [
1058                "libbinder_ndk",
1059            ],
1060            static_libs: [
1061                "libPlatformProperties",
1062            ],
1063        },
1064        host: {
1065            static_libs: [
1066                "libbinder_ndk",
1067            ],
1068        },
1069    },
1070    sanitize: {
1071        cfi: true,
1072        scs: true,
1073        address: true,
1074        all_undefined: true,
1075        integer_overflow: true,
1076        diag: {
1077            undefined: true,
1078        },
1079    },
1080    cflags: ["-Wno-unused-parameter"],
1081}
1082
1083cc_test {
1084    name: "bluetooth_test_broadcaster_state_machine",
1085    test_suites: ["general-tests"],
1086    defaults: [
1087        "fluoride_bta_defaults",
1088        "mts_defaults",
1089    ],
1090    host_supported: true,
1091    // TODO(b/231993739): Reenable isolated:true by deleting the explicit disable below
1092    isolated: false,
1093    include_dirs: [
1094        "packages/modules/Bluetooth/system",
1095        "packages/modules/Bluetooth/system/bta/include",
1096        "packages/modules/Bluetooth/system/bta/le_audio",
1097        "packages/modules/Bluetooth/system/stack/btm",
1098        "packages/modules/Bluetooth/system/stack/include",
1099    ],
1100    srcs: [
1101        ":TestCommonMockFunctions",
1102        ":TestCommonStackConfig",
1103        ":TestMockMainShim",
1104        ":TestMockStackBtmIso",
1105        "le_audio/broadcaster/broadcast_configuration_provider.cc",
1106        "le_audio/broadcaster/broadcaster_types.cc",
1107        "le_audio/broadcaster/state_machine.cc",
1108        "le_audio/broadcaster/state_machine_test.cc",
1109        "le_audio/le_audio_types.cc",
1110        "le_audio/le_audio_utils.cc",
1111        "le_audio/mock_codec_interface.cc",
1112        "le_audio/mock_codec_manager.cc",
1113    ],
1114    shared_libs: [
1115        "libbase",
1116        "libcrypto",
1117        "liblog",
1118    ],
1119    static_libs: [
1120        "libbluetooth-types",
1121        "libbluetooth_crypto_toolbox",
1122        "libbluetooth_gd",
1123        "libbluetooth_log",
1124        "libbt-common",
1125        "libbt-platform-protos-lite",
1126        "libbt_shim_bridge",
1127        "libbt_shim_ffi",
1128        "libchrome",
1129        "libflatbuffers-cpp",
1130        "libgmock",
1131        "libgtest",
1132        "liblc3",
1133        "libosi",
1134    ],
1135    sanitize: {
1136        cfi: true,
1137        scs: true,
1138        address: true,
1139        all_undefined: true,
1140        integer_overflow: true,
1141        diag: {
1142            undefined: true,
1143        },
1144    },
1145    cflags: ["-Wno-unused-parameter"],
1146}
1147
1148cc_test {
1149    name: "bluetooth_test_broadcaster",
1150    test_suites: ["general-tests"],
1151    defaults: [
1152        "bluetooth_flatbuffer_bundler_defaults",
1153        "fluoride_bta_defaults",
1154        "mts_defaults",
1155    ],
1156    host_supported: true,
1157    include_dirs: [
1158        "packages/modules/Bluetooth/system",
1159        "packages/modules/Bluetooth/system/bta/include",
1160        "packages/modules/Bluetooth/system/bta/le_audio",
1161        "packages/modules/Bluetooth/system/bta/test/common",
1162        "packages/modules/Bluetooth/system/stack/btm",
1163        "packages/modules/Bluetooth/system/stack/include",
1164    ],
1165    srcs: [
1166        ":TestCommonMockFunctions",
1167        ":TestCommonStackConfig",
1168        ":TestMockMainShim",
1169        ":TestMockMainShimEntry",
1170        ":TestMockStackBtmIso",
1171        ":TestStubOsi",
1172        "le_audio/broadcaster/broadcaster.cc",
1173        "le_audio/broadcaster/broadcaster_test.cc",
1174        "le_audio/broadcaster/broadcaster_types.cc",
1175        "le_audio/broadcaster/mock_state_machine.cc",
1176        "le_audio/content_control_id_keeper.cc",
1177        "le_audio/le_audio_types.cc",
1178        "le_audio/le_audio_utils.cc",
1179        "le_audio/metrics_collector_linux.cc",
1180        "le_audio/mock_codec_interface.cc",
1181        "le_audio/mock_codec_manager.cc",
1182    ],
1183    shared_libs: [
1184        "libbase",
1185        "libbinder_ndk",
1186        "libcrypto",
1187        "libfmq",
1188        "libhidlbase",
1189        "liblog",
1190    ],
1191    static_libs: [
1192        "libbluetooth-types",
1193        "libbluetooth_gd",
1194        "libbluetooth_hci_pdl",
1195        "libbluetooth_log",
1196        "libbt-audio-hal-interface",
1197        "libbt-common",
1198        "libbt-platform-protos-lite",
1199        "libbt_shim_bridge",
1200        "libbt_shim_ffi",
1201        "libchrome",
1202        "libevent",
1203        "libflatbuffers-cpp",
1204        "libgmock",
1205        "libgtest",
1206        "liblc3",
1207        "libosi",
1208    ],
1209    sanitize: {
1210        cfi: true,
1211        scs: true,
1212        address: true,
1213        all_undefined: true,
1214        integer_overflow: true,
1215        diag: {
1216            undefined: true,
1217        },
1218    },
1219    cflags: ["-Wno-unused-parameter"],
1220}
1221
1222cc_test {
1223    name: "bluetooth_has_test",
1224    test_suites: ["general-tests"],
1225    defaults: [
1226        "fluoride_bta_defaults",
1227        "mts_defaults",
1228    ],
1229    host_supported: true,
1230    // TODO(b/231993739): Reenable isolated:true by deleting the explicit disable below
1231    isolated: false,
1232    include_dirs: [
1233        "packages/modules/Bluetooth/system",
1234        "packages/modules/Bluetooth/system/bta/include",
1235        "packages/modules/Bluetooth/system/bta/test/common",
1236        "packages/modules/Bluetooth/system/stack/include",
1237    ],
1238    srcs: [
1239        ":TestCommonMockFunctions",
1240        ":TestStubOsi",
1241        "gatt/database.cc",
1242        "gatt/database_builder.cc",
1243        "has/has_client.cc",
1244        "has/has_client_test.cc",
1245        "has/has_ctp.cc",
1246        "has/has_journal.cc",
1247        "has/has_preset.cc",
1248        "has/has_types.cc",
1249        "test/common/bta_gatt_api_mock.cc",
1250        "test/common/bta_gatt_queue_mock.cc",
1251        "test/common/btif_storage_mock.cc",
1252        "test/common/btm_api_mock.cc",
1253        "test/common/mock_csis_client.cc",
1254    ],
1255    shared_libs: [
1256        "libbase",
1257        "libcrypto",
1258        "liblog",
1259    ],
1260    static_libs: [
1261        "libbluetooth-types",
1262        "libbluetooth_crypto_toolbox",
1263        "libbluetooth_gd",
1264        "libbluetooth_log",
1265        "libbt-common",
1266        "libbt_shim_bridge",
1267        "libbt_shim_ffi",
1268        "libchrome",
1269        "libgmock",
1270    ],
1271    sanitize: {
1272        cfi: true,
1273        scs: true,
1274        address: true,
1275        all_undefined: true,
1276        integer_overflow: true,
1277        diag: {
1278            undefined: true,
1279        },
1280    },
1281    cflags: ["-Wno-unused-parameter"],
1282}
1283
1284cc_test {
1285    name: "bluetooth_hh_test",
1286    test_suites: ["general-tests"],
1287    defaults: [
1288        "fluoride_bta_defaults",
1289        "mts_defaults",
1290    ],
1291    host_supported: true,
1292    // TODO(b/231993739): Reenable isolated:true by deleting the explicit disable below
1293    isolated: false,
1294    include_dirs: [
1295        "packages/modules/Bluetooth/system",
1296        "packages/modules/Bluetooth/system/bta/include",
1297        "packages/modules/Bluetooth/system/bta/test/common",
1298        "packages/modules/Bluetooth/system/stack/include",
1299    ],
1300    srcs: [
1301        ":BtaDmSources",
1302        ":TestCommonMainHandler",
1303        ":TestCommonMockFunctions",
1304        ":TestMockBtaGatt",
1305        ":TestMockBtaLeAudio",
1306        ":TestMockBtaSdp",
1307        ":TestMockBtaSys",
1308        ":TestMockBtif",
1309        ":TestMockDevice",
1310        ":TestMockMainShim",
1311        ":TestMockMainShimEntry",
1312        ":TestMockOsi",
1313        ":TestMockStack",
1314        "gatt/bta_gattc_queue.cc",
1315        "hh/bta_hh_act.cc",
1316        "hh/bta_hh_api.cc",
1317        "hh/bta_hh_cfg.cc",
1318        "hh/bta_hh_headtracker.cc",
1319        "hh/bta_hh_le.cc",
1320        "hh/bta_hh_main.cc",
1321        "hh/bta_hh_utils.cc",
1322        "test/bta_hh_test.cc",
1323    ],
1324    shared_libs: [
1325        "libaconfig_storage_read_api_cc",
1326        "libbase",
1327        "libcrypto",
1328        "liblog",
1329        "server_configurable_flags",
1330    ],
1331    static_libs: [
1332        "libbluetooth-types",
1333        "libbluetooth_crypto_toolbox",
1334        "libbluetooth_gd",
1335        "libbluetooth_hci_pdl",
1336        "libbluetooth_log",
1337        "libbt-common",
1338        "libbt-platform-protos-lite",
1339        "libbt_shim_bridge",
1340        "libbt_shim_ffi",
1341        "libchrome",
1342        "libcom.android.sysprop.bluetooth.wrapped",
1343        "libevent",
1344        "libgmock",
1345        "libosi",
1346    ],
1347    generated_headers: [
1348        "BluetoothGeneratedDumpsysDataSchema_h",
1349    ],
1350    sanitize: {
1351        cfi: true,
1352        scs: true,
1353        address: true,
1354        all_undefined: true,
1355        integer_overflow: true,
1356        diag: {
1357            undefined: true,
1358        },
1359    },
1360    cflags: ["-Wno-unused-parameter"],
1361}
1362
1363cc_test {
1364    name: "net_test_bta_jv",
1365    test_suites: ["general-tests"],
1366    defaults: [
1367        "fluoride_bta_defaults",
1368        "mts_defaults",
1369    ],
1370    host_supported: true,
1371    isolated: false,
1372    include_dirs: [
1373        "packages/modules/Bluetooth/system",
1374        "packages/modules/Bluetooth/system/bta/include",
1375        "packages/modules/Bluetooth/system/bta/test/common",
1376        "packages/modules/Bluetooth/system/stack/include",
1377    ],
1378    srcs: [
1379        ":BtaDmSources",
1380        ":TestCommonMainHandler",
1381        ":TestCommonMockFunctions",
1382        ":TestFakeOsi",
1383        ":TestMockBtaGatt",
1384        ":TestMockBtaLeAudio",
1385        ":TestMockBtaScn",
1386        ":TestMockBtaSdp",
1387        ":TestMockBtaSys",
1388        ":TestMockBtif",
1389        ":TestMockDevice",
1390        ":TestMockMainShim",
1391        ":TestMockMainShimEntry",
1392        ":TestMockStack",
1393        "jv/bta_jv_act.cc",
1394        "test/bta_jv_test.cc",
1395    ],
1396    shared_libs: [
1397        "libaconfig_storage_read_api_cc",
1398        "libbase",
1399        "libcrypto",
1400        "liblog",
1401        "server_configurable_flags",
1402    ],
1403    static_libs: [
1404        "libbluetooth-types",
1405        "libbluetooth_crypto_toolbox",
1406        "libbluetooth_gd",
1407        "libbluetooth_hci_pdl",
1408        "libbluetooth_log",
1409        "libbt-common",
1410        "libbt-platform-protos-lite",
1411        "libbt_shim_bridge",
1412        "libbt_shim_ffi",
1413        "libchrome",
1414        "libcom.android.sysprop.bluetooth.wrapped",
1415        "libevent",
1416        "libgmock",
1417        "libosi",
1418    ],
1419    generated_headers: [
1420        "BluetoothGeneratedDumpsysDataSchema_h",
1421    ],
1422    sanitize: {
1423        cfi: true,
1424        scs: true,
1425        address: true,
1426        all_undefined: true,
1427        integer_overflow: true,
1428        diag: {
1429            undefined: true,
1430        },
1431    },
1432}
1433