blob: 7abc269616c9e66d236bccefa778a5d1cb9504e6 [file]
//
// Copyright 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ################################################################################
// # Defaults
// ################################################################################
cc_defaults {
name: "libbluetooth_hal_defaults",
srcs: [
":hal_common_srcs",
":hal_config_srcs",
":hal_debug_srcs",
":hal_extension_srcs",
":hal_hwinit_srcs",
":hal_transport_srcs",
":hal_util_srcs",
":hal_bqr_srcs",
],
cflags: [
"-Wall",
"-Werror",
],
include_dirs: [
"hardware/interfaces/bluetooth/bluetooth_hal/include/public/",
],
header_libs: [
"libeigen",
],
whole_static_libs: [
"hal_proto_lib",
"libbluetooth_hal_flags_c_lib",
],
static_libs: [
"libbluetooth_offload_hal",
],
shared_libs: [
"libbase",
"libbinder_ndk",
"libcutils",
"libhardware_legacy",
"libutils",
"libprotobuf-cpp-full",
"server_configurable_flags",
"libaconfig_storage_read_api_cc",
"liblog",
"android.hardware.bluetooth-V1-ndk",
"android.hardware.bluetooth.finder-V1-ndk",
],
conlyflags: [
"-std=c99",
],
}
cc_defaults {
name: "libbluetooth_hal_extension_defaults",
cflags: [
"-Wall",
"-Werror",
],
local_include_dirs: ["include/public/"],
shared_libs: [
"libbase",
"libbinder_ndk",
"libcutils",
"libhardware_legacy",
"libutils",
],
conlyflags: [
"-std=c99",
],
}
// ################################################################################
// # FileGroups
// ################################################################################
filegroup {
name: "hal_common_srcs",
srcs: [
"bluetooth_hal.cc",
"bluetooth_hci.cc",
"hci_router.cc",
"hci_router_interface.cc",
"hci_router_async.cc",
"hci_router_client.cc",
"hci_router_client_agent.cc",
"hci_proxy_aidl.cc",
"hci_proxy_ffi.cc",
],
}
filegroup {
name: "hal_config_srcs",
srcs: [
"config/cs_config_loader.cc",
"config/firmware_config_loader.cc",
"config/hal_config_loader.cc",
],
}
filegroup {
name: "hal_debug_srcs",
srcs: [
"debug/bluetooth_activities.cc",
"debug/debug_central.cc",
"debug/debug_client.cc",
"debug/debug_monitor.cc",
"debug/stack_trace_helper.cc",
"debug/vnd_snoop_logger.cc",
"debug/debug_event_watcher.cc",
],
}
filegroup {
name: "hal_bqr_srcs",
srcs: [
"bqr/bqr_handler.cc",
"bqr/bqr_event.cc",
"bqr/bqr_link_quality_event.cc",
"bqr/bqr_link_quality_event_v1_to_v3.cc",
"bqr/bqr_link_quality_event_v4.cc",
"bqr/bqr_link_quality_event_v5.cc",
"bqr/bqr_link_quality_event_v6.cc",
"bqr/bqr_link_quality_event_v7.cc",
"bqr/bqr_root_inflammation_event.cc",
"bqr/bqr_advance_rf_stats_event.cc",
"bqr/bqr_advance_rf_stats_event_v7.cc",
"bqr/bqr_energy_monitoring_event.cc",
"bqr/bqr_energy_monitoring_event_v6.cc",
"bqr/bqr_energy_monitoring_event_v7.cc",
],
}
filegroup {
name: "hal_extension_srcs",
srcs: [
"extensions/channel_avoidance/bluetooth_channel_avoidance_handler.cc",
"extensions/ext/bluetooth_ext_handler.cc",
"extensions/finder/bluetooth_finder_handler.cc",
"extensions/sar/bluetooth_sar_handler.cc",
"extensions/thread/socket_processor.cc",
"extensions/thread/thread_daemon.cc",
"extensions/thread/thread_handler.cc",
"extensions/ccc/bluetooth_ccc_handler.cc",
"extensions/ccc/bluetooth_ccc_timesync_event.cc",
"extensions/ccc/bluetooth_ccc_timesync_command.cc",
],
}
filegroup {
name: "hal_ranging_common_srcs",
srcs: [
"extensions/cs/bluetooth_channel_sounding_handler.cc",
"extensions/cs/bluetooth_channel_sounding_util.cc",
"extensions/cs/bluetooth_channel_sounding_distance_estimator.cc",
],
}
filegroup {
name: "hal_ranging_v1_srcs",
srcs: [
"extensions/cs/bluetooth_channel_sounding_v1.cc",
"extensions/cs/bluetooth_channel_sounding_session_v1.cc",
],
}
filegroup {
name: "hal_ranging_v2_srcs",
srcs: [
"extensions/cs/bluetooth_channel_sounding_v2.cc",
"extensions/cs/bluetooth_channel_sounding_session_v2.cc",
],
}
filegroup {
name: "hal_hwinit_srcs",
srcs: [
"chip/chip_provisioner.cc",
"chip/async_chip_provisioner.cc",
],
}
filegroup {
name: "hal_util_srcs",
srcs: [
"util/android_base_wrapper.cc",
"util/logging.cc",
"util/system_call_wrapper.cc",
"util/fd_watcher.cc",
"util/files.cc",
"util/timer_manager.cc",
"util/power/wakelock.cc",
"util/power/wakelock_watchdog.cc",
"util/power/power_interface.cc",
"util/power/wakelock_logger.cc",
],
}
filegroup {
name: "hal_transport_srcs",
srcs: [
"transport/device_control/uart_manager.cc",
"transport/device_control/power_manager.cc",
"transport/transport_factory.cc",
"transport/vendor_packet_validator.cc",
"transport/vendor_packet_validator_interface.cc",
"transport/hci_packet_rescuer.cc",
"transport/uart_h4/data_processor.cc",
"transport/uart_h4/hci_packetizer.cc",
"transport/uart_h4/transport_uart_h4.cc",
],
}
// ################################################################################
// # Libraries
// ################################################################################
cc_library_static {
name: "libbluetooth_hal",
vendor_available: true,
defaults: ["libbluetooth_hal_defaults"],
export_include_dirs: ["include/public"],
}
// These extension libraries should be included in whole_static_libs of the final binary
// to ensure the constructor of the registrar is called.
cc_library_static {
name: "libbluetooth_hal_finder",
vendor_available: true,
defaults: ["libbluetooth_hal_extension_defaults"],
srcs: [
"extensions/finder/bluetooth_finder.cc",
],
shared_libs: [
"android.hardware.bluetooth.finder-V1-ndk",
],
cflags: ["-DUSE_FINDER_V1"],
export_include_dirs: ["include/public"],
}
cc_library_static {
name: "libbluetooth_hal_sar",
vendor_available: true,
defaults: ["libbluetooth_hal_extension_defaults"],
srcs: [
"extensions/sar/bluetooth_sar.cc",
],
shared_libs: [
"//hardware/google/interfaces:hardware.google.bluetooth.sar-V1-ndk",
],
cflags: ["-DUSE_SAR_V1"],
export_include_dirs: ["include/public"],
}
cc_library_static {
name: "libbluetooth_hal_ext",
vendor_available: true,
defaults: ["libbluetooth_hal_extension_defaults"],
srcs: [
"extensions/ext/bluetooth_ext.cc",
],
shared_libs: [
"//hardware/google/interfaces:hardware.google.bluetooth.ext-V1-ndk",
],
cflags: ["-DUSE_EXT_V1"],
export_include_dirs: ["include/public"],
}
cc_library_static {
name: "libbluetooth_hal_ccc",
vendor_available: true,
defaults: ["libbluetooth_hal_extension_defaults"],
srcs: [
"extensions/ccc/bluetooth_ccc.cc",
],
shared_libs: [
"//hardware/google/interfaces:hardware.google.bluetooth.ccc-V1-ndk",
],
cflags: ["-DUSE_CCC_V1"],
export_include_dirs: ["include/public"],
}
cc_library_static {
name: "libbluetooth_hal_lmp_event",
vendor_available: true,
defaults: ["libbluetooth_hal_extension_defaults"],
srcs: [
"extensions/ccc/bluetooth_lmp_event.cc",
],
shared_libs: [
"android.hardware.bluetooth.lmp_event-V1-ndk",
],
cflags: ["-DUSE_CCC_V1"],
export_include_dirs: ["include/public"],
}
cc_library_static {
name: "libbluetooth_hal_channel_avoidance",
vendor_available: true,
defaults: ["libbluetooth_hal_extension_defaults"],
srcs: [
"extensions/channel_avoidance/bluetooth_channel_avoidance.cc",
],
shared_libs: [
"//hardware/google/interfaces:hardware.google.bluetooth.bt_channel_avoidance-V1-ndk",
],
cflags: ["-DUSE_CHANNEL_AVOIDANCE_V1"],
export_include_dirs: ["include/public"],
}
cc_library_static {
name: "libbluetooth_hal_ranging-V1",
vendor_available: true,
defaults: ["libbluetooth_hal_extension_defaults"],
srcs: [
":hal_ranging_common_srcs",
":hal_ranging_v1_srcs",
],
cflags: ["-DUSE_RANGING_V1"],
shared_libs: [
"android.hardware.bluetooth.ranging-V1-ndk",
],
export_shared_lib_headers: ["android.hardware.bluetooth.ranging-V1-ndk"],
export_include_dirs: ["include/public"],
}
cc_library_static {
name: "libbluetooth_hal_ranging-V2",
vendor_available: true,
defaults: ["libbluetooth_hal_extension_defaults"],
srcs: [
":hal_ranging_common_srcs",
":hal_ranging_v2_srcs",
],
cflags: ["-DUSE_RANGING_V2"],
shared_libs: [
"android.hardware.bluetooth.ranging-V2-ndk",
],
export_shared_lib_headers: ["android.hardware.bluetooth.ranging-V2-ndk"],
export_include_dirs: ["include/public"],
}
cc_library_headers {
name: "libbluetooth_hal_headers",
export_include_dirs: ["include/public"],
proprietary: true,
}
// ################################################################################
// # Tests
// ################################################################################
cc_defaults {
name: "bluetooth_hal_test_defaults",
team: "trendy_team_bluetooth",
test_suites: ["general-tests"],
local_include_dirs: ["include/public"],
cflags: ["-DUNIT_TEST"],
static_libs: [
"libaconfig_storage_read_api_cc",
"libbluetooth_hal_flags_c_lib_for_test",
],
host_supported: true,
}
cc_test {
name: "bluetooth_hal_core_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"hal_packet_test.cc",
"hci_monitor_test.cc",
"hci_router_client_test.cc",
"hci_router_client.cc",
"bluetooth_address_test.cc",
"util/worker_test.cc",
"util/time_queue_test.cc",
":test_mock_router_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_router_client_agent_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"hci_router_client_agent_test.cc",
"hci_router_client_agent.cc",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
"liblog",
],
}
cc_test {
name: "bluetooth_hal_hci_router_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"hci_router.cc",
"hci_router_test.cc",
"hci_router_interface.cc",
"hci_router_interface_test.cc",
"hci_router_async.cc",
"hci_router_async_test.cc",
"hci_router_client.cc",
"extensions/thread/socket_processor.cc",
"extensions/thread/thread_daemon.cc",
"extensions/thread/thread_handler.cc",
":test_mock_transport_srcs",
":test_mock_util_srcs",
":test_mock_debug_srcs",
":test_mock_hal_config_srcs",
":test_mock_router_client_agent_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
"liblog",
],
}
cc_test {
name: "bluetooth_hal_finder_test",
defaults: ["bluetooth_hal_test_defaults"],
host_supported: false,
srcs: [
"hci_router_client.cc",
"extensions/finder/bluetooth_finder_handler.cc",
"extensions/finder/bluetooth_finder_handler_test.cc",
":test_mock_router_srcs",
":test_mock_util_srcs",
],
static_libs: [
"libgmock",
"android.hardware.bluetooth.finder-V1-ndk",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_ext_test",
defaults: ["bluetooth_hal_test_defaults"],
host_supported: true,
srcs: [
"hci_router_client.cc",
"extensions/ext/bluetooth_ext_handler.cc",
"extensions/ext/bluetooth_ext_handler_test.cc",
":test_mock_router_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_sar_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"hci_router_client.cc",
"extensions/sar/bluetooth_sar_handler.cc",
"extensions/sar/bluetooth_sar_handler_test.cc",
":test_mock_router_srcs",
":test_mock_hal_config_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_channel_sounding_test",
defaults: ["bluetooth_hal_test_defaults"],
host_supported: false,
srcs: [
"hci_router_client.cc",
"extensions/cs/bluetooth_channel_sounding_handler_test.cc",
":test_mock_router_srcs",
":test_mock_util_srcs",
":test_mock_cs_config_srcs",
],
header_libs: [
"libeigen",
],
static_libs: [
"libbluetooth_hal_ranging-V1",
"android.hardware.bluetooth-V1-ndk",
"android.hardware.bluetooth.ranging-V1-ndk",
"libgmock",
"hal_proto_lib",
],
shared_libs: [
"libbinder_ndk",
"libbase",
"libprotobuf-cpp-full",
],
}
cc_test {
name: "bluetooth_hal_thread_handler_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"extensions/thread/socket_processor.cc",
"extensions/thread/thread_daemon.cc",
"extensions/thread/thread_handler.cc",
"extensions/thread/thread_handler_test.cc",
"hci_router_client.cc",
"util/system_call_wrapper.cc",
":test_mock_router_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_socket_processor_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"extensions/thread/socket_processor.cc",
"extensions/thread/socket_processor_test.cc",
":test_mock_util_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_thread_daemon_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"extensions/thread/thread_daemon.cc",
"extensions/thread/thread_daemon_test.cc",
":test_mock_thread_srcs",
":test_mock_util_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_ccc_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
":test_mock_router_srcs",
"hci_router_client.cc",
"extensions/ccc/bluetooth_ccc_timesync_event.cc",
"extensions/ccc/bluetooth_ccc_timesync_command.cc",
"extensions/ccc/bluetooth_ccc_handler.cc",
"extensions/ccc/bluetooth_ccc_timesync_event_test.cc",
"extensions/ccc/bluetooth_ccc_timesync_command_test.cc",
"extensions/ccc/bluetooth_ccc_handler_test.cc",
":test_mock_util_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_channel_avoidance_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
":test_mock_router_srcs",
"hci_router_client.cc",
"extensions/channel_avoidance/bluetooth_channel_avoidance_handler.cc",
"extensions/channel_avoidance/bluetooth_channel_avoidance_handler_test.cc",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_config_loader_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"config/hal_config_loader.cc",
"config/hal_config_loader_test.cc",
":test_mock_transport_srcs",
":test_mock_util_srcs",
],
static_libs: [
"libgmock",
"hal_proto_lib",
],
shared_libs: [
"libbase",
"libprotobuf-cpp-full",
],
}
cc_test {
name: "bluetooth_hal_cs_config_loader_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"config/cs_config_loader.cc",
"config/cs_config_loader_test.cc",
":test_mock_util_srcs",
],
static_libs: [
"libgmock",
"hal_proto_lib",
],
shared_libs: [
"libbase",
"libprotobuf-cpp-full",
],
}
cc_test {
name: "bluetooth_hal_firmware_config_loader_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"config/firmware_config_loader.cc",
"config/firmware_config_loader_test.cc",
":test_mock_util_srcs",
":test_mock_transport_srcs",
":test_mock_hal_config_srcs",
],
static_libs: [
"libgmock",
"hal_proto_lib",
],
shared_libs: [
"libbase",
"libprotobuf-cpp-full",
],
}
cc_test {
name: "bluetooth_hal_hci_packetizer_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"util/logging.cc",
"transport/vendor_packet_validator.cc",
"transport/vendor_packet_validator_interface.cc",
"transport/hci_packet_rescuer.cc",
"transport/uart_h4/hci_packetizer.cc",
"transport/uart_h4/hci_packetizer_test.cc",
":test_mock_debug_srcs",
":test_mock_hal_config_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_hci_packet_rescuer_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"util/logging.cc",
"transport/vendor_packet_validator.cc",
"transport/vendor_packet_validator_interface.cc",
"transport/hci_packet_rescuer.cc",
"transport/hci_packet_rescuer_test.cc",
":test_mock_debug_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_transport_factory_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"util/logging.cc",
"transport/device_control/uart_manager.cc",
"transport/device_control/power_manager.cc",
"transport/transport_factory.cc",
"transport/transport_factory_test.cc",
"transport/vendor_packet_validator.cc",
"transport/vendor_packet_validator_interface.cc",
"transport/hci_packet_rescuer.cc",
"transport/uart_h4/data_processor.cc",
"transport/uart_h4/hci_packetizer.cc",
"transport/uart_h4/transport_uart_h4.cc",
"util/fd_watcher.cc",
"util/timer_manager.cc",
":test_mock_util_srcs",
":test_mock_debug_srcs",
":test_mock_hal_config_srcs",
],
static_libs: [
"libgmock",
"hal_proto_lib",
],
shared_libs: [
"libbase",
"libprotobuf-cpp-full",
"liblog",
],
}
cc_test {
name: "bluetooth_hal_transport_uart_h4_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"util/logging.cc",
"config/hal_config_loader.cc",
"transport/device_control/uart_manager.cc",
"transport/device_control/power_manager.cc",
"transport/transport_factory.cc",
"transport/vendor_packet_validator.cc",
"transport/vendor_packet_validator_interface.cc",
"transport/hci_packet_rescuer.cc",
"transport/uart_h4/data_processor.cc",
"transport/uart_h4/hci_packetizer.cc",
"transport/uart_h4/transport_uart_h4.cc",
"transport/uart_h4/transport_uart_h4_test.cc",
"util/fd_watcher.cc",
"util/timer_manager.cc",
":test_mock_util_srcs",
":test_mock_debug_srcs",
],
static_libs: [
"libgmock",
"hal_proto_lib",
],
shared_libs: [
"libbase",
"libprotobuf-cpp-full",
"liblog",
],
}
cc_test {
name: "bluetooth_hal_data_processor_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"util/logging.cc",
"transport/vendor_packet_validator.cc",
"transport/vendor_packet_validator_interface.cc",
"transport/hci_packet_rescuer.cc",
"transport/uart_h4/hci_packetizer.cc",
"transport/uart_h4/data_processor.cc",
"transport/uart_h4/data_processor_test.cc",
"util/fd_watcher.cc",
":test_mock_debug_srcs",
":test_mock_hal_config_srcs",
":test_mock_util_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
"liblog",
],
}
cc_test {
name: "bluetooth_hal_timer_manager_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"util/timer_manager.cc",
"util/timer_manager_test.cc",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_bqr_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"bqr/bqr_handler.cc",
"bqr/bqr_handler_test.cc",
"bqr/bqr_event.cc",
"bqr/bqr_event_test.cc",
"bqr/bqr_link_quality_event.cc",
"bqr/bqr_link_quality_event_v1_to_v3.cc",
"bqr/bqr_link_quality_event_v4.cc",
"bqr/bqr_link_quality_event_v5.cc",
"bqr/bqr_link_quality_event_v6.cc",
"bqr/bqr_link_quality_event_v7.cc",
"bqr/bqr_link_quality_event_test.cc",
"bqr/bqr_root_inflammation_event.cc",
"bqr/bqr_root_inflammation_event_test.cc",
"bqr/bqr_advance_rf_stats_event.cc",
"bqr/bqr_advance_rf_stats_event_v7.cc",
"bqr/bqr_advance_rf_stats_event_test.cc",
"bqr/bqr_energy_monitoring_event.cc",
"bqr/bqr_energy_monitoring_event_v6.cc",
"bqr/bqr_energy_monitoring_event_v7.cc",
"bqr/bqr_energy_monitoring_event_test.cc",
"hci_router_client.cc",
":test_mock_router_srcs",
":test_mock_debug_srcs",
],
static_libs: [
"libgmock",
],
shared_libs: [
"libbase",
],
}
cc_test {
name: "bluetooth_hal_chip_provisioner_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"chip/chip_provisioner.cc",
"chip/chip_provisioner_test.cc",
"hci_router_client.cc",
":test_mock_router_srcs",
":test_mock_util_srcs",
":test_mock_hal_config_srcs",
":test_mock_firmware_config_srcs",
],
static_libs: [
"libgmock",
"hal_proto_lib",
],
shared_libs: [
"libbase",
"libprotobuf-cpp-full",
],
}
cc_test {
name: "bluetooth_hal_bluetooth_activities_test",
defaults: ["bluetooth_hal_test_defaults"],
srcs: [
"hci_router_client.cc",
"debug/bluetooth_activities.cc",
"debug/bluetooth_activities_test.cc",
"util/logging.cc",
":test_mock_router_srcs",
],
static_libs: [
"libgmock",
"libbluetooth_hal_flags_c_lib_for_test",
],
shared_libs: [
"libbase",
"libaconfig_storage_read_api_cc",
"liblog",
],
}