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 default_applicable_licenses: ["system_bt_license"], } subdirs = [ "common", ] cc_defaults { name: "fluoride_service_defaults", defaults: ["fluoride_defaults"], include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/gd", ], header_libs: ["libbluetooth_headers"], } // Source variables btserviceDaemonSrc = [ "a2dp_sink.cc", "a2dp_source.cc", "adapter.cc", "avrcp_control.cc", "avrcp_target.cc", "daemon.cc", "gatt_client.cc", "gatt_server.cc", "gatt_server_old.cc", "hal/bluetooth_av_interface.cc", "hal/bluetooth_avrcp_interface.cc", "hal/bluetooth_gatt_interface.cc", "hal/bluetooth_interface.cc", "ipc/ipc_handler.cc", "ipc/ipc_manager.cc", "logging_helpers.cc", "low_energy_advertiser.cc", "low_energy_scanner.cc", "low_energy_client.cc", "settings.cc", ] btserviceLinuxSrc = [ "ipc/ipc_handler_linux.cc", "ipc/linux_ipc_host.cc", ] btserviceBinderDaemonSrc = [ "ipc/binder/bluetooth_a2dp_sink_binder_server.cc", "ipc/binder/bluetooth_a2dp_source_binder_server.cc", "ipc/binder/bluetooth_avrcp_control_binder_server.cc", "ipc/binder/bluetooth_avrcp_target_binder_server.cc", "ipc/binder/bluetooth_binder_server.cc", "ipc/binder/bluetooth_gatt_client_binder_server.cc", "ipc/binder/bluetooth_gatt_server_binder_server.cc", "ipc/binder/bluetooth_le_advertiser_binder_server.cc", "ipc/binder/bluetooth_le_scanner_binder_server.cc", "ipc/binder/bluetooth_low_energy_binder_server.cc", "ipc/binder/interface_with_instances_base.cc", "ipc/binder/ipc_handler_binder.cc", ] // Main unit test sources. These get built for host and target. btserviceBaseTestSrc = [ "hal/fake_bluetooth_av_interface.cc", "hal/fake_bluetooth_gatt_interface.cc", "hal/fake_bluetooth_interface.cc", "test/a2dp_sink_unittest.cc", "test/a2dp_source_unittest.cc", "test/adapter_unittest.cc", "test/advertise_data_unittest.cc", "test/fake_hal_util.cc", "test/gatt_client_unittest.cc", "test/gatt_server_unittest.cc", "test/low_energy_advertiser_unittest.cc", "test/low_energy_client_unittest.cc", "test/low_energy_scanner_unittest.cc", "test/settings_unittest.cc", ] // Native system service for target cc_binary { name: "bluetoothtbd", defaults: ["fluoride_service_defaults"], srcs: btserviceBinderDaemonSrc + btserviceLinuxSrc + btserviceDaemonSrc + ["main.cc"], static_libs: [ "avrcp-target-service", "libaudio-a2dp-hw-utils", "libbluetooth-binder-common", "libbluetooth-dumpsys", "libbluetooth-types", "libbt-audio-hal-interface", "libbt-bta", "libbt-common", "libbtcore", "libbtdevice", "libbte", "libbt-hci", "libbtif", "lib-bt-packets", "lib-bt-packets-avrcp", "lib-bt-packets-base", "libbt-protos-lite", "libbt-sbc-decoder", "libbt-sbc-encoder", "libbt-stack", "libbt-utils", "libc++fs", "libchrome", "libflatbuffers-cpp", "libFraunhoferAAC", "libg722codec", "liblc3", "libopus", "libosi", "libudrv-uipc", ], shared_libs: [ "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", "android.hardware.bluetooth.a2dp@1.0", "android.hardware.bluetooth.audio@2.0", "android.hardware.bluetooth.audio@2.1", "android.system.suspend.control-V1-ndk", "android.system.suspend-V1-ndk", "libaaudio", "libbinder", "libbinder_ndk", "libcrypto", "libcutils", "libfmq", "liblog", "libprocessgroup", "libprotobuf-cpp-lite", "libutils", ], init_rc: ["bluetoothtbd.rc"], target: { android: { shared_libs: [ "android.hardware.bluetooth.audio-V2-ndk", ], }, }, } // Native system service unit tests for target and host cc_test { name: "bluetoothtbd_test", test_suites: ["device-tests"], defaults: [ "fluoride_service_defaults", "mts_defaults", ], srcs: btserviceBaseTestSrc + btserviceDaemonSrc + [ "test/main.cc", ], aidl: { include_dirs: [ "packages/modules/Bluetooth/system/service/common", "frameworks/native/aidl/binder", ], }, static_libs: [ "android.hardware.bluetooth.a2dp@1.0", "avrcp-target-service", "libaudio-a2dp-hw-utils", "libbluetooth-common", "libbluetooth-dumpsys", "libbluetooth-types", "libbt-audio-hal-interface", "libbt-bta", "libbt-common", "libbtcore", "libbtdevice", "libbte", "libbt-hci", "libbtif", "lib-bt-packets", "lib-bt-packets-avrcp", "lib-bt-packets-base", "libbt-protos-lite", "libbt-sbc-decoder", "libbt-sbc-encoder", "libbt-stack", "libbt-utils", "libc++fs", "libchrome", "libgmock", "liblog", "libflatbuffers-cpp", "libFraunhoferAAC", "libg722codec", "liblc3", "libopus", "libosi", "libudrv-uipc", ], shared_libs: [ "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", "android.hardware.bluetooth.audio@2.0", "android.hardware.bluetooth.audio@2.1", "libbinder_ndk", "libcrypto", "libfmq", "libprocessgroup", "libprotobuf-cpp-lite", ], host_supported: true, test_options: { unit_test: true, }, target: { // This includes Binder related tests that can only be run // on target. android: { srcs: btserviceBinderDaemonSrc + [ "test/parcelable_unittest.cc", "test/ParcelableTest.aidl", ], static_libs: [ "android.system.suspend.control-V1-ndk", "libbluetooth-binder-common", ], shared_libs: [ "android.hardware.bluetooth.audio-V2-ndk", "android.system.suspend-V1-ndk", "libbinder", "libvndksupport", ], }, host: { srcs: [ "test/stub_ipc_handler_binder.cc", ], }, host_linux: { srcs: btserviceLinuxSrc + [ // TODO(bcf): Fix this test. //"test/ipc_linux_unittest.cc", ], }, }, sanitize: { cfi: false, }, } // Native system service CLI for target cc_binary { name: "bluetooth-cli", defaults: ["fluoride_defaults"], srcs: ["client/main.cc"], static_libs: [ "libbluetooth-binder-common", ], shared_libs: [ "libbinder", "libutils", ], } // Heart Rate GATT service example for target cc_binary { name: "bt-example-hr-server", defaults: ["fluoride_defaults"], local_include_dirs: ["example/heart_rate"], srcs: [ "example/heart_rate/heart_rate_server.cc", "example/heart_rate/server_main.cc", ], static_libs: [ "libbluetooth-binder-common", ], shared_libs: [ "libbinder", "libutils", ], } cc_library_static { name: "libbluetoothtbd_hal", defaults: ["fluoride_defaults"], include_dirs: ["packages/modules/Bluetooth/system"], header_libs: ["libbluetooth_headers"], srcs: [ "hal/bluetooth_gatt_interface.cc", "hal/bluetooth_interface.cc", "logging_helpers.cc", ], }