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