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    //   SPDX-license-identifier-BSD
8    default_applicable_licenses: ["system_bt_license"],
9}
10
11cc_library_static {
12    name: "libbt-btu-main-thread",
13    defaults: ["fluoride_defaults"],
14    srcs: ["btu/main_thread.cc"],
15    include_dirs: [
16        "packages/modules/Bluetooth/system",
17        "packages/modules/Bluetooth/system/gd",
18        "packages/modules/Bluetooth/system/include",
19        "packages/modules/Bluetooth/system/stack/include",
20        "packages/modules/Bluetooth/system/types",
21    ],
22    static_libs: [
23        "libbluetooth_log",
24        "libbt_shim_bridge",
25    ],
26    shared_libs: [
27        "libchrome",
28    ],
29    apex_available: [
30        "com.android.btservices",
31    ],
32    host_supported: true,
33    min_sdk_version: "Tiramisu",
34}
35
36// Bluetooth stack static library for target
37cc_library_static {
38    name: "libbt-stack",
39    defaults: ["fluoride_defaults"],
40    local_include_dirs: [
41        "avct",
42        "avdt",
43        "avrc",
44        "bnep",
45        "btm",
46        "eatt",
47        "gap",
48        "gatt",
49        "hid",
50        "include",
51        "l2cap",
52        "metrics",
53        "pan",
54        "sdp",
55        "smp",
56        "srvc",
57    ],
58    header_libs: [
59        "libbluetooth_headers",
60    ],
61    include_dirs: [
62        "external/aac/libAACdec/include",
63        "external/aac/libAACenc/include",
64        "external/aac/libSYS/include",
65        "external/libldac/abr/inc",
66        "external/libldac/inc",
67        "external/libopus/include",
68        "packages/modules/Bluetooth/system",
69        "packages/modules/Bluetooth/system/bta/include",
70        "packages/modules/Bluetooth/system/bta/sys",
71        "packages/modules/Bluetooth/system/btif/include",
72        "packages/modules/Bluetooth/system/device/include",
73        "packages/modules/Bluetooth/system/gd",
74        "packages/modules/Bluetooth/system/gd/hal",
75        "packages/modules/Bluetooth/system/udrv/include",
76    ],
77    generated_headers: [
78        "BluetoothGeneratedDumpsysDataSchema_h",
79    ],
80    srcs: [
81        "a2dp/a2dp_aac.cc",
82        "a2dp/a2dp_aac_decoder.cc",
83        "a2dp/a2dp_aac_encoder.cc",
84        "a2dp/a2dp_api.cc",
85        "a2dp/a2dp_codec_config.cc",
86        "a2dp/a2dp_ext.cc",
87        "a2dp/a2dp_sbc.cc",
88        "a2dp/a2dp_sbc_decoder.cc",
89        "a2dp/a2dp_sbc_encoder.cc",
90        "a2dp/a2dp_sbc_up_sample.cc",
91        "a2dp/a2dp_vendor.cc",
92        "a2dp/a2dp_vendor_aptx.cc",
93        "a2dp/a2dp_vendor_aptx_encoder.cc",
94        "a2dp/a2dp_vendor_aptx_hd.cc",
95        "a2dp/a2dp_vendor_aptx_hd_encoder.cc",
96        "a2dp/a2dp_vendor_ldac.cc",
97        "a2dp/a2dp_vendor_ldac_decoder.cc",
98        "a2dp/a2dp_vendor_ldac_encoder.cc",
99        "a2dp/a2dp_vendor_opus.cc",
100        "a2dp/a2dp_vendor_opus_decoder.cc",
101        "a2dp/a2dp_vendor_opus_encoder.cc",
102        "avct/avct_api.cc",
103        "avct/avct_bcb_act.cc",
104        "avct/avct_ccb.cc",
105        "avct/avct_l2c.cc",
106        "avct/avct_l2c_br.cc",
107        "avct/avct_lcb.cc",
108        "avct/avct_lcb_act.cc",
109        "avdt/avdt_ad.cc",
110        "avdt/avdt_api.cc",
111        "avdt/avdt_ccb.cc",
112        "avdt/avdt_ccb_act.cc",
113        "avdt/avdt_l2c.cc",
114        "avdt/avdt_msg.cc",
115        "avdt/avdt_scb.cc",
116        "avdt/avdt_scb_act.cc",
117        "avrc/avrc_api.cc",
118        "avrc/avrc_bld_ct.cc",
119        "avrc/avrc_bld_tg.cc",
120        "avrc/avrc_opt.cc",
121        "avrc/avrc_pars_ct.cc",
122        "avrc/avrc_pars_tg.cc",
123        "avrc/avrc_sdp.cc",
124        "avrc/avrc_utils.cc",
125        "bnep/bnep_api.cc",
126        "bnep/bnep_main.cc",
127        "bnep/bnep_utils.cc",
128        "btm/hfp_lc3_decoder.cc",
129        "btm/hfp_lc3_encoder.cc",
130        "btm/hfp_msbc_decoder.cc",
131        "btm/hfp_msbc_encoder.cc",
132        "hid/hidd_api.cc",
133        "hid/hidd_conn.cc",
134        "hid/hidh_api.cc",
135        "hid/hidh_conn.cc",
136        "pan/pan_api.cc",
137        "pan/pan_main.cc",
138        "pan/pan_utils.cc",
139    ],
140    static_libs: [
141        "bluetooth_flags_c_lib",
142        "libbluetooth_crypto_toolbox",
143        "libbluetooth_hci_pdl",
144        "libbluetooth_log",
145        "libbt-btu-main-thread",
146        "libbt-hci",
147        "libbt-platform-protos-lite",
148        "libbt-stack-core",
149        "libbt_shim_bridge",
150        "liblc3",
151    ],
152    whole_static_libs: [
153        "libaptx_enc",
154        "libaptxhd_enc",
155        "libcom.android.sysprop.bluetooth.wrapped",
156        "libldacBT_abr",
157        "libldacBT_enc",
158    ],
159    apex_available: [
160        "com.android.btservices",
161    ],
162    host_supported: true,
163    min_sdk_version: "Tiramisu",
164    cflags: ["-Wno-unused-parameter"],
165}
166
167filegroup {
168    name: "LegacyStackSdp",
169    srcs: [
170        "sdp/sdp_api.cc",
171        "sdp/sdp_db.cc",
172        "sdp/sdp_discovery.cc",
173        "sdp/sdp_main.cc",
174        "sdp/sdp_server.cc",
175        "sdp/sdp_utils.cc",
176    ],
177}
178
179cc_library_static {
180    name: "libbt-stack-core",
181    defaults: ["fluoride_defaults"],
182    local_include_dirs: [
183        "avct",
184        "avdt",
185        "avrc",
186        "bnep",
187        "btm",
188        "eatt",
189        "gap",
190        "gatt",
191        "hid",
192        "include",
193        "l2cap",
194        "metrics",
195        "pan",
196        "sdp",
197        "smp",
198        "srvc",
199    ],
200    header_libs: [
201        "libbluetooth_headers",
202    ],
203    include_dirs: [
204        "packages/modules/Bluetooth/system",
205        "packages/modules/Bluetooth/system/bta/include",
206        "packages/modules/Bluetooth/system/bta/sys",
207        "packages/modules/Bluetooth/system/gd",
208        "packages/modules/Bluetooth/system/udrv/include",
209    ],
210    srcs: [
211        ":LegacyStackSdp",
212        "acl/acl.cc",
213        "acl/ble_acl.cc",
214        "acl/btm_acl.cc",
215        "acl/btm_pm.cc",
216        "arbiter/acl_arbiter.cc",
217        "btm/ble_scanner_hci_interface.cc",
218        "btm/btm_ble.cc",
219        "btm/btm_ble_addr.cc",
220        "btm/btm_ble_adv_filter.cc",
221        "btm/btm_ble_bgconn.cc",
222        "btm/btm_ble_cont_energy.cc",
223        "btm/btm_ble_gap.cc",
224        "btm/btm_ble_privacy.cc",
225        "btm/btm_ble_scanner.cc",
226        "btm/btm_ble_sec.cc",
227        "btm/btm_client_interface.cc",
228        "btm/btm_dev.cc",
229        "btm/btm_devctl.cc",
230        "btm/btm_inq.cc",
231        "btm/btm_iot_config.cc",
232        "btm/btm_iso.cc",
233        "btm/btm_main.cc",
234        "btm/btm_sco.cc",
235        "btm/btm_sco_hci.cc",
236        "btm/btm_sco_hfp_hal.cc",
237        "btm/btm_sec.cc",
238        "btm/btm_sec_cb.cc",
239        "btm/btm_security_client_interface.cc",
240        "btm/security_event_parser.cc",
241        "btu/btu_event.cc",
242        "btu/btu_hcif.cc",
243        "eatt/eatt.cc",
244        "gap/gap_ble.cc",
245        "gap/gap_conn.cc",
246        "gatt/att_protocol.cc",
247        "gatt/connection_manager.cc",
248        "gatt/gatt_api.cc",
249        "gatt/gatt_attr.cc",
250        "gatt/gatt_auth.cc",
251        "gatt/gatt_cl.cc",
252        "gatt/gatt_db.cc",
253        "gatt/gatt_main.cc",
254        "gatt/gatt_sr.cc",
255        "gatt/gatt_sr_hash.cc",
256        "gatt/gatt_utils.cc",
257        "hcic/hciblecmds.cc",
258        "hcic/hcicmds.cc",
259        "l2cap/l2c_api.cc",
260        "l2cap/l2c_ble.cc",
261        "l2cap/l2c_ble_conn_params.cc",
262        "l2cap/l2c_csm.cc",
263        "l2cap/l2c_fcr.cc",
264        "l2cap/l2c_link.cc",
265        "l2cap/l2c_main.cc",
266        "l2cap/l2c_utils.cc",
267        "metrics/stack_metrics_logging.cc",
268        "rfcomm/port_api.cc",
269        "rfcomm/port_rfc.cc",
270        "rfcomm/port_utils.cc",
271        "rfcomm/rfc_l2cap_if.cc",
272        "rfcomm/rfc_mx_fsm.cc",
273        "rfcomm/rfc_port_fsm.cc",
274        "rfcomm/rfc_port_if.cc",
275        "rfcomm/rfc_ts_frames.cc",
276        "rfcomm/rfc_utils.cc",
277        "smp/p_256_curvepara.cc",
278        "smp/p_256_ecc_pp.cc",
279        "smp/p_256_multprecision.cc",
280        "smp/smp_act.cc",
281        "smp/smp_api.cc",
282        "smp/smp_br_main.cc",
283        "smp/smp_keys.cc",
284        "smp/smp_l2c.cc",
285        "smp/smp_main.cc",
286        "smp/smp_utils.cc",
287        "srvc/srvc_dis.cc",
288        "srvc/srvc_eng.cc",
289    ],
290    generated_headers: [
291        "BluetoothGeneratedDumpsysDataSchema_h",
292    ],
293    cflags: [
294        /* we export all classes, so change default visibility, instead of having EXPORT_SYMBOL on each class*/
295        "-fvisibility=default",
296    ],
297    static_libs: [
298        "libaconfig_storage_read_api_cc",
299        "libbluetooth_core_rs",
300        "libbluetooth_crypto_toolbox",
301        "libbluetooth_gd",
302        "libbluetooth_hci_pdl",
303        "libbluetooth_log",
304        "libbt-hci",
305        "libbt-platform-protos-lite",
306        "libbt_shim_bridge",
307        "libcom.android.sysprop.bluetooth.wrapped",
308        "server_configurable_flags",
309    ],
310    shared_libs: [
311        "libPlatformProperties",
312        "libcrypto",
313    ],
314    apex_available: [
315        "com.android.btservices",
316    ],
317    host_supported: true,
318    min_sdk_version: "Tiramisu",
319}
320
321cc_defaults {
322    name: "btstack_fuzzer_default",
323    host_supported: true,
324    cflags: [
325        "-Wall",
326        "-Werror",
327        "-Wextra",
328        // Mocked components have too many unused parameters
329        "-Wno-unused-parameter",
330    ],
331    defaults: [
332        "bluetooth_flatbuffer_bundler_defaults",
333    ],
334    include_dirs: [
335        "packages/modules/Bluetooth/system",
336        "packages/modules/Bluetooth/system/gd",
337        "packages/modules/Bluetooth/system/include",
338        "packages/modules/Bluetooth/system/stack/include",
339        "packages/modules/Bluetooth/system/test/common",
340        "packages/modules/Bluetooth/system/types",
341    ],
342    static_libs: [
343        "libchrome",
344        "libgmock",
345        "libgtest",
346    ],
347    shared_libs: [
348        "libbase",
349        "liblog",
350    ],
351    target: {
352        darwin: {
353            enabled: false,
354        },
355        android: {
356            shared_libs: [
357                "libcutils",
358                "libutils",
359            ],
360        },
361        host: {
362            cflags: [
363                "-DOS_GENERIC",
364            ],
365        },
366    },
367    fuzz_config: {
368        // Options for performance improvement
369        libfuzzer_options: [
370            // This disables the stdout and stderr
371            "close_fd_mask=3",
372            // This limits the maximum corpus size to 4KB
373            "max_len=4096",
374            // TODO: b/280300628 for fixing memory leaks. Until it's fixed leak
375            // detection needs to be turned off to unblock fuzzing.
376            "detect_leaks=0",
377        ],
378        cc: [
379            "android-bluetooth-security@google.com",
380            "android-security-assurance-redteam@google.com",
381        ],
382        componentid: 27441, // Android > Android OS & Apps > Systems > bluetooth
383        hotlists: [
384            "3705175", // ASA Red Team Discovered Issues
385            "4810445", // ASA Red Team: Bluetooth Engagement Issues
386        ],
387        acknowledgement: [
388            "Android Bluetooth Team of Google",
389            "Android Red Team of Google",
390        ],
391    },
392}
393
394cc_fuzz {
395    name: "sdp-fuzzer",
396    defaults: [
397        "btstack_fuzzer_default",
398        "fluoride_defaults",
399    ],
400    include_dirs: [
401        "packages/modules/Bluetooth/system/stack/btm",
402    ],
403    srcs: [
404        ":LegacyStackSdp",
405        ":TestCommonMockFunctions",
406        ":TestFakeOsi",
407        ":TestMockBtif",
408        ":TestMockDevice",
409        ":TestMockGdOsLoggingLogRedaction",
410        ":TestMockStackBtm",
411        ":TestMockStackL2cap",
412        ":TestMockStackMetrics",
413        "fuzzers/sdp_fuzzer.cc",
414    ],
415    static_libs: [
416        "bluetooth_flags_c_lib",
417        "libbluetooth-types",
418        "libbluetooth_log",
419        "libbt-platform-protos-lite",
420        "libbt_shim_bridge",
421        "libbt_shim_ffi",
422    ],
423    shared_libs: [
424        "libaconfig_storage_read_api_cc",
425        "server_configurable_flags",
426    ],
427}
428
429cc_fuzz {
430    name: "gatt-fuzzer",
431    defaults: [
432        "btstack_fuzzer_default",
433        "fluoride_defaults",
434    ],
435    include_dirs: [
436        "external/flatbuffers/include",
437        "external/rust/crates/quiche/deps/boringssl/src/include",
438        "packages/modules/Bluetooth/system/stack/btm",
439    ],
440    generated_headers: [
441        "BluetoothGeneratedDumpsysDataSchema_h",
442    ],
443    srcs: [
444        ":BluetoothPacketSources",
445        ":TestCommonMockFunctions",
446        ":TestCommonStackConfig",
447        ":TestFakeOsi",
448        ":TestMockBtif",
449        ":TestMockDevice",
450        ":TestMockGdOsLoggingLogRedaction",
451        ":TestMockMainShim",
452        ":TestMockMainShimEntry",
453        ":TestMockRustFfi",
454        ":TestMockSrvcDis",
455        ":TestMockStackAcl",
456        ":TestMockStackArbiter",
457        ":TestMockStackBtm",
458        ":TestMockStackHcic",
459        ":TestMockStackL2cap",
460        ":TestMockStackMetrics",
461        ":TestMockStackSdp",
462        "eatt/*.cc",
463        "fuzzers/gatt_fuzzer.cc",
464        "gatt/*.cc",
465    ],
466    shared_libs: [
467        "libaconfig_storage_read_api_cc",
468        "server_configurable_flags",
469    ],
470    static_libs: [
471        "bluetooth_flags_c_lib",
472        "libbluetooth-types",
473        "libbluetooth_crypto_toolbox",
474        "libbluetooth_hci_pdl",
475        "libbluetooth_l2cap_pdl",
476        "libbluetooth_log",
477        "libbluetooth_smp_pdl",
478        "libbt-platform-protos-lite",
479        "libbt_shim_bridge",
480        "libbt_shim_ffi",
481    ],
482}
483
484cc_fuzz {
485    name: "smp-fuzzer",
486    defaults: [
487        "btstack_fuzzer_default",
488        "fluoride_defaults",
489    ],
490    include_dirs: [
491        "external/flatbuffers/include",
492        "external/rust/crates/quiche/deps/boringssl/src/include",
493        "packages/modules/Bluetooth/system/stack/btm",
494    ],
495    generated_headers: [
496        "BluetoothGeneratedDumpsysDataSchema_h",
497    ],
498    srcs: [
499        ":BluetoothPacketSources",
500        ":TestCommonMockFunctions",
501        ":TestCommonStackConfig",
502        ":TestFakeOsi",
503        ":TestMockBtif",
504        ":TestMockDevice",
505        ":TestMockGdOsLoggingLogRedaction",
506        ":TestMockMainShim",
507        ":TestMockMainShimEntry",
508        ":TestMockStackAcl",
509        ":TestMockStackBtm",
510        ":TestMockStackHcic",
511        ":TestMockStackL2cap",
512        ":TestMockStackMetrics",
513        "fuzzers/smp_fuzzer.cc",
514        "smp/*.cc", // add other sources files  (p256 related) under smp into this test
515    ],
516    shared_libs: [
517        "libaconfig_storage_read_api_cc",
518        "server_configurable_flags",
519    ],
520    static_libs: [
521        "bluetooth_flags_c_lib",
522        "libbluetooth-types",
523        "libbluetooth_crypto_toolbox",
524        "libbluetooth_hci_pdl",
525        "libbluetooth_l2cap_pdl",
526        "libbluetooth_log",
527        "libbluetooth_smp_pdl",
528        "libbt-common",
529        "libbt-platform-protos-lite",
530        "libbt_shim_bridge",
531        "libbt_shim_ffi",
532        "libevent",
533    ],
534}
535
536cc_fuzz {
537    name: "bnep-fuzzer",
538    defaults: [
539        "btstack_fuzzer_default",
540        "fluoride_defaults",
541    ],
542    include_dirs: [
543        "external/flatbuffers/include",
544        "external/rust/crates/quiche/deps/boringssl/src/include",
545        "packages/modules/Bluetooth/system/stack/btm",
546    ],
547    generated_headers: [
548        "BluetoothGeneratedDumpsysDataSchema_h",
549    ],
550    srcs: [
551        ":BluetoothPacketSources",
552        ":TestCommonMockFunctions",
553        ":TestCommonStackConfig",
554        ":TestFakeOsi",
555        ":TestMockBtif",
556        ":TestMockDevice",
557        ":TestMockGdOsLoggingLogRedaction",
558        ":TestMockMainShim",
559        ":TestMockMainShimEntry",
560        ":TestMockStackAcl",
561        ":TestMockStackBtm",
562        ":TestMockStackHcic",
563        ":TestMockStackL2cap",
564        ":TestMockStackMetrics",
565        "bnep/*.cc",
566        "fuzzers/bnep_fuzzer.cc",
567    ],
568    static_libs: [
569        "libbluetooth-types",
570        "libbluetooth_hci_pdl",
571        "libbluetooth_l2cap_pdl",
572        "libbluetooth_log",
573        "libbluetooth_smp_pdl",
574        "libbt-platform-protos-lite",
575        "libbt_shim_bridge",
576        "libbt_shim_ffi",
577    ],
578}
579
580cc_fuzz {
581    name: "avrc-fuzzer",
582    defaults: [
583        "btstack_fuzzer_default",
584        "fluoride_defaults",
585    ],
586    include_dirs: [
587        "external/flatbuffers/include",
588        "external/rust/crates/quiche/deps/boringssl/src/include",
589        "packages/modules/Bluetooth/system/stack/btm",
590    ],
591    generated_headers: [
592        "BluetoothGeneratedDumpsysDataSchema_h",
593    ],
594    srcs: [
595        ":BluetoothPacketSources",
596        ":TestCommonMockFunctions",
597        ":TestCommonStackConfig",
598        ":TestFakeOsi",
599        ":TestMockBtif",
600        ":TestMockDevice",
601        ":TestMockGdOsLoggingLogRedaction",
602        ":TestMockMainShim",
603        ":TestMockMainShimEntry",
604        ":TestMockStackAcl",
605        ":TestMockStackBtm",
606        ":TestMockStackHcic",
607        ":TestMockStackL2cap",
608        ":TestMockStackMetrics",
609        ":TestMockStackSdp",
610        "avct/*.cc",
611        "avrc/*.cc",
612        "fuzzers/avrc_fuzzer.cc",
613    ],
614    shared_libs: [
615        "libaconfig_storage_read_api_cc",
616        "server_configurable_flags",
617    ],
618    static_libs: [
619        "bluetooth_flags_c_lib",
620        "libbase",
621        "libbluetooth-types",
622        "libbluetooth_hci_pdl",
623        "libbluetooth_l2cap_pdl",
624        "libbluetooth_log",
625        "libbluetooth_smp_pdl",
626        "libbt-platform-protos-lite",
627        "libbt_shim_bridge",
628        "libbt_shim_ffi",
629        "libcom.android.sysprop.bluetooth.wrapped",
630    ],
631}
632
633cc_fuzz {
634    name: "l2cap-fuzzer",
635    defaults: [
636        "btstack_fuzzer_default",
637        "fluoride_defaults",
638    ],
639    include_dirs: [
640        "external/flatbuffers/include",
641        "external/rust/crates/quiche/deps/boringssl/src/include",
642        "packages/modules/Bluetooth/system/stack/btm",
643    ],
644    generated_headers: [
645        "BluetoothGeneratedDumpsysDataSchema_h",
646    ],
647    srcs: [
648        ":BluetoothPacketSources",
649        ":TestCommonMockFunctions",
650        ":TestCommonStackConfig",
651        ":TestFakeOsi",
652        ":TestMockBtif",
653        ":TestMockDevice",
654        ":TestMockGdOsLoggingLogRedaction",
655        ":TestMockMainShim",
656        ":TestMockMainShimEntry",
657        ":TestMockStackAcl",
658        ":TestMockStackBtm",
659        ":TestMockStackHcic",
660        ":TestMockStackMetrics",
661        "fuzzers/l2cap_fuzzer.cc",
662        "l2cap/*.cc",
663    ],
664    static_libs: [
665        "bluetooth_flags_c_lib",
666        "libbluetooth-types",
667        "libbluetooth_hci_pdl",
668        "libbluetooth_l2cap_pdl",
669        "libbluetooth_log",
670        "libbluetooth_smp_pdl",
671        "libbt-platform-protos-lite",
672        "libbt_shim_bridge",
673        "libbt_shim_ffi",
674    ],
675    shared_libs: [
676        "libaconfig_storage_read_api_cc",
677        "libbase",
678        "liblog",
679        "server_configurable_flags",
680    ],
681    target: {
682        android: {
683            shared_libs: [
684                "libPlatformProperties",
685            ],
686        },
687    },
688}
689
690// Bluetooth stack unit tests for target
691cc_test {
692    name: "net_test_stack",
693    defaults: [
694        "fluoride_defaults",
695        "latest_android_hardware_audio_common_ndk_static",
696        "latest_android_hardware_bluetooth_audio_ndk_static",
697        "latest_android_media_audio_common_types_ndk_static",
698        "mts_defaults",
699    ],
700    test_suites: ["general-tests"],
701    local_include_dirs: [
702        "include",
703    ],
704    include_dirs: [
705        "packages/modules/Bluetooth/system",
706        "packages/modules/Bluetooth/system/gd",
707    ],
708    srcs: [
709        "test/gatt/gatt_api_test.cc",
710        "test/stack_a2dp_test.cc",
711        "test/stack_avrcp_test.cc",
712    ],
713    shared_libs: [
714        "libPlatformProperties",
715        "libaaudio",
716        "libaconfig_storage_read_api_cc",
717        "libbase",
718        "libcrypto",
719        "libcutils",
720        "libdl",
721        "libevent",
722        "libhidlbase",
723        "liblog",
724        "libstatssocket",
725        "libutils",
726        "libz",
727        "server_configurable_flags",
728    ],
729    static_libs: [
730        "android.hardware.audio.common@5.0",
731        "android.hardware.bluetooth.a2dp@1.0",
732        "android.hardware.bluetooth.audio@2.0",
733        "android.hardware.bluetooth.audio@2.1",
734        "android.hardware.common-V2-ndk",
735        "android.hardware.common.fmq-V1-ndk",
736        "android.system.suspend-V1-ndk",
737        "android.system.suspend.control-V1-ndk",
738        "libFraunhoferAAC",
739        "libaudio-a2dp-hw-utils",
740        "libbase",
741        "libbluetooth-dumpsys",
742        "libbluetooth-for-tests",
743        "libbluetooth-gdx",
744        "libbluetooth-types",
745        "libbluetooth_core_rs",
746        "libbluetooth_crypto_toolbox",
747        "libbluetooth_log",
748        "libbt-audio-hal-interface",
749        "libbt-bta",
750        "libbt-bta-core",
751        "libbt-btu-main-thread",
752        "libbt-common",
753        "libbt-hci",
754        "libbt-jni-thread",
755        "libbt-sbc-decoder",
756        "libbt-sbc-encoder",
757        "libbt-stack",
758        "libbt-stack-core",
759        "libbt_shim_bridge",
760        "libbtcore",
761        "libbtdevice",
762        "libbtif",
763        "libbtif-core",
764        "libchrome",
765        "libfmq",
766        "libg722codec",
767        "liblc3",
768        "libopus",
769        "libosi",
770        "libprotobuf-cpp-lite",
771        "libstatslog_bt",
772        "libudrv-uipc",
773    ],
774    target: {
775        android: {
776            shared_libs: [
777                "libbinder_ndk",
778            ],
779            static_libs: [
780                "android.hardware.bluetooth@1.0",
781                "android.hardware.bluetooth@1.1",
782            ],
783        },
784        host: {
785            static_libs: [
786                "libbinder_ndk",
787            ],
788        },
789    },
790    header_libs: ["libbluetooth_headers"],
791}
792
793cc_test {
794    name: "net_test_stack_rfcomm",
795    defaults: [
796        "fluoride_defaults",
797        "mts_defaults",
798    ],
799    test_suites: ["general-tests"],
800    host_supported: true,
801    local_include_dirs: [
802        "btm",
803        "include",
804        "l2cap",
805        "rfcomm",
806        "smp",
807        "test/common",
808    ],
809    include_dirs: [
810        "packages/modules/Bluetooth/system",
811        "packages/modules/Bluetooth/system/gd",
812        "packages/modules/Bluetooth/system/gd/hal",
813    ],
814    srcs: [
815        ":TestCommonMockFunctions",
816        ":TestMockHci",
817        ":TestMockMainShim",
818        ":TestMockMainShimEntry",
819        ":TestMockStackBtm",
820        ":TestMockStackMetrics",
821        "rfcomm/port_api.cc",
822        "rfcomm/port_rfc.cc",
823        "rfcomm/port_utils.cc",
824        "rfcomm/rfc_l2cap_if.cc",
825        "rfcomm/rfc_mx_fsm.cc",
826        "rfcomm/rfc_port_fsm.cc",
827        "rfcomm/rfc_port_if.cc",
828        "rfcomm/rfc_ts_frames.cc",
829        "rfcomm/rfc_utils.cc",
830        "test/common/mock_btm_layer.cc",
831        "test/common/mock_l2cap_layer.cc",
832        "test/common/stack_test_packet_utils.cc",
833        "test/rfcomm/stack_rfcomm_test.cc",
834        "test/rfcomm/stack_rfcomm_test_main.cc",
835        "test/rfcomm/stack_rfcomm_test_utils.cc",
836        "test/rfcomm/stack_rfcomm_test_utils_test.cc",
837    ],
838    generated_headers: [
839        "BluetoothGeneratedDumpsysDataSchema_h",
840    ],
841    shared_libs: [
842        "libcrypto",
843        "libcutils",
844    ],
845    static_libs: [
846        "libbase",
847        "libbluetooth-types",
848        "libbluetooth_crypto_toolbox",
849        "libbluetooth_gd",
850        "libbluetooth_hci_pdl",
851        "libbluetooth_l2cap_pdl",
852        "libbluetooth_log",
853        "libbluetooth_smp_pdl",
854        "libbt-btu-main-thread",
855        "libbt-common",
856        "libbt-platform-protos-lite",
857        "libbt_shim_bridge",
858        "libbt_shim_ffi",
859        "libchrome",
860        "libevent",
861        "libgmock",
862        "liblog",
863        "libosi",
864        "libprotobuf-cpp-lite",
865        "libstatslog_bt",
866    ],
867    target: {
868        android: {
869            shared_libs: [
870                "libstatssocket",
871            ],
872        },
873    },
874    sanitize: {
875        cfi: false,
876    },
877    header_libs: ["libbluetooth_headers"],
878    cflags: ["-Wno-unused-parameter"],
879}
880
881// Bluetooth stack smp unit tests for target
882cc_test {
883    name: "net_test_stack_smp",
884    defaults: [
885        "bluetooth_flatbuffer_bundler_defaults",
886        "fluoride_defaults",
887        "mts_defaults",
888    ],
889    host_supported: true,
890    test_suites: ["general-tests"],
891    local_include_dirs: [
892        "btm",
893        "include",
894        "l2cap",
895        "smp",
896    ],
897    include_dirs: [
898        "packages/modules/Bluetooth/system",
899        "packages/modules/Bluetooth/system/gd",
900        "packages/modules/Bluetooth/system/include",
901    ],
902    srcs: [
903        ":TestCommonMainHandler",
904        ":TestCommonMockFunctions",
905        ":TestMockBtif",
906        ":TestMockDevice",
907        ":TestMockMainShim",
908        ":TestMockMainShimEntry",
909        ":TestMockStackAcl",
910        ":TestMockStackBtm",
911        ":TestMockStackHcic",
912        ":TestMockStackL2cap",
913        ":TestMockStackMetrics",
914        "smp/p_256_curvepara.cc",
915        "smp/p_256_ecc_pp.cc",
916        "smp/p_256_multprecision.cc",
917        "smp/smp_act.cc",
918        "smp/smp_api.cc",
919        "smp/smp_br_main.cc",
920        "smp/smp_keys.cc",
921        "smp/smp_l2c.cc",
922        "smp/smp_main.cc",
923        "smp/smp_utils.cc",
924        "test/stack_smp_test.cc",
925    ],
926    generated_headers: [
927        "BluetoothGeneratedDumpsysDataSchema_h",
928    ],
929    shared_libs: [
930        "libaconfig_storage_read_api_cc",
931        "libcrypto",
932        "libcutils",
933        "server_configurable_flags",
934    ],
935    static_libs: [
936        "libbase",
937        "libbluetooth-types",
938        "libbluetooth_crypto_toolbox",
939        "libbluetooth_gd",
940        "libbluetooth_hci_pdl",
941        "libbluetooth_l2cap_pdl",
942        "libbluetooth_log",
943        "libbluetooth_smp_pdl",
944        "libbt-btu-main-thread",
945        "libbt-common",
946        "libbt-platform-protos-lite",
947        "libbt_shim_bridge",
948        "libbt_shim_ffi",
949        "libchrome",
950        "libevent",
951        "libgmock",
952        "liblog",
953        "libosi",
954        "libstatslog_bt",
955    ],
956    target: {
957        android: {
958            shared_libs: [
959                "libstatssocket",
960            ],
961        },
962    },
963    //    header_libs: ["libbluetooth_headers"],
964    cflags: ["-Wno-unused-parameter"],
965}
966
967// Bluetooth stack advertise data parsing unit tests for target
968cc_test {
969    name: "net_test_stack_ad_parser",
970    defaults: [
971        "fluoride_defaults",
972        "mts_defaults",
973    ],
974    test_suites: ["general-tests"],
975    local_include_dirs: [
976        "include",
977    ],
978    srcs: [
979        "test/ad_parser_unittest.cc",
980    ],
981    shared_libs: [
982        "libbinder_ndk",
983        "libcrypto",
984    ],
985    static_libs: [
986        "android.system.suspend.control-V1-ndk",
987        "libbluetooth-types",
988        "libbluetooth_log",
989        "libgmock",
990        "liblog",
991    ],
992}
993
994// Bluetooth stack connection multiplexing
995cc_test {
996    name: "net_test_gatt_conn_multiplexing",
997    defaults: [
998        "fluoride_defaults",
999        "mts_defaults",
1000    ],
1001    host_supported: true,
1002    test_suites: ["general-tests"],
1003    local_include_dirs: [
1004        "btm",
1005        "include",
1006        "test/common",
1007    ],
1008    include_dirs: [
1009        "packages/modules/Bluetooth/system",
1010        "packages/modules/Bluetooth/system/gd",
1011    ],
1012    srcs: [
1013        ":TestCommonMainHandler",
1014        "gatt/connection_manager.cc",
1015        "test/common/mock_btm_api_layer.cc",
1016        "test/gatt_connection_manager_test.cc",
1017    ],
1018    shared_libs: [
1019        "libcutils",
1020    ],
1021    static_libs: [
1022        "libbase",
1023        "libbluetooth-types",
1024        "libbluetooth_gd",
1025        "libbluetooth_log",
1026        "libbt-common",
1027        "libbt_shim_bridge",
1028        "libbt_shim_ffi",
1029        "libchrome",
1030        "libevent",
1031        "libgmock",
1032        "liblog",
1033    ],
1034    sanitize: {
1035        cfi: false,
1036    },
1037    header_libs: ["libbluetooth_headers"],
1038    cflags: ["-Wno-unused-parameter"],
1039}
1040
1041cc_test {
1042    name: "net_test_stack_gatt_native",
1043    defaults: [
1044        "fluoride_defaults",
1045        "mts_defaults",
1046    ],
1047    test_suites: ["general-tests"],
1048    host_supported: true,
1049    test_options: {
1050        unit_test: true,
1051    },
1052    include_dirs: [
1053        "packages/modules/Bluetooth/system",
1054        "packages/modules/Bluetooth/system/gd",
1055        "packages/modules/Bluetooth/system/stack/btm",
1056        "packages/modules/Bluetooth/system/stack/eatt",
1057        "packages/modules/Bluetooth/system/stack/include",
1058        "packages/modules/Bluetooth/system/stack/l2cap",
1059    ],
1060    srcs: [
1061        ":TestCommonMockFunctions",
1062        ":TestMockRustFfi",
1063        ":TestMockStackArbiter",
1064        ":TestMockStackBtm",
1065        ":TestMockStackSdp",
1066        "gatt/gatt_utils.cc",
1067        "test/common/mock_eatt.cc",
1068        "test/common/mock_gatt_layer.cc",
1069        "test/gatt/gatt_sr_test.cc",
1070    ],
1071    shared_libs: [
1072        "libaconfig_storage_read_api_cc",
1073        "libcrypto",
1074        "libcutils",
1075        "server_configurable_flags",
1076    ],
1077    static_libs: [
1078        "libbase",
1079        "libbluetooth-types",
1080        "libbluetooth_crypto_toolbox",
1081        "libbluetooth_gd",
1082        "libbluetooth_log",
1083        "libbt-common",
1084        "libbt_shim_bridge",
1085        "libbt_shim_ffi",
1086        "libchrome",
1087        "libevent",
1088        "libgmock",
1089        "liblog",
1090        "libosi",
1091        "libstatslog_bt",
1092    ],
1093    target: {
1094        android: {
1095            shared_libs: [
1096                "libstatssocket",
1097            ],
1098        },
1099    },
1100    sanitize: {
1101        address: true,
1102        cfi: true,
1103        misc_undefined: ["bounds"],
1104    },
1105    header_libs: ["libbluetooth_headers"],
1106    cflags: ["-Wno-unused-parameter"],
1107}
1108
1109cc_test {
1110    name: "net_test_stack_avdtp",
1111    defaults: [
1112        "fluoride_defaults",
1113        "mts_defaults",
1114    ],
1115    test_suites: ["general-tests"],
1116    host_supported: true,
1117    test_options: {
1118        unit_test: true,
1119    },
1120    include_dirs: [
1121        "external/libldac/inc",
1122        "packages/modules/Bluetooth/system",
1123        "packages/modules/Bluetooth/system/gd",
1124        "packages/modules/Bluetooth/system/stack/include",
1125    ],
1126    srcs: [
1127        ":TestCommonMockFunctions",
1128        ":TestMockBta",
1129        ":TestMockDevice",
1130        ":TestMockStackA2dp",
1131        ":TestMockStackAcl",
1132        ":TestMockStackL2cap",
1133        "avdt/avdt_ad.cc",
1134        "avdt/avdt_api.cc",
1135        "avdt/avdt_ccb.cc",
1136        "avdt/avdt_ccb_act.cc",
1137        "avdt/avdt_l2c.cc",
1138        "avdt/avdt_scb.cc",
1139        "avdt/avdt_scb_act.cc",
1140        "test/common/mock_btu_layer.cc",
1141        "test/common/mock_stack_avdt_msg.cc",
1142        "test/stack_avdtp_test.cc",
1143    ],
1144    shared_libs: [
1145        "libcrypto",
1146        "libcutils",
1147    ],
1148    static_libs: [
1149        "libbase",
1150        "libbluetooth-types",
1151        "libbluetooth_crypto_toolbox",
1152        "libbluetooth_gd",
1153        "libbluetooth_log",
1154        "libbt-common",
1155        "libbt_shim_bridge",
1156        "libbt_shim_ffi",
1157        "libchrome",
1158        "libevent",
1159        "libgmock",
1160        "liblog",
1161        "libosi",
1162        "libprotobuf-cpp-lite",
1163        "libstatslog_bt",
1164    ],
1165    target: {
1166        android: {
1167            shared_libs: ["libstatssocket"],
1168        },
1169    },
1170    sanitize: {
1171        address: true,
1172        cfi: true,
1173        misc_undefined: ["bounds"],
1174    },
1175    header_libs: ["libbluetooth_headers"],
1176    cflags: ["-Wno-unused-parameter"],
1177}
1178
1179cc_test {
1180    name: "net_test_stack_a2dp_codecs_native",
1181    defaults: [
1182        "fluoride_defaults",
1183        "mts_defaults",
1184    ],
1185    cflags: [
1186        "-DUNIT_TESTS",
1187        "-Wno-unused-parameter",
1188    ],
1189    test_suites: ["general-tests"],
1190    host_supported: true,
1191    test_options: {
1192        unit_test: true,
1193    },
1194    include_dirs: [
1195        "external/aac/libAACdec/include",
1196        "external/aac/libAACenc/include",
1197        "external/aac/libSYS/include",
1198        "external/libldac/abr/inc",
1199        "external/libldac/inc",
1200        "external/libopus/include",
1201        "packages/modules/Bluetooth/system",
1202        "packages/modules/Bluetooth/system/embdrv/encoder_for_aptxhd/include",
1203        "packages/modules/Bluetooth/system/gd",
1204        "packages/modules/Bluetooth/system/stack/include",
1205    ],
1206    target: {
1207        android: {
1208            test_config: "test/a2dp/AndroidTest.xml",
1209        },
1210        android_x86: {
1211            test_config: "test/a2dp/AndroidTestForce32.xml",
1212        },
1213    },
1214    data: [
1215        "test/a2dp/raw_data/*",
1216    ],
1217    srcs: [
1218        ":TestCommonMockFunctions",
1219        ":TestMockAudioHalInterface",
1220        ":TestMockBta",
1221        ":TestMockStackA2dpApi",
1222        "a2dp/a2dp_aac.cc",
1223        "a2dp/a2dp_aac_decoder.cc",
1224        "a2dp/a2dp_aac_encoder.cc",
1225        "a2dp/a2dp_codec_config.cc",
1226        "a2dp/a2dp_ext.cc",
1227        "a2dp/a2dp_sbc.cc",
1228        "a2dp/a2dp_sbc_decoder.cc",
1229        "a2dp/a2dp_sbc_encoder.cc",
1230        "a2dp/a2dp_sbc_up_sample.cc",
1231        "a2dp/a2dp_vendor.cc",
1232        "a2dp/a2dp_vendor_aptx.cc",
1233        "a2dp/a2dp_vendor_aptx_encoder.cc",
1234        "a2dp/a2dp_vendor_aptx_hd.cc",
1235        "a2dp/a2dp_vendor_aptx_hd_encoder.cc",
1236        "a2dp/a2dp_vendor_ldac.cc",
1237        "a2dp/a2dp_vendor_ldac_decoder.cc",
1238        "a2dp/a2dp_vendor_ldac_encoder.cc",
1239        "a2dp/a2dp_vendor_opus.cc",
1240        "a2dp/a2dp_vendor_opus_decoder.cc",
1241        "a2dp/a2dp_vendor_opus_encoder.cc",
1242        "test/a2dp/a2dp_aac_unittest.cc",
1243        "test/a2dp/a2dp_opus_unittest.cc",
1244        "test/a2dp/a2dp_sbc_regression_tests.cc",
1245        "test/a2dp/a2dp_sbc_unittest.cc",
1246        "test/a2dp/a2dp_vendor_ldac_unittest.cc",
1247        "test/a2dp/a2dp_vendor_regression_tests.cc",
1248        "test/a2dp/mock_bta_av_codec.cc",
1249        "test/a2dp/test_util.cc",
1250        "test/a2dp/wav_reader.cc",
1251        "test/a2dp/wav_reader_unittest.cc",
1252    ],
1253    shared_libs: [
1254        "libcrypto",
1255        "libcutils",
1256        "libprotobuf-cpp-lite",
1257    ],
1258    static_libs: [
1259        "libFraunhoferAAC",
1260        "libbase",
1261        "libbluetooth-types",
1262        "libbluetooth_crypto_toolbox",
1263        "libbluetooth_gd",
1264        "libbluetooth_log",
1265        "libbt-common",
1266        "libbt-sbc-decoder",
1267        "libbt-sbc-encoder",
1268        "libbt_shim_bridge",
1269        "libbt_shim_ffi",
1270        "libchrome",
1271        "libgmock",
1272        "liblog",
1273        "libopus",
1274        "libosi",
1275    ],
1276    whole_static_libs: [
1277        "libaptx_enc",
1278        "libaptxhd_enc",
1279        "libldacBT_abr",
1280        "libldacBT_enc",
1281    ],
1282    sanitize: {
1283        address: true,
1284        cfi: true,
1285        misc_undefined: ["bounds"],
1286    },
1287    header_libs: ["libbluetooth_headers"],
1288}
1289
1290cc_test {
1291    name: "net_test_stack_a2dp_native",
1292    defaults: [
1293        "fluoride_defaults",
1294        "mts_defaults",
1295    ],
1296    test_suites: ["general-tests"],
1297    host_supported: true,
1298    test_options: {
1299        unit_test: true,
1300    },
1301    include_dirs: [
1302        "external/libldac/inc",
1303        "packages/modules/Bluetooth/system",
1304        "packages/modules/Bluetooth/system/gd",
1305        "packages/modules/Bluetooth/system/stack/include",
1306    ],
1307    srcs: [
1308        "a2dp/a2dp_vendor_ldac_decoder.cc",
1309        "test/a2dp/a2dp_vendor_ldac_decoder_test.cc",
1310        "test/a2dp/misc_fake.cc",
1311    ],
1312    shared_libs: [
1313        "libcrypto",
1314        "libcutils",
1315    ],
1316    static_libs: [
1317        "libbase",
1318        "libbluetooth_crypto_toolbox",
1319        "libbluetooth_log",
1320        "libbt-common",
1321        "libbt_shim_bridge",
1322        "libchrome",
1323        "liblog",
1324        "libosi",
1325    ],
1326    sanitize: {
1327        address: true,
1328        cfi: true,
1329        misc_undefined: ["bounds"],
1330    },
1331    header_libs: ["libbluetooth_headers"],
1332    cflags: ["-Wno-unused-parameter"],
1333}
1334
1335// gatt sr hash test
1336cc_test {
1337    name: "net_test_stack_gatt_sr_hash_native",
1338    defaults: [
1339        "fluoride_defaults",
1340        "mts_defaults",
1341    ],
1342    test_suites: ["general-tests"],
1343    host_supported: true,
1344    include_dirs: [
1345        "packages/modules/Bluetooth/system",
1346        "packages/modules/Bluetooth/system/gd",
1347        "packages/modules/Bluetooth/system/stack/btm",
1348        "packages/modules/Bluetooth/system/stack/eatt",
1349        "packages/modules/Bluetooth/system/stack/include",
1350    ],
1351    srcs: [
1352        ":LegacyStackSdp",
1353        ":TestCommonMainHandler",
1354        ":TestCommonMockFunctions",
1355        ":TestMockBtif",
1356        ":TestMockDevice",
1357        ":TestMockRustFfi",
1358        ":TestMockStackBtm",
1359        ":TestMockStackL2cap",
1360        ":TestMockStackMetrics",
1361        "gatt/gatt_db.cc",
1362        "gatt/gatt_sr_hash.cc",
1363        "gatt/gatt_utils.cc",
1364        "test/common/mock_eatt.cc",
1365        "test/common/mock_gatt_layer.cc",
1366        "test/gatt/mock_gatt_utils_ref.cc",
1367        "test/stack_gatt_sr_hash_test.cc",
1368    ],
1369    shared_libs: [
1370        "libaconfig_storage_read_api_cc",
1371        "libcrypto",
1372        "libcutils",
1373        "server_configurable_flags",
1374    ],
1375    static_libs: [
1376        "libbase",
1377        "libbluetooth-types",
1378        "libbluetooth_crypto_toolbox",
1379        "libbluetooth_gd",
1380        "libbluetooth_log",
1381        "libbt-common",
1382        "libbt-platform-protos-lite",
1383        "libbt_shim_bridge",
1384        "libbt_shim_ffi",
1385        "libchrome",
1386        "libevent",
1387        "libgmock",
1388        "liblog",
1389        "libosi",
1390        "libstatslog_bt",
1391    ],
1392    target: {
1393        android: {
1394            shared_libs: ["libstatssocket"],
1395        },
1396    },
1397    header_libs: ["libbluetooth_headers"],
1398    cflags: ["-Wno-unused-parameter"],
1399}
1400
1401// Iso manager unit tests
1402cc_test {
1403    name: "net_test_btm_iso",
1404    test_suites: ["general-tests"],
1405    host_supported: true,
1406    test_options: {
1407        unit_test: true,
1408    },
1409    defaults: [
1410        "bluetooth_flatbuffer_bundler_defaults",
1411        "fluoride_defaults",
1412        "mts_defaults",
1413    ],
1414    local_include_dirs: [
1415        "btm",
1416        "include",
1417        "test/common",
1418    ],
1419    generated_headers: [
1420        "BluetoothGeneratedDumpsysDataSchema_h",
1421    ],
1422    include_dirs: [
1423        "packages/modules/Bluetooth/system",
1424        "packages/modules/Bluetooth/system/gd",
1425    ],
1426    srcs: [
1427        ":BluetoothPacketSources",
1428        ":TestCommonMockFunctions",
1429        ":TestCommonStackConfig",
1430        ":TestMockMainShim",
1431        ":TestMockMainShimEntry",
1432        "btm/btm_iso.cc",
1433        "test/btm_iso_test.cc",
1434        "test/common/mock_gatt_layer.cc",
1435        "test/common/mock_hcic_layer.cc",
1436    ],
1437    static_libs: [
1438        "libbase",
1439        "libbluetooth-types",
1440        "libbluetooth_hci_pdl",
1441        "libbluetooth_log",
1442        "libbt-common",
1443        "libbt-platform-protos-lite",
1444        "libbt_shim_bridge",
1445        "libchrome",
1446        "libgmock",
1447        "liblog",
1448        "libosi",
1449    ],
1450    sanitize: {
1451        cfi: true,
1452        scs: true,
1453        address: true,
1454        all_undefined: true,
1455        integer_overflow: true,
1456        diag: {
1457            undefined: true,
1458        },
1459    },
1460    header_libs: ["libbluetooth_headers"],
1461}
1462
1463// EATT unit tests
1464cc_test {
1465    name: "net_test_eatt",
1466    test_suites: ["general-tests"],
1467    host_supported: true,
1468    test_options: {
1469        unit_test: true,
1470    },
1471    defaults: [
1472        "bluetooth_flatbuffer_bundler_defaults",
1473        "fluoride_defaults",
1474        "mts_defaults",
1475    ],
1476    local_include_dirs: [
1477        "btm",
1478        "eatt",
1479        "gatt",
1480        "include",
1481        "l2cap",
1482        "test/common",
1483    ],
1484    include_dirs: [
1485        "packages/modules/Bluetooth/system",
1486        "packages/modules/Bluetooth/system/gd",
1487    ],
1488    generated_headers: [
1489        "BluetoothGeneratedDumpsysDataSchema_h",
1490    ],
1491    srcs: [
1492        ":TestCommonMainHandler",
1493        ":TestCommonMockFunctions",
1494        ":TestCommonStackConfig",
1495        ":TestMockMainShim",
1496        ":TestMockMainShimEntry",
1497        "eatt/eatt.cc",
1498        "test/common/mock_btif_storage.cc",
1499        "test/common/mock_btm_api_layer.cc",
1500        "test/common/mock_gatt_layer.cc",
1501        "test/common/mock_l2cap_layer.cc",
1502        "test/eatt/eatt_test.cc",
1503        "test/gatt/mock_gatt_utils_ref.cc",
1504    ],
1505    shared_libs: [
1506        "libcrypto",
1507        "libcutils",
1508    ],
1509    static_libs: [
1510        "libbase",
1511        "libbluetooth-types",
1512        "libbluetooth_gd",
1513        "libbluetooth_hci_pdl",
1514        "libbluetooth_log",
1515        "libbt-common",
1516        "libbt-platform-protos-lite",
1517        "libbt_shim_bridge",
1518        "libbt_shim_ffi",
1519        "libchrome",
1520        "libevent",
1521        "libgmock",
1522        "liblog",
1523        "libosi",
1524        "libprotobuf-cpp-lite",
1525        "libstatslog_bt",
1526    ],
1527    target: {
1528        android: {
1529            shared_libs: ["libstatssocket"],
1530        },
1531    },
1532    sanitize: {
1533        cfi: false,
1534    },
1535    header_libs: ["libbluetooth_headers"],
1536    cflags: ["-Wno-unused-parameter"],
1537}
1538
1539cc_test {
1540    name: "net_test_stack_btm",
1541    test_suites: ["general-tests"],
1542    host_supported: true,
1543    test_options: {
1544        unit_test: true,
1545    },
1546    defaults: [
1547        "bluetooth_flatbuffer_bundler_defaults",
1548        "fluoride_defaults",
1549        "mts_defaults",
1550    ],
1551    local_include_dirs: [
1552        "btm",
1553        "include",
1554        "test/common",
1555    ],
1556    include_dirs: [
1557        "packages/modules/Bluetooth/system",
1558        "packages/modules/Bluetooth/system/device/include",
1559        "packages/modules/Bluetooth/system/gd",
1560    ],
1561    generated_headers: [
1562        "BluetoothGeneratedDumpsysDataSchema_h",
1563    ],
1564    srcs: [
1565        ":BluetoothHalSources_hci_host",
1566        ":BluetoothHalSources_ranging_host",
1567        ":BluetoothOsSources_host",
1568        ":OsiCompatSources",
1569        ":TestCommonMainHandler",
1570        ":TestCommonMockFunctions",
1571        ":TestCommonStackConfig",
1572        ":TestFakeLooper",
1573        ":TestFakeOsi",
1574        ":TestFakeThread",
1575        ":TestMockBta",
1576        ":TestMockBtif",
1577        ":TestMockDevice",
1578        ":TestMockLegacyHciInterface",
1579        ":TestMockMainBte",
1580        ":TestMockMainShim",
1581        ":TestMockMainShimEntry",
1582        ":TestMockRustFfi",
1583        ":TestMockStackBtu",
1584        ":TestMockStackGap",
1585        ":TestMockStackGatt",
1586        ":TestMockStackHcic",
1587        ":TestMockStackL2cap",
1588        ":TestMockStackSmp",
1589        ":TestMockUdrv",
1590        "acl/acl.cc",
1591        "acl/ble_acl.cc",
1592        "acl/btm_acl.cc",
1593        "acl/btm_pm.cc",
1594        "btm/ble_scanner_hci_interface.cc",
1595        "btm/btm_ble.cc",
1596        "btm/btm_ble_addr.cc",
1597        "btm/btm_ble_adv_filter.cc",
1598        "btm/btm_ble_bgconn.cc",
1599        "btm/btm_ble_cont_energy.cc",
1600        "btm/btm_ble_gap.cc",
1601        "btm/btm_ble_privacy.cc",
1602        "btm/btm_ble_scanner.cc",
1603        "btm/btm_ble_sec.cc",
1604        "btm/btm_client_interface.cc",
1605        "btm/btm_dev.cc",
1606        "btm/btm_devctl.cc",
1607        "btm/btm_inq.cc",
1608        "btm/btm_iot_config.cc",
1609        "btm/btm_iso.cc",
1610        "btm/btm_main.cc",
1611        "btm/btm_sco.cc",
1612        "btm/btm_sco_hci.cc",
1613        "btm/btm_sco_hfp_hal.cc",
1614        "btm/btm_sec.cc",
1615        "btm/btm_sec_cb.cc",
1616        "btm/btm_security_client_interface.cc",
1617        "btm/hfp_lc3_decoder.cc",
1618        "btm/hfp_lc3_encoder.cc",
1619        "btm/hfp_msbc_decoder.cc",
1620        "btm/hfp_msbc_encoder.cc",
1621        "btm/security_event_parser.cc",
1622        "metrics/stack_metrics_logging.cc",
1623        "test/btm/peer_packet_types_test.cc",
1624        "test/btm/sco_hci_test.cc",
1625        "test/btm/sco_pkt_status_test.cc",
1626        "test/btm/stack_btm_dev_test.cc",
1627        "test/btm/stack_btm_inq_test.cc",
1628        "test/btm/stack_btm_power_mode_test.cc",
1629        "test/btm/stack_btm_regression_tests.cc",
1630        "test/btm/stack_btm_sec_test.cc",
1631        "test/btm/stack_btm_test.cc",
1632        "test/common/mock_eatt.cc",
1633        "test/stack_include_test.cc",
1634    ],
1635    static_libs: [
1636        "libbase",
1637        "libbluetooth-types",
1638        "libbluetooth_crypto_toolbox",
1639        "libbluetooth_gd",
1640        "libbluetooth_log",
1641        "libbt-common",
1642        "libbt-platform-protos-lite",
1643        "libbt-sbc-decoder",
1644        "libbt-sbc-encoder",
1645        "libbt_shim_bridge",
1646        "libbt_shim_ffi",
1647        "libbtdevice",
1648        "libchrome",
1649        "libcom.android.sysprop.bluetooth.wrapped",
1650        "libevent",
1651        "libgmock",
1652        "liblc3",
1653        "liblog",
1654        "libosi",
1655        "libprotobuf-cpp-lite",
1656        "libudrv-uipc",
1657    ],
1658    shared_libs: [
1659        "libaconfig_storage_read_api_cc",
1660        "libcrypto",
1661        "server_configurable_flags",
1662    ],
1663    sanitize: {
1664        address: true,
1665        all_undefined: true,
1666        cfi: true,
1667        integer_overflow: true,
1668        scs: true,
1669        diag: {
1670            undefined: true,
1671        },
1672    },
1673    header_libs: ["libbluetooth_headers"],
1674}
1675
1676cc_test {
1677    name: "net_test_stack_hci",
1678    test_suites: ["general-tests"],
1679    host_supported: true,
1680    defaults: [
1681        "fluoride_defaults",
1682        "mts_defaults",
1683    ],
1684    local_include_dirs: [
1685        "btm",
1686        "include",
1687        "test/common",
1688    ],
1689    include_dirs: [
1690        "packages/modules/Bluetooth/system",
1691        "packages/modules/Bluetooth/system/gd",
1692    ],
1693    srcs: [
1694        ":TestCommonMockFunctions",
1695        "test/hci/stack_hci_test.cc",
1696    ],
1697    static_libs: [
1698        "libbase",
1699        "libbluetooth_crypto_toolbox",
1700        "libbluetooth_log",
1701        "libbt-common",
1702        "libbt_shim_bridge",
1703        "libbtdevice",
1704        "libbte",
1705        "libchrome",
1706        "libgmock",
1707        "liblog",
1708        "libosi",
1709    ],
1710    shared_libs: [
1711        "libcrypto",
1712    ],
1713    sanitize: {
1714        address: true,
1715        all_undefined: true,
1716        cfi: true,
1717        integer_overflow: true,
1718        scs: true,
1719        diag: {
1720            undefined: true,
1721        },
1722    },
1723    header_libs: ["libbluetooth_headers"],
1724}
1725
1726cc_test {
1727    name: "net_test_stack_hid",
1728    test_suites: ["general-tests"],
1729    host_supported: true,
1730    defaults: [
1731        "fluoride_defaults",
1732        "mts_defaults",
1733    ],
1734    local_include_dirs: [
1735        "include",
1736        "test/common",
1737    ],
1738    include_dirs: [
1739        "packages/modules/Bluetooth/system",
1740        "packages/modules/Bluetooth/system/gd",
1741        "packages/modules/Bluetooth/system/stack/btm",
1742    ],
1743    srcs: [
1744        ":BluetoothLogRedactionSources",
1745        ":TestCommonMockFunctions",
1746        ":TestMockStackBtm",
1747        ":TestMockStackL2cap",
1748        ":TestMockStackMetrics",
1749        ":TestMockStackSdp",
1750        "hid/hidd_api.cc",
1751        "hid/hidd_conn.cc",
1752        "hid/hidh_api.cc",
1753        "hid/hidh_conn.cc",
1754        "test/hid/stack_hid_test.cc",
1755    ],
1756    static_libs: [
1757        "libbase",
1758        "libbluetooth-types",
1759        "libbluetooth_crypto_toolbox",
1760        "libbluetooth_log",
1761        "libbt-common",
1762        "libbt-platform-protos-lite",
1763        "libbt_shim_bridge",
1764        "libbt_shim_ffi",
1765        "libbtdevice",
1766        "libbte",
1767        "libchrome",
1768        "libevent",
1769        "libgmock",
1770        "liblog",
1771        "libosi",
1772        "libprotobuf-cpp-lite",
1773    ],
1774    shared_libs: [
1775        "libcrypto",
1776    ],
1777    target: {
1778        android: {
1779            shared_libs: ["libstatssocket"],
1780        },
1781    },
1782    sanitize: {
1783        address: true,
1784        all_undefined: true,
1785        cfi: true,
1786        integer_overflow: true,
1787        scs: true,
1788        diag: {
1789            undefined: true,
1790        },
1791    },
1792    header_libs: ["libbluetooth_headers"],
1793    cflags: ["-Wno-unused-parameter"],
1794}
1795
1796cc_test {
1797    name: "net_test_stack_btu",
1798    test_suites: ["general-tests"],
1799    host_supported: true,
1800    defaults: [
1801        "fluoride_defaults",
1802        "mts_defaults",
1803    ],
1804    local_include_dirs: [
1805        "include",
1806        "test/common",
1807    ],
1808    include_dirs: [
1809        "packages/modules/Bluetooth/system",
1810        "packages/modules/Bluetooth/system/gd",
1811        "packages/modules/Bluetooth/system/stack/btm",
1812    ],
1813    generated_headers: [
1814        "BluetoothGeneratedDumpsysDataSchema_h",
1815    ],
1816    srcs: [
1817        ":TestCommonMockFunctions",
1818        ":TestMockBta",
1819        ":TestMockBtif",
1820        ":TestMockHci",
1821        ":TestMockLegacyHciCommands",
1822        ":TestMockMainShim",
1823        ":TestMockMainShimEntry",
1824        ":TestMockStackAcl",
1825        ":TestMockStackBtm",
1826        ":TestMockStackHcic",
1827        ":TestMockStackL2cap",
1828        ":TestMockStackMetrics",
1829        ":TestMockStackSmp",
1830        "btu/btu_event.cc",
1831        "btu/btu_hcif.cc",
1832        "btu/main_thread.cc",
1833        "test/stack_btu_test.cc",
1834    ],
1835    static_libs: [
1836        "libbase",
1837        "libbluetooth-types",
1838        "libbluetooth_gd",
1839        "libbluetooth_log",
1840        "libbt-common",
1841        "libbt-platform-protos-lite",
1842        "libbt_shim_bridge",
1843        "libbt_shim_ffi",
1844        "libbtdevice",
1845        "libchrome",
1846        "libevent",
1847        "libgmock",
1848        "liblog",
1849        "libosi",
1850    ],
1851    shared_libs: [
1852        "libbinder_ndk",
1853        "libcrypto",
1854    ],
1855    sanitize: {
1856        address: true,
1857        all_undefined: true,
1858        cfi: true,
1859        integer_overflow: true,
1860        scs: true,
1861        diag: {
1862            undefined: true,
1863        },
1864    },
1865    header_libs: ["libbluetooth_headers"],
1866    cflags: ["-Wno-unused-parameter"],
1867}
1868
1869cc_test {
1870    name: "net_test_stack_gatt",
1871    test_suites: ["general-tests"],
1872    host_supported: true,
1873    defaults: [
1874        "fluoride_defaults",
1875        "mts_defaults",
1876    ],
1877    local_include_dirs: [
1878        "include",
1879        "test/common",
1880    ],
1881    include_dirs: [
1882        "packages/modules/Bluetooth/system",
1883        "packages/modules/Bluetooth/system/gd",
1884        "packages/modules/Bluetooth/system/stack/btm",
1885    ],
1886    generated_headers: [
1887        "BluetoothGeneratedDumpsysDataSchema_h",
1888    ],
1889    srcs: [
1890        ":OsiCompatSources",
1891        ":TestCommonMainHandler",
1892        ":TestCommonMockFunctions",
1893        ":TestCommonStackConfig",
1894        ":TestMockBta",
1895        ":TestMockBtif",
1896        ":TestMockHci",
1897        ":TestMockLegacyHciCommands",
1898        ":TestMockMainShim",
1899        ":TestMockMainShimEntry",
1900        ":TestMockRustFfi",
1901        ":TestMockSrvcDis",
1902        ":TestMockStackAcl",
1903        ":TestMockStackBtm",
1904        ":TestMockStackL2cap",
1905        ":TestMockStackSdp",
1906        ":TestMockStackSmp",
1907        "arbiter/acl_arbiter.cc",
1908        "eatt/eatt.cc",
1909        "gatt/att_protocol.cc",
1910        "gatt/connection_manager.cc",
1911        "gatt/gatt_api.cc",
1912        "gatt/gatt_attr.cc",
1913        "gatt/gatt_auth.cc",
1914        "gatt/gatt_cl.cc",
1915        "gatt/gatt_db.cc",
1916        "gatt/gatt_main.cc",
1917        "gatt/gatt_sr.cc",
1918        "gatt/gatt_sr_hash.cc",
1919        "gatt/gatt_utils.cc",
1920        "test/gatt/stack_gatt_test.cc",
1921    ],
1922    static_libs: [
1923        "bluetooth_flags_c_lib",
1924        "libbase",
1925        "libbluetooth-types",
1926        "libbluetooth_crypto_toolbox",
1927        "libbluetooth_gd",
1928        "libbluetooth_log",
1929        "libbt-common",
1930        "libbt-platform-protos-lite",
1931        "libbt_shim_bridge",
1932        "libbt_shim_ffi",
1933        "libbtdevice",
1934        "libchrome",
1935        "libevent",
1936        "libflagtest",
1937        "libgmock",
1938        "liblog",
1939        "libosi",
1940        "libprotobuf-cpp-lite",
1941        "libstatslog_bt",
1942    ],
1943    shared_libs: [
1944        "libaconfig_storage_read_api_cc",
1945        "libbase",
1946        "libbinder_ndk",
1947        "libcrypto",
1948        "libcutils",
1949        "server_configurable_flags",
1950    ],
1951    target: {
1952        android: {
1953            shared_libs: ["libstatssocket"],
1954        },
1955    },
1956    sanitize: {
1957        address: true,
1958        all_undefined: true,
1959        cfi: true,
1960        integer_overflow: true,
1961        scs: true,
1962        diag: {
1963            undefined: true,
1964        },
1965    },
1966    header_libs: ["libbluetooth_headers"],
1967    cflags: ["-Wno-unused-parameter"],
1968}
1969
1970cc_test {
1971    name: "net_test_stack_l2cap",
1972    test_suites: ["general-tests"],
1973    host_supported: true,
1974    defaults: [
1975        "bluetooth_flatbuffer_bundler_defaults",
1976        "fluoride_defaults",
1977        "mts_defaults",
1978    ],
1979    local_include_dirs: [
1980        "include",
1981        "test/common",
1982    ],
1983    include_dirs: [
1984        "packages/modules/Bluetooth/system",
1985        "packages/modules/Bluetooth/system/gd",
1986        "packages/modules/Bluetooth/system/stack/btm",
1987    ],
1988    generated_headers: [
1989        "BluetoothGeneratedDumpsysDataSchema_h",
1990    ],
1991    srcs: [
1992        ":OsiCompatSources",
1993        ":TestCommonMainHandler",
1994        ":TestCommonMockFunctions",
1995        ":TestCommonStackConfig",
1996        ":TestMockBta",
1997        ":TestMockBtif",
1998        ":TestMockHci",
1999        ":TestMockJni",
2000        ":TestMockLegacyHciCommands",
2001        ":TestMockMainShim",
2002        ":TestMockMainShimEntry",
2003        ":TestMockStackAcl",
2004        ":TestMockStackBtm",
2005        ":TestMockStackHcic",
2006        ":TestMockStackSdp",
2007        ":TestMockStackSmp",
2008        "l2cap/l2c_api.cc",
2009        "l2cap/l2c_ble.cc",
2010        "l2cap/l2c_ble_conn_params.cc",
2011        "l2cap/l2c_csm.cc",
2012        "l2cap/l2c_fcr.cc",
2013        "l2cap/l2c_link.cc",
2014        "l2cap/l2c_main.cc",
2015        "l2cap/l2c_utils.cc",
2016        "test/stack_l2cap_test.cc",
2017    ],
2018    static_libs: [
2019        "libbluetooth-types",
2020        "libbluetooth_gd",
2021        "libbluetooth_log",
2022        "libbt-common",
2023        "libbt-platform-protos-lite",
2024        "libbt_shim_bridge",
2025        "libbt_shim_ffi",
2026        "libbtdevice",
2027        "libchrome",
2028        "libevent",
2029        "libgmock",
2030        "liblog",
2031        "libosi",
2032        "libprotobuf-cpp-lite",
2033        "libstatslog_bt",
2034    ],
2035    shared_libs: [
2036        "libaconfig_storage_read_api_cc",
2037        "libbase",
2038        "libbinder_ndk",
2039        "libcrypto",
2040        "libcutils",
2041        "server_configurable_flags",
2042    ],
2043    target: {
2044        android: {
2045            shared_libs: [
2046                "libPlatformProperties",
2047                "libstatssocket",
2048            ],
2049        },
2050    },
2051    sanitize: {
2052        address: true,
2053        all_undefined: true,
2054        cfi: true,
2055        integer_overflow: true,
2056        scs: true,
2057        diag: {
2058            undefined: true,
2059        },
2060    },
2061    header_libs: ["libbluetooth_headers"],
2062    cflags: ["-Wno-unused-parameter"],
2063}
2064
2065cc_test {
2066    name: "net_test_stack_acl",
2067    test_suites: ["general-tests"],
2068    host_supported: true,
2069    defaults: [
2070        "bluetooth_flatbuffer_bundler_defaults",
2071        "fluoride_defaults",
2072        "mts_defaults",
2073    ],
2074    local_include_dirs: [
2075        "include",
2076        "test/common",
2077    ],
2078    include_dirs: [
2079        "packages/modules/Bluetooth/system",
2080        "packages/modules/Bluetooth/system/gd",
2081        "packages/modules/Bluetooth/system/stack/btm",
2082    ],
2083    generated_headers: [
2084        "BluetoothGeneratedDumpsysDataSchema_h",
2085    ],
2086    srcs: [
2087        ":OsiCompatSources",
2088        ":TestCommonMainHandler",
2089        ":TestCommonMockFunctions",
2090        ":TestCommonStackConfig",
2091        ":TestMockBta",
2092        ":TestMockBtif",
2093        ":TestMockDevice",
2094        ":TestMockHci",
2095        ":TestMockLegacyHciCommands",
2096        ":TestMockLegacyHciInterface",
2097        ":TestMockMainShim",
2098        ":TestMockMainShimEntry",
2099        ":TestMockRustFfi",
2100        ":TestMockStackBtm",
2101        ":TestMockStackBtu",
2102        ":TestMockStackGatt",
2103        ":TestMockStackHcic",
2104        ":TestMockStackL2cap",
2105        ":TestMockStackMetrics",
2106        ":TestMockStackSdp",
2107        ":TestMockStackSmp",
2108        "acl/*.cc",
2109        "btm/btm_iot_config.cc",
2110        "test/stack_acl_test.cc",
2111    ],
2112    static_libs: [
2113        "libbluetooth-types",
2114        "libbluetooth_gd",
2115        "libbluetooth_log",
2116        "libbt-common",
2117        "libbt-platform-protos-lite",
2118        "libbt_shim_bridge",
2119        "libbt_shim_ffi",
2120        "libbtdevice",
2121        "libchrome",
2122        "libcutils",
2123        "libevent",
2124        "libgmock",
2125        "liblog",
2126        "libosi",
2127        "libstatslog_bt",
2128    ],
2129    shared_libs: [
2130        "libaconfig_storage_read_api_cc",
2131        "libbase",
2132        "libbinder_ndk",
2133        "libcrypto",
2134        "server_configurable_flags",
2135    ],
2136    target: {
2137        android: {
2138            shared_libs: ["libstatssocket"],
2139        },
2140    },
2141    sanitize: {
2142        address: true,
2143        all_undefined: true,
2144        cfi: true,
2145        integer_overflow: true,
2146        scs: true,
2147        diag: {
2148            undefined: true,
2149        },
2150    },
2151    header_libs: ["libbluetooth_headers"],
2152    cflags: ["-Wno-unused-parameter"],
2153}
2154
2155// Bluetooth stack connection multiplexing
2156cc_test {
2157    name: "net_test_stack_sdp",
2158    test_suites: ["general-tests"],
2159    host_supported: true,
2160    defaults: [
2161        "fluoride_defaults",
2162        "mts_defaults",
2163    ],
2164    local_include_dirs: [
2165        "include",
2166        "test/common",
2167    ],
2168    include_dirs: [
2169        "packages/modules/Bluetooth/system",
2170        "packages/modules/Bluetooth/system/gd",
2171        "packages/modules/Bluetooth/system/stack/btm",
2172    ],
2173    srcs: [
2174        ":LegacyStackSdp",
2175        ":TestCommonMockFunctions",
2176        ":TestFakeOsi",
2177        ":TestMockBtif",
2178        ":TestMockStackBtm",
2179        ":TestMockStackL2cap",
2180        ":TestMockStackMetrics",
2181        "test/sdp/stack_sdp_db_test.cc",
2182        "test/sdp/stack_sdp_parse_test.cc",
2183        "test/sdp/stack_sdp_test.cc",
2184        "test/sdp/stack_sdp_utils_test.cc",
2185    ],
2186    static_libs: [
2187        "bluetooth_flags_c_lib",
2188        "libbase",
2189        "libbluetooth-types",
2190        "libbluetooth_gd",
2191        "libbluetooth_log",
2192        "libbt-common",
2193        "libbt-platform-protos-lite",
2194        "libbt_shim_bridge",
2195        "libbt_shim_ffi",
2196        "libchrome",
2197        "libflagtest",
2198        "libgmock",
2199        "liblog",
2200    ],
2201    shared_libs: [
2202        "libaconfig_storage_read_api_cc",
2203        "libcrypto",
2204        "libcutils",
2205        "server_configurable_flags",
2206    ],
2207    header_libs: ["libbluetooth_headers"],
2208}
2209