Skip to content
Snippets Groups Projects
  • Myles Watson's avatar
    810ad0d6
    Remove libosi dependency from l2cap-fuzzer · 810ad0d6
    Myles Watson authored
    Avoid merge conflicts, since this dependency isn't there in
    main or AOSP.
    
    Bug: 301661850
    Test: mma -j32
    Flag: EXEMPT, merge conflict resolution
    Ignore-AOSP-First: This is not in AOSP
    Change-Id: I55004b0a678e33bd87b45176edd9c52b35b97ea3
    810ad0d6
    History
    Remove libosi dependency from l2cap-fuzzer
    Myles Watson authored
    Avoid merge conflicts, since this dependency isn't there in
    main or AOSP.
    
    Bug: 301661850
    Test: mma -j32
    Flag: EXEMPT, merge conflict resolution
    Ignore-AOSP-First: This is not in AOSP
    Change-Id: I55004b0a678e33bd87b45176edd9c52b35b97ea3
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Android.bp 55.01 KiB
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "system_bt_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    //   SPDX-license-identifier-BSD
    default_applicable_licenses: ["system_bt_license"],
}

cc_library_static {
    name: "libbt-btu-main-thread",
    defaults: ["fluoride_defaults"],
    srcs: ["btu/main_thread.cc"],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/include",
        "packages/modules/Bluetooth/system/stack/include",
        "packages/modules/Bluetooth/system/types",
    ],
    static_libs: [
        "libbluetooth_log",
        "libbt_shim_bridge",
    ],
    shared_libs: [
        "libchrome",
    ],
    apex_available: [
        "com.android.btservices",
    ],
    host_supported: true,
    min_sdk_version: "Tiramisu",
}

// Bluetooth stack static library for target
cc_library_static {
    name: "libbt-stack",
    defaults: ["fluoride_defaults"],
    local_include_dirs: [
        "avct",
        "avdt",
        "avrc",
        "bnep",
        "btm",
        "eatt",
        "gap",
        "gatt",
        "hid",
        "include",
        "l2cap",
        "metrics",
        "pan",
        "sdp",
        "smp",
        "srvc",
    ],
    header_libs: [
        "libbluetooth_headers",
    ],
    include_dirs: [
        "external/aac/libAACdec/include",
        "external/aac/libAACenc/include",
        "external/aac/libSYS/include",
        "external/libldac/abr/inc",
        "external/libldac/inc",
        "external/libopus/include",
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/bta/include",
        "packages/modules/Bluetooth/system/bta/sys",
        "packages/modules/Bluetooth/system/device/include",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/gd/hal",
        "packages/modules/Bluetooth/system/udrv/include",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        "a2dp/a2dp_aac.cc",
        "a2dp/a2dp_aac_decoder.cc",
        "a2dp/a2dp_aac_encoder.cc",
        "a2dp/a2dp_api.cc",
        "a2dp/a2dp_codec_config.cc",
        "a2dp/a2dp_ext.cc",
        "a2dp/a2dp_sbc.cc",
        "a2dp/a2dp_sbc_decoder.cc",
        "a2dp/a2dp_sbc_encoder.cc",
        "a2dp/a2dp_sbc_up_sample.cc",
        "a2dp/a2dp_vendor.cc",
        "a2dp/a2dp_vendor_aptx.cc",
        "a2dp/a2dp_vendor_aptx_encoder.cc",
        "a2dp/a2dp_vendor_aptx_hd.cc",
        "a2dp/a2dp_vendor_aptx_hd_encoder.cc",
        "a2dp/a2dp_vendor_ldac.cc",
        "a2dp/a2dp_vendor_ldac_decoder.cc",
        "a2dp/a2dp_vendor_ldac_encoder.cc",
        "a2dp/a2dp_vendor_opus.cc",
        "a2dp/a2dp_vendor_opus_decoder.cc",
        "a2dp/a2dp_vendor_opus_encoder.cc",
        "avct/avct_api.cc",
        "avct/avct_bcb_act.cc",
        "avct/avct_ccb.cc",
        "avct/avct_l2c.cc",
        "avct/avct_l2c_br.cc",
        "avct/avct_lcb.cc",
        "avct/avct_lcb_act.cc",
        "avdt/avdt_ad.cc",
        "avdt/avdt_api.cc",
        "avdt/avdt_ccb.cc",
        "avdt/avdt_ccb_act.cc",
        "avdt/avdt_l2c.cc",
        "avdt/avdt_msg.cc",
        "avdt/avdt_scb.cc",
        "avdt/avdt_scb_act.cc",
        "avrc/avrc_api.cc",
        "avrc/avrc_bld_ct.cc",
        "avrc/avrc_bld_tg.cc",
        "avrc/avrc_opt.cc",
        "avrc/avrc_pars_ct.cc",
        "avrc/avrc_pars_tg.cc",
        "avrc/avrc_sdp.cc",
        "avrc/avrc_utils.cc",
        "bnep/bnep_api.cc",
        "bnep/bnep_main.cc",
        "bnep/bnep_utils.cc",
        "btm/hfp_lc3_decoder.cc",
        "btm/hfp_lc3_encoder.cc",
        "btm/hfp_msbc_decoder.cc",
        "btm/hfp_msbc_encoder.cc",
        "hid/hidd_api.cc",
        "hid/hidd_conn.cc",
        "hid/hidh_api.cc",
        "hid/hidh_conn.cc",
        "pan/pan_api.cc",
        "pan/pan_main.cc",
        "pan/pan_utils.cc",
    ],
    static_libs: [
        "libbluetooth_crypto_toolbox",
        "libbluetooth_hci_pdl",
        "libbluetooth_log",
        "libbt-btu-main-thread",
        "libbt-hci",
        "libbt-platform-protos-lite",
        "libbt-stack-core",
        "libbt_shim_bridge",
        "liblc3",
    ],
    whole_static_libs: [
        "libaptx_enc",
        "libaptxhd_enc",
        "libcom.android.sysprop.bluetooth.wrapped",
        "libldacBT_abr",
        "libldacBT_enc",
    ],
    apex_available: [
        "com.android.btservices",
    ],
    host_supported: true,
    min_sdk_version: "Tiramisu",
    cflags: ["-Wno-unused-parameter"],
}

