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_defaults { name: "gd_defaults", defaults: [ "bluetooth_cflags", "bluetooth_tidy", ], target: { android: { test_config_template: "AndroidTestTemplate.xml", shared_libs: [ "liblog", ], sanitize: { misc_undefined: ["bounds"], }, }, darwin: { enabled: false, }, }, cflags: [ "-DEXPORT_SYMBOL=__attribute__((visibility(\"default\")))", "-DGOOGLE_PROTOBUF_NO_RTTI", "-DLOG_NDEBUG=0", "-fvisibility=hidden", ], header_libs: ["jni_headers"], } soong_config_module_type { name: "mgmt_cc_defaults", module_type: "cc_defaults", config_namespace: "mgmt", variables: ["vertical"], properties: ["srcs"], } soong_config_string_variable { name: "vertical", values: [ "android_default", "android_desktop", ], } mgmt_cc_defaults { name: "mgmt_defaults", soong_config_variables: { vertical: { android_desktop: { srcs: [":BluetoothOsSources_mgmt_linux"], }, android_default: { srcs: [":BluetoothOsSources_mgmt"], }, conditions_default: { srcs: [":BluetoothOsSources_mgmt"], }, }, }, } cc_defaults { name: "libbluetooth_gd_defaults", defaults: [ "gd_defaults", "mgmt_defaults", ], host_supported: true, target: { linux: { srcs: [ ":BluetoothOsSources_linux_generic", ], }, host: { srcs: [ ":BluetoothHalSources_hci_host", ":BluetoothHalSources_ranging_host", ":BluetoothHalSources_socket_host", ":BluetoothOsSources_host", ":BluetoothSyspropsSources", ], }, android: { srcs: [ ":BluetoothHalSources_hci_android_hidl", ":BluetoothHalSources_ranging_android", ":BluetoothHalSources_socket_android", ":BluetoothOsSources_android", ], shared_libs: [ "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", "android.system.suspend-V1-ndk", "android.system.suspend.control-V1-ndk", "libbinder_ndk", "libcutils", "libhidlbase", "libstatslog_bt", "libstatssocket", "libutils", ], static_libs: [ "libexpresslog", "libstatslog_express", "libtextclassifier_hash_static", ], whole_static_libs: [ "android.hardware.bluetooth-V1-ndk", "android.hardware.bluetooth.ranging-V2-ndk", "android.hardware.bluetooth.socket-V1-ndk", "android.hardware.contexthub-V4-ndk", ], }, }, srcs: [ ":BluetoothCommonSources", ":BluetoothHalSources", ":BluetoothHciSources", ":BluetoothLppOffloadSources", ":BluetoothMetricsSources", ":BluetoothNeighborSources", ":BluetoothOsSources", ":BluetoothPacketSources", ":BluetoothShimSources", ":BluetoothStorageSources", "module.cc", "stack_manager.cc", ], shared_libs: [ "libcrypto", "libflatbuffers-cpp", "liblog", ], export_shared_lib_headers: [ "libflatbuffers-cpp", ], whole_static_libs: [ "libbluetooth_hci_pdl", "libbluetooth_l2cap_pdl", "libbluetooth_ras_pdl", "libbluetooth_smp_pdl", ], static_libs: [ "libaconfig_storage_read_api_cc", "libbase", "libbluetooth-protos", "libbluetooth-types", "libbluetooth_crypto_toolbox", "libbluetooth_log", "libbt-common", "libbt-platform-protos-lite", "libcom.android.sysprop.bluetooth.wrapped", "libosi", "server_configurable_flags", ], include_dirs: [ "packages/modules/Bluetooth/system/include", "packages/modules/Bluetooth/system/stack/include", ], } cc_library_static { name: "libbluetooth_gd", defaults: [ "libbluetooth_gd_defaults", ], include_dirs: [ "packages/modules/Bluetooth/system", ], apex_available: [ "com.android.btservices", ], min_sdk_version: "31", static_libs: [ "bluetooth_flags_c_lib", "libchrome", ], } cc_library_static { name: "libbluetooth_gd_fuzzing", defaults: [ "libbluetooth_gd_defaults", ], include_dirs: [ "packages/modules/Bluetooth/system", ], srcs: [ ":BluetoothOsSources_fake_timer", ], cflags: [ "-DFUZZ_TARGET", "-DUSE_FAKE_TIMERS", ], static_libs: [ "bluetooth_flags_c_lib", "libbluetooth-types", "libbt-common", "libchrome", "libosi", ], } cc_library_static { name: "libbluetooth_gd_unit_tests", defaults: [ "libbluetooth_gd_defaults", ], include_dirs: [ "packages/modules/Bluetooth/system", ], srcs: [ ":BluetoothOsSources_fake_timer", ], cflags: [ "-DUSE_FAKE_TIMERS", ], static_libs: [ "bluetooth_flags_c_lib_for_test", "libbluetooth-types", "libbt-common", "libchrome", "libosi", ], } cc_binary { name: "bluetooth_stack_with_facade", defaults: [ "gd_defaults", ], cflags: [ // The generated gRPC code triggers these warnings. "-Wno-missing-prototypes", ], include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/include", ], host_supported: true, srcs: [ ":BluetoothFacade_hci_hal", ":BluetoothFacade_hci_layer", ":BluetoothFacade_neighbor", ":TestCommonMockFunctions", ":TestMockMainShimStack", ":TestMockStackMetrics", "facade/facade_main.cc", "facade/grpc_root_server.cc", "facade/read_only_property_server.cc", "grpc/grpc_module.cc", ], generated_headers: [ "BlueberryFacadeGeneratedStub_h", ], generated_sources: [ "BlueberryFacadeGeneratedStub_cc", ], static_libs: [ "bluetooth_flags_c_lib", "breakpad_client", "libPlatformProperties", "libbluetooth-protos", "libbluetooth-types", "libbluetooth_crypto_toolbox", "libbluetooth_gd", "libbluetooth_hci_pdl", "libbluetooth_l2cap_pdl", "libbluetooth_log", "libbluetooth_ras_pdl", "libbluetooth_smp_pdl", "libbt-common", "libbt-platform-protos-lite", "libchrome", "libcom.android.sysprop.bluetooth.wrapped", "libflatbuffers-cpp", "libosi", ], shared_libs: [ "libaconfig_storage_read_api_cc", "libbase", "libcrypto", "libgrpc++", "libgrpc_wrap", "liblog", "libprotobuf-cpp-full", "libunwindstack", "server_configurable_flags", ], target: { android: { shared_libs: [ "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", "libbinder_ndk", "libcutils", "libhidlbase", "libstatssocket", "libutils", ], static_libs: [ "android.system.suspend-V1-ndk", "android.system.suspend.control-V1-ndk", "libstatslog_bt", ], }, host: { required: [ "root-canal", ], }, }, sanitize: { address: true, cfi: true, }, } cc_test { name: "bluetooth_test_with_timerfd", test_suites: ["general-tests"], defaults: [ "gd_defaults", "mts_defaults", ], include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/include", ], host_supported: true, target: { host: { srcs: [ ":BluetoothOsSystemProperties_host", ], }, android: { srcs: [ ":BluetoothOsSystemProperties_android", ], }, }, srcs: [ ":BluetoothOsTestSources_timerfd", ], static_libs: [ "bluetooth_flags_c_lib_for_test", "libbluetooth_log", "libchrome", "libgmock", "server_configurable_flags", ], shared_libs: [ "libbase", "liblog", ], sanitize: { address: true, }, min_sdk_version: "Tiramisu", } cc_test { name: "bluetooth_test_gd_unit", test_suites: ["general-tests"], defaults: [ "gd_defaults", "mts_defaults", ], include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/include", ], host_supported: true, // TODO(b/231993739): Reenable isolated:true by deleting the explicit disable below isolated: false, target: { linux: { srcs: [ ":BluetoothOsTestSources_linux_generic", ], }, host: { srcs: [ ":BluetoothHalTestSources_hci_host", ":BluetoothOsTestSources_host", ":BluetoothSyspropsUnitTestSources", ], }, android: { srcs: [ ":BluetoothOsTestSources_android", ], static_libs: [ "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", "android.system.suspend-V1-ndk", "android.system.suspend.control-V1-ndk", "libstatslog_bt", ], shared_libs: [ "libbinder_ndk", "libcutils", "libhidlbase", "libstatssocket", "libutils", ], }, }, srcs: [ ":BluetoothCommonTestSources", ":BluetoothCryptoToolboxTestSources", ":BluetoothHalTestSources", ":BluetoothHciUnitTestSources", ":BluetoothMetricsTestSources", ":BluetoothOsTestSources", ":BluetoothPacketTestSources", ":BluetoothStorageUnitTestSources", ":TestCommonMockFunctions", ":TestMockStackMetrics", "module_unittest.cc", "stack_manager_unittest.cc", ], static_libs: [ "bluetooth_flags_c_lib_for_test", "libbase", "libbluetooth-protos", "libbluetooth-types", "libbluetooth_crypto_toolbox", "libbluetooth_gd_unit_tests", "libbluetooth_hci_pdl", "libbluetooth_l2cap_pdl", "libbluetooth_log", "libbluetooth_ras_pdl", "libbluetooth_smp_pdl", "libbt-common", "libbt-platform-protos-lite", "libchrome", "libcom.android.sysprop.bluetooth.wrapped", "libflagtest", "libflatbuffers-cpp", "libgmock", "libosi", "server_configurable_flags", ], shared_libs: [ "libPlatformProperties", "libaconfig_storage_read_api_cc", "libcrypto", ], sanitize: { address: true, }, min_sdk_version: "Tiramisu", } cc_test { name: "bluetooth_packet_parser_test", test_suites: ["general-tests"], defaults: [ "gd_defaults", "mts_defaults", ], include_dirs: ["packages/modules/Bluetooth/system/gd"], host_supported: true, test_options: { unit_test: true, }, srcs: [ ":BluetoothPacketParserTestPacketTestSources", ":BluetoothPacketSources", ], generated_headers: [ "BluetoothPacketParserTestPacketPdlGen_h", ], sanitize: { address: true, cfi: true, }, static_libs: [ "libbase", "libbluetooth_log", "liblog", ], target: { android: { shared_libs: [ "libcutils", "libhidlbase", "libutils", ], }, host_linux: { shared_libs: [ "libcutils", "libhidlbase", "libutils", ], }, }, min_sdk_version: "30", } cc_defaults { name: "gd_fuzz_defaults", defaults: ["gd_defaults"], srcs: [ ":BluetoothFuzzHelperSources", ":BluetoothHciFuzzHelperSources", ], static_libs: [ "bluetooth_flags_c_lib", "libbluetooth-protos", "libbluetooth-types", "libbluetooth_crypto_toolbox", "libbluetooth_gd_fuzzing", "libbluetooth_log", "libbt-common", "libchrome", "libcom.android.sysprop.bluetooth.wrapped", "libgmock", "libgtest", "libosi", ], host_supported: true, shared_libs: [ "libPlatformProperties", "libaconfig_storage_read_api_cc", "libbase", "libcrypto", "libgrpc++", "libgrpc_wrap", "liblog", "server_configurable_flags", ], cflags: [ "-DFUZZ_TARGET", "-DUSE_FAKE_TIMERS", ], target: { android: { shared_libs: [ "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", "android.system.suspend.control-V1-ndk", "libbinder_ndk", "libcutils", "libhidlbase", "libstatslog_bt", "libutils", ], }, }, } cc_fuzz { name: "bluetooth_gd_fuzz_test", defaults: ["gd_fuzz_defaults"], srcs: [ ":BluetoothHciFuzzTestSources", "fuzz_test.cc", ], fuzz_config: { cc: ["android-bluetooth-security@google.com"], componentid: 27441, }, } cc_fuzz { name: "bluetooth_gd_hci_layer_fuzz_test", defaults: ["gd_fuzz_defaults"], srcs: [ ":BluetoothHalFuzzSources", "hci/fuzz/hci_layer_fuzz_test.cc", ], } cc_fuzz { name: "bluetooth_gd_acl_manager_fuzz_test", defaults: ["gd_fuzz_defaults"], srcs: [ ":TestCommonMockFunctions", ":TestMockStackMetrics", "hci/fuzz/acl_manager_fuzz_test.cc", ], include_dirs: [ "packages/modules/Bluetooth/system", ], static_libs: [ "libbt-platform-protos-lite", ], fuzz_config: { cc: ["android-bluetooth-security@google.com"], componentid: 27441, }, } cc_benchmark { name: "bluetooth_benchmark_gd", defaults: [ "aconfig_lib_cc_shared_link.defaults", "gd_defaults", ], host_supported: true, srcs: [ ":BluetoothOsBenchmarkSources", "benchmark.cc", ], static_libs: [ "bluetooth_flags_c_lib", "libbase", "libbluetooth_gd", "libbluetooth_log", "libchrome", "liblog", "server_configurable_flags", ], }