filegroup {
    name: "LegacyStackSdp",
    srcs: [
        "sdp/sdp_api.cc",
        "sdp/sdp_db.cc",
        "sdp/sdp_discovery.cc",
        "sdp/sdp_main.cc",
        "sdp/sdp_server.cc",
        "sdp/sdp_utils.cc",
    ],
}

cc_library_static {
    name: "libbt-stack-core",
    defaults: ["fluoride_defaults"],
    local_include_dirs: [
        "avct",
        "avdt",
        "avrc",
        "bnep",
        "btm",
        "eatt",
        "gap",
        "gatt",
        "hid",
        "include",
        "l2cap",
        "metrics",
        "pan",
        "sdp",
        "smp",
        "srvc",
    ],
    header_libs: [
        "libbluetooth_headers",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/bta/include",
        "packages/modules/Bluetooth/system/bta/sys",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/udrv/include",
    ],
    srcs: [
        ":LegacyStackSdp",
        "acl/acl.cc",
        "acl/ble_acl.cc",
        "acl/btm_acl.cc",
        "acl/btm_pm.cc",
        "arbiter/acl_arbiter.cc",
        "btm/ble_scanner_hci_interface.cc",
        "btm/btm_ble.cc",
        "btm/btm_ble_addr.cc",
        "btm/btm_ble_adv_filter.cc",
        "btm/btm_ble_bgconn.cc",
        "btm/btm_ble_cont_energy.cc",
        "btm/btm_ble_gap.cc",
        "btm/btm_ble_privacy.cc",
        "btm/btm_ble_scanner.cc",
        "btm/btm_ble_sec.cc",
        "btm/btm_client_interface.cc",
        "btm/btm_dev.cc",
        "btm/btm_devctl.cc",
        "btm/btm_inq.cc",
        "btm/btm_iot_config.cc",
        "btm/btm_iso.cc",
        "btm/btm_main.cc",
        "btm/btm_sco.cc",
        "btm/btm_sco_hci.cc",
        "btm/btm_sco_hfp_hal.cc",
        "btm/btm_sec.cc",
        "btm/btm_sec_cb.cc",
        "btm/btm_security_client_interface.cc",
        "btm/security_event_parser.cc",
        "btu/btu_event.cc",
        "btu/btu_hcif.cc",
        "eatt/eatt.cc",
        "gap/gap_ble.cc",
        "gap/gap_conn.cc",
        "gatt/att_protocol.cc",
        "gatt/connection_manager.cc",
        "gatt/gatt_api.cc",
        "gatt/gatt_attr.cc",
        "gatt/gatt_auth.cc",
        "gatt/gatt_cl.cc",
        "gatt/gatt_db.cc",
        "gatt/gatt_main.cc",
        "gatt/gatt_sr.cc",
        "gatt/gatt_sr_hash.cc",
        "gatt/gatt_utils.cc",
        "hcic/hciblecmds.cc",
        "hcic/hcicmds.cc",
        "l2cap/l2c_api.cc",
        "l2cap/l2c_ble.cc",
        "l2cap/l2c_ble_conn_params.cc",
        "l2cap/l2c_csm.cc",
        "l2cap/l2c_fcr.cc",
        "l2cap/l2c_link.cc",
        "l2cap/l2c_main.cc",
        "l2cap/l2c_utils.cc",
        "metrics/stack_metrics_logging.cc",
        "rfcomm/port_api.cc",
        "rfcomm/port_rfc.cc",
        "rfcomm/port_utils.cc",
        "rfcomm/rfc_l2cap_if.cc",
        "rfcomm/rfc_mx_fsm.cc",
        "rfcomm/rfc_port_fsm.cc",
        "rfcomm/rfc_port_if.cc",
        "rfcomm/rfc_ts_frames.cc",
        "rfcomm/rfc_utils.cc",
        "smp/p_256_curvepara.cc",
        "smp/p_256_ecc_pp.cc",
        "smp/p_256_multprecision.cc",
        "smp/smp_act.cc",
        "smp/smp_api.cc",
        "smp/smp_br_main.cc",
        "smp/smp_keys.cc",
        "smp/smp_l2c.cc",
        "smp/smp_main.cc",
        "smp/smp_utils.cc",
        "srvc/srvc_dis.cc",
        "srvc/srvc_eng.cc",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    cflags: [
        "-Wno-unused-parameter",
        /* we export all classes, so change default visibility, instead of having EXPORT_SYMBOL on each class*/
        "-fvisibility=default",
    ],
    static_libs: [
        "libbluetooth_core_rs",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_gd",
        "libbluetooth_hci_pdl",
        "libbluetooth_log",
        "libbt-hci",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libcom.android.sysprop.bluetooth.wrapped",
        "server_configurable_flags",
    ],
    shared_libs: [
        "libPlatformProperties",
        "libcrypto",
    ],
    apex_available: [
        "com.android.btservices",
    ],
    host_supported: true,
    min_sdk_version: "Tiramisu",
}

cc_defaults {
    name: "btstack_fuzzer_default",
    host_supported: true,
    cflags: [
        "-Wall",
        "-Werror",
        "-Wextra",
        // Mocked components have too many unused parameters
        "-Wno-unused-parameter",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/include",
        "packages/modules/Bluetooth/system/stack/include",
        "packages/modules/Bluetooth/system/test/common",
        "packages/modules/Bluetooth/system/types",
    ],
    static_libs: [
        "libchrome",
    ],
    shared_libs: [
        "libbase",
        "liblog",
    ],
    target: {
        darwin: {
            enabled: false,
        },
        android: {
            shared_libs: [
                "libcutils",
                "libutils",
            ],
        },
        host: {
            cflags: [
                "-DOS_GENERIC",
            ],
        },
    },
    fuzz_config: {
        // Options for performance improvement
        libfuzzer_options: [
            // This disables the stdout and stderr
            "close_fd_mask=3",
            // This limits the maximum corpus size to 4KB
            "max_len=4096",
            // TODO: b/280300628 for fixing memory leaks. Until it's fixed leak
            // detection needs to be turned off to unblock fuzzing.
            "detect_leaks=0",
        ],
        cc: [
            "android-bluetooth-security@google.com",
            "android-security-assurance-redteam@google.com",
        ],
        componentid: 27441, // Android > Android OS & Apps > Systems > bluetooth
        hotlists: [
            "3705175", // ASA Red Team Discovered Issues
            "4810445", // ASA Red Team: Bluetooth Engagement Issues
        ],
        acknowledgement: [
            "Android Bluetooth Team of Google",
            "Android Red Team of Google",
        ],
    },
}

cc_fuzz {
    name: "sdp-fuzzer",
    defaults: [
        "btstack_fuzzer_default",
        "fluoride_defaults",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    srcs: [
        ":LegacyStackSdp",
        ":TestCommonMockFunctions",
        ":TestFakeOsi",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockGdOsLoggingLogRedaction",
        ":TestMockStackBtm",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        "fuzzers/sdp_fuzzer.cc",
    ],
    static_libs: [
        "libbluetooth-types",
        "libbluetooth_log",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
    ],
}

cc_fuzz {
    name: "gatt-fuzzer",
    defaults: [
        "btstack_fuzzer_default",
        "fluoride_defaults",
    ],
    include_dirs: [
        "external/flatbuffers/include",
        "external/rust/crates/quiche/deps/boringssl/src/include",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        ":BluetoothPacketSources",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestFakeOsi",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockGdOsLoggingLogRedaction",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockRustFfi",
        ":TestMockSrvcDis",
        ":TestMockStackAcl",
        ":TestMockStackArbiter",
        ":TestMockStackBtm",
        ":TestMockStackHcic",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        ":TestMockStackSdp",
        "eatt/*.cc",
        "fuzzers/gatt_fuzzer.cc",
        "gatt/*.cc",
    ],
    shared_libs: [
        "server_configurable_flags",
    ],
    static_libs: [
        "bluetooth_flags_c_lib",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_hci_pdl",
        "libbluetooth_l2cap_pdl",
        "libbluetooth_log",
        "libbluetooth_smp_pdl",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libgmock",
    ],
}

cc_fuzz {
    name: "smp-fuzzer",
    defaults: [
        "btstack_fuzzer_default",
        "fluoride_defaults",
    ],
    include_dirs: [
        "external/flatbuffers/include",
        "external/rust/crates/quiche/deps/boringssl/src/include",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        ":BluetoothPacketSources",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestFakeOsi",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockGdOsLoggingLogRedaction",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackAcl",
        ":TestMockStackBtm",
        ":TestMockStackHcic",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        "fuzzers/smp_fuzzer.cc",
        "smp/*.cc", // add other sources files  (p256 related) under smp into this test
    ],
    shared_libs: [
        "server_configurable_flags",
    ],
    static_libs: [
        "bluetooth_flags_c_lib",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_hci_pdl",
        "libbluetooth_l2cap_pdl",
        "libbluetooth_log",
        "libbluetooth_smp_pdl",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libgmock",
    ],
}

cc_fuzz {
    name: "bnep-fuzzer",
    defaults: [
        "btstack_fuzzer_default",
        "fluoride_defaults",
    ],
    include_dirs: [
        "external/flatbuffers/include",
        "external/rust/crates/quiche/deps/boringssl/src/include",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        ":BluetoothPacketSources",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestFakeOsi",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockGdOsLoggingLogRedaction",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackAcl",
        ":TestMockStackBtm",
        ":TestMockStackHcic",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        "bnep/*.cc",
        "fuzzers/bnep_fuzzer.cc",
    ],
    static_libs: [
        "libbluetooth-types",
        "libbluetooth_hci_pdl",
        "libbluetooth_l2cap_pdl",
        "libbluetooth_log",
        "libbluetooth_smp_pdl",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libgmock",
    ],
}

cc_fuzz {
    name: "avrc-fuzzer",
    defaults: [
        "btstack_fuzzer_default",
        "fluoride_defaults",
    ],
    include_dirs: [
        "external/flatbuffers/include",
        "external/rust/crates/quiche/deps/boringssl/src/include",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        ":BluetoothPacketSources",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestFakeOsi",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockGdOsLoggingLogRedaction",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackAcl",
        ":TestMockStackBtm",
        ":TestMockStackHcic",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        ":TestMockStackSdp",
        "avct/*.cc",
        "avrc/*.cc",
        "fuzzers/avrc_fuzzer.cc",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_hci_pdl",
        "libbluetooth_l2cap_pdl",
        "libbluetooth_log",
        "libbluetooth_smp_pdl",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libcom.android.sysprop.bluetooth.wrapped",
        "libgmock",
    ],
}

cc_fuzz {
    name: "l2cap-fuzzer",
    defaults: [
        "btstack_fuzzer_default",
        "fluoride_defaults",
    ],
    include_dirs: [
        "external/flatbuffers/include",
        "external/rust/crates/quiche/deps/boringssl/src/include",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        ":BluetoothPacketSources",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestFakeOsi",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockGdOsLoggingLogRedaction",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackAcl",
        ":TestMockStackBtm",
        ":TestMockStackHcic",
        ":TestMockStackMetrics",
        "fuzzers/l2cap_fuzzer.cc",
        "l2cap/*.cc",
    ],
    static_libs: [
        "libbluetooth-types",
        "libbluetooth_hci_pdl",
        "libbluetooth_l2cap_pdl",
        "libbluetooth_log",
        "libbluetooth_smp_pdl",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libgmock",
    ],
    target: {
        android: {
            shared_libs: [
                "libPlatformProperties",
            ],
        },
    },
}

// Bluetooth stack unit tests for target
cc_test {
    name: "net_test_stack",
    defaults: [
        "fluoride_defaults",
        "latest_android_hardware_audio_common_ndk_static",
        "latest_android_hardware_bluetooth_audio_ndk_static",
        "latest_android_media_audio_common_types_ndk_static",
        "mts_defaults",
    ],
    test_suites: ["general-tests"],
    local_include_dirs: [
        "include",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
    ],
    srcs: [
        "test/gatt/gatt_api_test.cc",
        "test/stack_a2dp_test.cc",
        "test/stack_avrcp_test.cc",
    ],
    shared_libs: [
        "libPlatformProperties",
        "libaaudio",
        "libcrypto",
        "libcutils",
        "libdl",
        "libevent",
        "libhidlbase",
        "liblog",
        "libstatssocket",
        "libutils",
        "libz",
        "server_configurable_flags",
    ],
    static_libs: [
        "android.hardware.audio.common@5.0",
        "android.hardware.bluetooth.a2dp@1.0",
        "android.hardware.bluetooth.audio@2.0",
        "android.hardware.bluetooth.audio@2.1",
        "android.hardware.common-V2-ndk",
        "android.hardware.common.fmq-V1-ndk",
        "android.system.suspend-V1-ndk",
        "android.system.suspend.control-V1-ndk",
        "libFraunhoferAAC",
        "libaudio-a2dp-hw-utils",
        "libbase",
        "libbluetooth-dumpsys",
        "libbluetooth-for-tests",
        "libbluetooth-gdx",
        "libbluetooth-types",
        "libbluetooth_core_rs",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_log",
        "libbt-audio-hal-interface",
        "libbt-bta",
        "libbt-bta-core",
        "libbt-btu-main-thread",
        "libbt-common",
        "libbt-hci",
        "libbt-jni-thread",
        "libbt-sbc-decoder",
        "libbt-sbc-encoder",
        "libbt-stack",
        "libbt-stack-core",
        "libbt_shim_bridge",
        "libbtcore",
        "libbtdevice",
        "libbtif",
        "libbtif-core",
        "libchrome",
        "libfmq",
        "libg722codec",
        "liblc3",
        "libopus",
        "libosi",
        "libprotobuf-cpp-lite",
        "libstatslog_bt",
        "libudrv-uipc",
    ],
    target: {
        android: {
            shared_libs: [
                "libbinder_ndk",
            ],
            static_libs: [
                "android.hardware.bluetooth@1.0",
                "android.hardware.bluetooth@1.1",
            ],
        },
        host: {
            static_libs: [
                "libbinder_ndk",
            ],
        },
    },
    header_libs: ["libbluetooth_headers"],
}

cc_test {
    name: "net_test_stack_rfcomm",
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    test_suites: ["general-tests"],
    host_supported: true,
    local_include_dirs: [
        "btm",
        "include",
        "l2cap",
        "rfcomm",
        "smp",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/gd/hal",
    ],
    srcs: [
        ":TestCommonMockFunctions",
        ":TestMockHci",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackMetrics",
        "rfcomm/port_api.cc",
        "rfcomm/port_rfc.cc",
        "rfcomm/port_utils.cc",
        "rfcomm/rfc_l2cap_if.cc",
        "rfcomm/rfc_mx_fsm.cc",
        "rfcomm/rfc_port_fsm.cc",
        "rfcomm/rfc_port_if.cc",
        "rfcomm/rfc_ts_frames.cc",
        "rfcomm/rfc_utils.cc",
        "test/common/mock_btm_layer.cc",
        "test/common/mock_btu_layer.cc",
        "test/common/mock_l2cap_layer.cc",
        "test/common/stack_test_packet_utils.cc",
        "test/rfcomm/stack_rfcomm_test.cc",
        "test/rfcomm/stack_rfcomm_test_main.cc",
        "test/rfcomm/stack_rfcomm_test_utils.cc",
        "test/rfcomm/stack_rfcomm_test_utils_test.cc",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    shared_libs: [
        "libcrypto",
        "libcutils",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_gd",
        "libbluetooth_hci_pdl",
        "libbluetooth_l2cap_pdl",
        "libbluetooth_log",
        "libbluetooth_smp_pdl",
        "libbt-btu-main-thread",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libevent",
        "libgmock",
        "liblog",
        "libosi",
        "libprotobuf-cpp-lite",
        "libstatslog_bt",
    ],
    target: {
        android: {
            shared_libs: [
                "libstatssocket",
            ],
        },
    },
    sanitize: {
        cfi: false,
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

// Bluetooth stack smp unit tests for target
cc_test {
    name: "net_test_stack_smp",
    defaults: [
        "bluetooth_flatbuffer_bundler_defaults",
        "fluoride_defaults",
        "mts_defaults",
    ],
    host_supported: true,
    test_suites: ["general-tests"],
    local_include_dirs: [
        "btm",
        "include",
        "l2cap",
        "smp",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/include",
    ],
    srcs: [
        ":TestCommonMainHandler",
        ":TestCommonMockFunctions",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackAcl",
        ":TestMockStackBtm",
        ":TestMockStackHcic",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        "smp/p_256_curvepara.cc",
        "smp/p_256_ecc_pp.cc",
        "smp/p_256_multprecision.cc",
        "smp/smp_act.cc",
        "smp/smp_api.cc",
        "smp/smp_br_main.cc",
        "smp/smp_keys.cc",
        "smp/smp_l2c.cc",
        "smp/smp_main.cc",
        "smp/smp_utils.cc",
        "test/stack_smp_test.cc",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    shared_libs: [
        "libcrypto",
        "libcutils",
        "server_configurable_flags",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_gd",
        "libbluetooth_hci_pdl",
        "libbluetooth_l2cap_pdl",
        "libbluetooth_log",
        "libbluetooth_smp_pdl",
        "libbt-btu-main-thread",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libevent",
        "libgmock",
        "liblog",
        "libosi",
        "libstatslog_bt",
    ],
    target: {
        android: {
            shared_libs: [
                "libstatssocket",
            ],
        },
    },
    //    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

// Bluetooth stack advertise data parsing unit tests for target
cc_test {
    name: "net_test_stack_ad_parser",
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    test_suites: ["general-tests"],
    local_include_dirs: [
        "include",
    ],
    srcs: [
        "test/ad_parser_unittest.cc",
    ],
    shared_libs: [
        "libbinder_ndk",
        "libcrypto",
    ],
    static_libs: [
        "android.system.suspend.control-V1-ndk",
        "libbluetooth-types",
        "libbluetooth_log",
        "libgmock",
        "liblog",
    ],
}

// Bluetooth stack connection multiplexing
cc_test {
    name: "net_test_gatt_conn_multiplexing",
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    host_supported: true,
    test_suites: ["general-tests"],
    local_include_dirs: [
        "btm",
        "include",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
    ],
    srcs: [
        ":TestCommonMainHandler",
        "gatt/connection_manager.cc",
        "test/common/mock_btm_api_layer.cc",
        "test/gatt_connection_manager_test.cc",
    ],
    shared_libs: [
        "libcutils",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libevent",
        "libgmock",
        "liblog",
    ],
    sanitize: {
        cfi: false,
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

cc_test {
    name: "net_test_stack_gatt_native",
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    test_suites: ["general-tests"],
    host_supported: true,
    test_options: {
        unit_test: true,
    },
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/btm",
        "packages/modules/Bluetooth/system/stack/eatt",
        "packages/modules/Bluetooth/system/stack/include",
        "packages/modules/Bluetooth/system/stack/l2cap",
    ],
    srcs: [
        ":TestCommonMockFunctions",
        ":TestMockRustFfi",
        ":TestMockStackArbiter",
        ":TestMockStackBtm",
        ":TestMockStackSdp",
        "gatt/gatt_utils.cc",
        "test/common/mock_eatt.cc",
        "test/common/mock_gatt_layer.cc",
        "test/gatt/gatt_sr_test.cc",
    ],
    shared_libs: [
        "libcrypto",
        "libcutils",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libevent",
        "libgmock",
        "liblog",
        "libosi",
        "libstatslog_bt",
    ],
    target: {
        android: {
            shared_libs: [
                "libstatssocket",
            ],
        },
    },
    sanitize: {
        address: true,
        cfi: true,
        misc_undefined: ["bounds"],
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

cc_test {
    name: "net_test_stack_avdtp",
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    test_suites: ["general-tests"],
    host_supported: true,
    test_options: {
        unit_test: true,
    },
    include_dirs: [
        "external/libldac/inc",
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/include",
    ],
    srcs: [
        ":TestCommonMockFunctions",
        ":TestMockBta",
        ":TestMockDevice",
        ":TestMockStackA2dp",
        ":TestMockStackAcl",
        ":TestMockStackL2cap",
        "avdt/avdt_ad.cc",
        "avdt/avdt_api.cc",
        "avdt/avdt_ccb.cc",
        "avdt/avdt_ccb_act.cc",
        "avdt/avdt_l2c.cc",
        "avdt/avdt_scb.cc",
        "avdt/avdt_scb_act.cc",
        "test/common/mock_btu_layer.cc",
        "test/common/mock_stack_avdt_msg.cc",
        "test/stack_avdtp_test.cc",
    ],
    shared_libs: [
        "libcrypto",
        "libcutils",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libevent",
        "liblog",
        "libosi",
        "libprotobuf-cpp-lite",
        "libstatslog_bt",
    ],
    target: {
        android: {
            shared_libs: ["libstatssocket"],
        },
    },
    sanitize: {
        address: true,
        cfi: true,
        misc_undefined: ["bounds"],
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

cc_test {
    name: "net_test_stack_a2dp_codecs_native",
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    cflags: [
        "-DUNIT_TESTS",
        "-Wno-unused-parameter",
    ],
    test_suites: ["general-tests"],
    host_supported: true,
    test_options: {
        unit_test: true,
    },
    include_dirs: [
        "external/aac/libAACdec/include",
        "external/aac/libAACenc/include",
        "external/aac/libSYS/include",
        "external/libldac/abr/inc",
        "external/libldac/inc",
        "external/libopus/include",
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/embdrv/encoder_for_aptxhd/include",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/include",
    ],
    target: {
        host: {
            srcs: [
                ":BluetoothHostTestingLogCapture",
            ],
        },
        android: {
            srcs: [
                ":BluetoothAndroidTestingLogCapture",
            ],
            test_config: "test/a2dp/AndroidTest.xml",
        },
        android_x86: {
            test_config: "test/a2dp/AndroidTestForce32.xml",
        },
    },
    data: [
        "test/a2dp/raw_data/*",
    ],
    srcs: [
        ":TestCommonMockFunctions",
        ":TestMockAudioHalInterface",
        ":TestMockBta",
        ":TestMockStackA2dpApi",
        "a2dp/a2dp_aac.cc",
        "a2dp/a2dp_aac_decoder.cc",
        "a2dp/a2dp_aac_encoder.cc",
        "a2dp/a2dp_codec_config.cc",
        "a2dp/a2dp_ext.cc",
        "a2dp/a2dp_sbc.cc",
        "a2dp/a2dp_sbc_decoder.cc",
        "a2dp/a2dp_sbc_encoder.cc",
        "a2dp/a2dp_sbc_up_sample.cc",
        "a2dp/a2dp_vendor.cc",
        "a2dp/a2dp_vendor_aptx.cc",
        "a2dp/a2dp_vendor_aptx_encoder.cc",
        "a2dp/a2dp_vendor_aptx_hd.cc",
        "a2dp/a2dp_vendor_aptx_hd_encoder.cc",
        "a2dp/a2dp_vendor_ldac.cc",
        "a2dp/a2dp_vendor_ldac_decoder.cc",
        "a2dp/a2dp_vendor_ldac_encoder.cc",
        "a2dp/a2dp_vendor_opus.cc",
        "a2dp/a2dp_vendor_opus_decoder.cc",
        "a2dp/a2dp_vendor_opus_encoder.cc",
        "test/a2dp/a2dp_aac_unittest.cc",
        "test/a2dp/a2dp_opus_unittest.cc",
        "test/a2dp/a2dp_sbc_regression_tests.cc",
        "test/a2dp/a2dp_sbc_unittest.cc",
        "test/a2dp/a2dp_vendor_ldac_unittest.cc",
        "test/a2dp/a2dp_vendor_regression_tests.cc",
        "test/a2dp/mock_bta_av_codec.cc",
        "test/a2dp/test_util.cc",
        "test/a2dp/wav_reader.cc",
        "test/a2dp/wav_reader_unittest.cc",
    ],
    shared_libs: [
        "libcrypto",
        "libcutils",
        "libprotobuf-cpp-lite",
    ],
    static_libs: [
        "libFraunhoferAAC",
        "libbase",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt-sbc-decoder",
        "libbt-sbc-encoder",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libgmock",
        "liblog",
        "libopus",
        "libosi",
    ],
    whole_static_libs: [
        "libaptx_enc",
        "libaptxhd_enc",
        "libldacBT_abr",
        "libldacBT_enc",
    ],
    sanitize: {
        address: true,
        cfi: true,
        misc_undefined: ["bounds"],
    },
    header_libs: ["libbluetooth_headers"],
}

cc_test {
    name: "net_test_stack_a2dp_native",
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    test_suites: ["general-tests"],
    host_supported: true,
    test_options: {
        unit_test: true,
    },
    include_dirs: [
        "external/libldac/inc",
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/include",
    ],
    srcs: [
        "a2dp/a2dp_vendor_ldac_decoder.cc",
        "test/a2dp/a2dp_vendor_ldac_decoder_test.cc",
        "test/a2dp/misc_fake.cc",
    ],
    shared_libs: [
        "libcrypto",
        "libcutils",
    ],
    static_libs: [
        "libbase",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_log",
        "libbt-common",
        "libbt_shim_bridge",
        "libchrome",
        "liblog",
        "libosi",
    ],
    sanitize: {
        address: true,
        cfi: true,
        misc_undefined: ["bounds"],
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

// gatt sr hash test
cc_test {
    name: "net_test_stack_gatt_sr_hash_native",
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    test_suites: ["general-tests"],
    host_supported: true,
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/btm",
        "packages/modules/Bluetooth/system/stack/eatt",
        "packages/modules/Bluetooth/system/stack/include",
    ],
    srcs: [
        ":LegacyStackSdp",
        ":TestCommonMainHandler",
        ":TestCommonMockFunctions",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockRustFfi",
        ":TestMockStackBtm",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        "gatt/gatt_db.cc",
        "gatt/gatt_sr_hash.cc",
        "gatt/gatt_utils.cc",
        "test/common/mock_eatt.cc",
        "test/common/mock_gatt_layer.cc",
        "test/gatt/mock_gatt_utils_ref.cc",
        "test/stack_gatt_sr_hash_test.cc",
    ],
    shared_libs: [
        "libcrypto",
        "libcutils",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libevent",
        "libgmock",
        "liblog",
        "libosi",
        "libstatslog_bt",
    ],
    target: {
        android: {
            shared_libs: ["libstatssocket"],
        },
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

// Iso manager unit tests
cc_test {
    name: "net_test_btm_iso",
    test_suites: ["general-tests"],
    host_supported: true,
    test_options: {
        unit_test: true,
    },
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    local_include_dirs: [
        "btm",
        "include",
        "test/common",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
    ],
    srcs: [
        ":BluetoothPacketSources",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        "btm/btm_iso.cc",
        "test/btm_iso_test.cc",
        "test/common/mock_controller.cc",
        "test/common/mock_gatt_layer.cc",
        "test/common/mock_hcic_layer.cc",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_hci_pdl",
        "libbluetooth_log",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libchrome",
        "libflatbuffers-cpp",
        "libgmock",
        "liblog",
        "libosi",
    ],
    sanitize: {
        cfi: true,
        scs: true,
        address: true,
        all_undefined: true,
        integer_overflow: true,
        diag: {
            undefined: true,
        },
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

// EATT unit tests
cc_test {
    name: "net_test_eatt",
    test_suites: ["general-tests"],
    host_supported: true,
    test_options: {
        unit_test: true,
    },
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    local_include_dirs: [
        "btm",
        "eatt",
        "gatt",
        "include",
        "l2cap",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
    ],
    srcs: [
        ":TestCommonMainHandler",
        ":TestCommonStackConfig",
        "eatt/eatt.cc",
        "test/common/mock_btif_storage.cc",
        "test/common/mock_btm_api_layer.cc",
        "test/common/mock_controller.cc",
        "test/common/mock_gatt_layer.cc",
        "test/common/mock_l2cap_layer.cc",
        "test/eatt/eatt_test.cc",
        "test/gatt/mock_gatt_utils_ref.cc",
    ],
    shared_libs: [
        "libcrypto",
        "libcutils",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libevent",
        "libgmock",
        "liblog",
        "libosi",
        "libprotobuf-cpp-lite",
        "libstatslog_bt",
    ],
    target: {
        android: {
            shared_libs: ["libstatssocket"],
        },
    },
    sanitize: {
        cfi: false,
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

cc_test {
    name: "net_test_stack_btm",
    test_suites: ["general-tests"],
    host_supported: true,
    test_options: {
        unit_test: true,
    },
    defaults: [
        "bluetooth_flatbuffer_bundler_defaults",
        "fluoride_defaults",
        "mts_defaults",
    ],
    local_include_dirs: [
        "btm",
        "include",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/device/include",
        "packages/modules/Bluetooth/system/gd",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        ":BluetoothHalSources_hci_host",
        ":BluetoothOsSources_host",
        ":OsiCompatSources",
        ":TestCommonMainHandler",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestFakeLooper",
        ":TestFakeThread",
        ":TestMockBta",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockLegacyHciInterface",
        ":TestMockMainBte",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockRustFfi",
        ":TestMockStackBtu",
        ":TestMockStackGap",
        ":TestMockStackGatt",
        ":TestMockStackHcic",
        ":TestMockStackL2cap",
        ":TestMockStackSmp",
        ":TestMockUdrv",
        "acl/acl.cc",
        "acl/ble_acl.cc",
        "acl/btm_acl.cc",
        "acl/btm_pm.cc",
        "btm/ble_scanner_hci_interface.cc",
        "btm/btm_ble.cc",
        "btm/btm_ble_addr.cc",
        "btm/btm_ble_adv_filter.cc",
        "btm/btm_ble_bgconn.cc",
        "btm/btm_ble_cont_energy.cc",
        "btm/btm_ble_gap.cc",
        "btm/btm_ble_privacy.cc",
        "btm/btm_ble_scanner.cc",
        "btm/btm_ble_sec.cc",
        "btm/btm_client_interface.cc",
        "btm/btm_dev.cc",
        "btm/btm_devctl.cc",
        "btm/btm_inq.cc",
        "btm/btm_iot_config.cc",
        "btm/btm_iso.cc",
        "btm/btm_main.cc",
        "btm/btm_sco.cc",
        "btm/btm_sco_hci.cc",
        "btm/btm_sco_hfp_hal.cc",
        "btm/btm_sec.cc",
        "btm/btm_sec_cb.cc",
        "btm/btm_security_client_interface.cc",
        "btm/hfp_lc3_decoder.cc",
        "btm/hfp_lc3_encoder.cc",
        "btm/hfp_msbc_decoder.cc",
        "btm/hfp_msbc_encoder.cc",
        "btm/security_event_parser.cc",
        "metrics/stack_metrics_logging.cc",
        "test/btm/peer_packet_types_test.cc",
        "test/btm/sco_hci_test.cc",
        "test/btm/sco_pkt_status_test.cc",
        "test/btm/stack_btm_dev_test.cc",
        "test/btm/stack_btm_power_mode_test.cc",
        "test/btm/stack_btm_regression_tests.cc",
        "test/btm/stack_btm_sec_test.cc",
        "test/btm/stack_btm_test.cc",
        "test/common/mock_eatt.cc",
        "test/stack_include_test.cc",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt-sbc-decoder",
        "libbt-sbc-encoder",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libbtdevice",
        "libchrome",
        "libcom.android.sysprop.bluetooth.wrapped",
        "libevent",
        "libgmock",
        "liblc3",
        "liblog",
        "libosi",
        "libprotobuf-cpp-lite",
        "libudrv-uipc",
    ],
    shared_libs: [
        "libcrypto",
        "server_configurable_flags",
    ],
    sanitize: {
        address: true,
        all_undefined: true,
        cfi: true,
        integer_overflow: true,
        scs: true,
        diag: {
            undefined: true,
        },
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

cc_test {
    name: "net_test_stack_hci",
    test_suites: ["general-tests"],
    host_supported: true,
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    local_include_dirs: [
        "btm",
        "include",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
    ],
    srcs: [
        ":TestCommonMockFunctions",
        "test/hci/stack_hci_test.cc",
    ],
    static_libs: [
        "libbluetooth_crypto_toolbox",
        "libbluetooth_log",
        "libbt-common",
        "libbt_shim_bridge",
        "libbtdevice",
        "libbte",
        "libchrome",
        "libgmock",
        "liblog",
        "libosi",
    ],
    shared_libs: [
        "libcrypto",
    ],
    sanitize: {
        address: true,
        all_undefined: true,
        cfi: true,
        integer_overflow: true,
        scs: true,
        diag: {
            undefined: true,
        },
    },
    header_libs: ["libbluetooth_headers"],
}

cc_test {
    name: "net_test_stack_hid",
    test_suites: ["general-tests"],
    host_supported: true,
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    local_include_dirs: [
        "include",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    srcs: [
        ":TestCommonMockFunctions",
        ":TestMockStackBtm",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        ":TestMockStackSdp",
        "hid/hidd_api.cc",
        "hid/hidd_conn.cc",
        "hid/hidh_api.cc",
        "hid/hidh_conn.cc",
        "test/hid/stack_hid_test.cc",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_log",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libbtdevice",
        "libbte",
        "libchrome",
        "libevent",
        "libgmock",
        "liblog",
        "libosi",
        "libprotobuf-cpp-lite",
    ],
    shared_libs: [
        "libcrypto",
    ],
    target: {
        android: {
            shared_libs: ["libstatssocket"],
        },
    },
    sanitize: {
        address: true,
        all_undefined: true,
        cfi: true,
        integer_overflow: true,
        scs: true,
        diag: {
            undefined: true,
        },
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

cc_test {
    name: "net_test_stack_btu",
    test_suites: ["general-tests"],
    host_supported: true,
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    local_include_dirs: [
        "include",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        ":TestCommonMockFunctions",
        ":TestMockBta",
        ":TestMockBtif",
        ":TestMockHci",
        ":TestMockLegacyHciCommands",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackAcl",
        ":TestMockStackBtm",
        ":TestMockStackHcic",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        ":TestMockStackSmp",
        "btu/btu_event.cc",
        "btu/btu_hcif.cc",
        "btu/main_thread.cc",
        "test/stack_btu_test.cc",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libbtdevice",
        "libchrome",
        "libevent",
        "libgmock",
        "liblog",
        "libosi",
    ],
    shared_libs: [
        "libbinder_ndk",
        "libcrypto",
    ],
    sanitize: {
        address: true,
        all_undefined: true,
        cfi: true,
        integer_overflow: true,
        scs: true,
        diag: {
            undefined: true,
        },
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

cc_test {
    name: "net_test_stack_gatt",
    test_suites: ["general-tests"],
    host_supported: true,
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    local_include_dirs: [
        "include",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        ":OsiCompatSources",
        ":TestCommonMainHandler",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestMockBta",
        ":TestMockBtif",
        ":TestMockHci",
        ":TestMockLegacyHciCommands",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockRustFfi",
        ":TestMockSrvcDis",
        ":TestMockStackAcl",
        ":TestMockStackBtm",
        ":TestMockStackL2cap",
        ":TestMockStackSdp",
        ":TestMockStackSmp",
        "arbiter/acl_arbiter.cc",
        "eatt/eatt.cc",
        "gatt/att_protocol.cc",
        "gatt/connection_manager.cc",
        "gatt/gatt_api.cc",
        "gatt/gatt_attr.cc",
        "gatt/gatt_auth.cc",
        "gatt/gatt_cl.cc",
        "gatt/gatt_db.cc",
        "gatt/gatt_main.cc",
        "gatt/gatt_sr.cc",
        "gatt/gatt_sr_hash.cc",
        "gatt/gatt_utils.cc",
        "test/gatt/stack_gatt_test.cc",
    ],
    static_libs: [
        "bluetooth_flags_c_lib",
        "libbase",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libbtdevice",
        "libchrome",
        "libevent",
        "libflagtest",
        "libgmock",
        "liblog",
        "libosi",
        "libprotobuf-cpp-lite",
        "libstatslog_bt",
    ],
    shared_libs: [
        "libbase",
        "libbinder_ndk",
        "libcrypto",
        "libcutils",
        "server_configurable_flags",
    ],
    target: {
        android: {
            shared_libs: ["libstatssocket"],
        },
    },
    sanitize: {
        address: true,
        all_undefined: true,
        cfi: true,
        integer_overflow: true,
        scs: true,
        diag: {
            undefined: true,
        },
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

cc_test {
    name: "net_test_stack_l2cap",
    test_suites: ["general-tests"],
    host_supported: true,
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    local_include_dirs: [
        "include",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        ":OsiCompatSources",
        ":TestCommonMainHandler",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestMockBta",
        ":TestMockBtif",
        ":TestMockHci",
        ":TestMockJni",
        ":TestMockLegacyHciCommands",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackAcl",
        ":TestMockStackBtm",
        ":TestMockStackHcic",
        ":TestMockStackSdp",
        ":TestMockStackSmp",
        "l2cap/l2c_api.cc",
        "l2cap/l2c_ble.cc",
        "l2cap/l2c_ble_conn_params.cc",
        "l2cap/l2c_csm.cc",
        "l2cap/l2c_fcr.cc",
        "l2cap/l2c_link.cc",
        "l2cap/l2c_main.cc",
        "l2cap/l2c_utils.cc",
        "test/stack_l2cap_test.cc",
    ],
    static_libs: [
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libbtdevice",
        "libchrome",
        "libevent",
        "libgmock",
        "liblog",
        "libosi",
        "libprotobuf-cpp-lite",
        "libstatslog_bt",
    ],
    shared_libs: [
        "libbase",
        "libbinder_ndk",
        "libcrypto",
        "libcutils",
        "server_configurable_flags",
    ],
    target: {
        android: {
            shared_libs: [
                "libPlatformProperties",
                "libstatssocket",
            ],
        },
    },
    sanitize: {
        address: true,
        all_undefined: true,
        cfi: true,
        integer_overflow: true,
        scs: true,
        diag: {
            undefined: true,
        },
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

cc_test {
    name: "net_test_stack_acl",
    test_suites: ["general-tests"],
    host_supported: true,
    defaults: [
        "bluetooth_flatbuffer_bundler_defaults",
        "fluoride_defaults",
        "mts_defaults",
    ],
    local_include_dirs: [
        "include",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
        ":OsiCompatSources",
        ":TestCommonMainHandler",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestMockBta",
        ":TestMockBtif",
        ":TestMockDevice",
        ":TestMockHci",
        ":TestMockLegacyHciCommands",
        ":TestMockLegacyHciInterface",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockRustFfi",
        ":TestMockStackBtm",
        ":TestMockStackBtu",
        ":TestMockStackGatt",
        ":TestMockStackHcic",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        ":TestMockStackSdp",
        ":TestMockStackSmp",
        "acl/*.cc",
        "btm/btm_iot_config.cc",
        "test/stack_acl_test.cc",
    ],
    static_libs: [
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libbtdevice",
        "libchrome",
        "libcutils",
        "libevent",
        "libgmock",
        "liblog",
        "libosi",
        "libstatslog_bt",
    ],
    shared_libs: [
        "libbase",
        "libbinder_ndk",
        "libcrypto",
        "server_configurable_flags",
    ],
    target: {
        android: {
            shared_libs: ["libstatssocket"],
        },
    },
    sanitize: {
        address: true,
        all_undefined: true,
        cfi: true,
        integer_overflow: true,
        scs: true,
        diag: {
            undefined: true,
        },
    },
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}

// Bluetooth stack connection multiplexing
cc_test {
    name: "net_test_stack_sdp",
    test_suites: ["general-tests"],
    host_supported: true,
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    local_include_dirs: [
        "include",
        "test/common",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/device/include/",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/stack/btm",
    ],
    srcs: [
        ":LegacyStackSdp",
        ":TestCommonMockFunctions",
        ":TestMockBtif",
        ":TestMockOsi",
        ":TestMockStackBtm",
        ":TestMockStackL2cap",
        ":TestMockStackMetrics",
        "test/sdp/stack_sdp_test.cc",
        "test/sdp/stack_sdp_utils_test.cc",
    ],
    shared_libs: [
        "libcutils",
    ],
    static_libs: [
        "libbase",
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_log",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libgmock",
        "liblog",
    ],
    header_libs: ["libbluetooth_headers"],
    cflags: ["-Wno-unused-parameter"],
}