diff --git a/android/app/Android.bp b/android/app/Android.bp index b2573c265f8d41f26f54ed8e285ad5d7eabd83e1..c729489f4daf6eba4ff2bad006adebec36330348 100644 --- a/android/app/Android.bp +++ b/android/app/Android.bp @@ -52,6 +52,7 @@ java_library { cc_library_shared { name: "libbluetooth_jni", + defaults: ["fluoride_full_defaults"], srcs: ["jni/**/*.cpp"], header_libs: [ "jni_headers", @@ -60,14 +61,9 @@ cc_library_shared { include_dirs: [ "packages/modules/Bluetooth/system/types", ], - shared_libs: [ - "libbase", - "libchrome", - "liblog", - "libnativehelper", - ], static_libs: [ "libbluetooth-types", + "libbluetooth", ], cflags: [ "-Wall", @@ -145,7 +141,19 @@ android_app { optimize: { enabled: false, }, - required: ["libbluetooth"], + required: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", + "android.hardware.bluetooth.audio@2.0", + "android.hardware.bluetooth.audio@2.1", + "android.hardware.bluetooth.audio-V1-ndk", + "audio_set_configurations_bfbs", + "audio_set_configurations_json", + "audio_set_scenarios_bfbs", + "audio_set_scenarios_json", + "bt_did.conf", + "bt_stack.conf", + ], apex_available: [ "com.android.bluetooth", ], diff --git a/android/app/jni/com_android_bluetooth_a2dp.cpp b/android/app/jni/com_android_bluetooth_a2dp.cpp index abc8830b518198eb0132c6e4a12c1fdbe7b5983b..3f7b1634798a190a26cc905a02922f5b9557b3f4 100644 --- a/android/app/jni/com_android_bluetooth_a2dp.cpp +++ b/android/app/jni/com_android_bluetooth_a2dp.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BluetoothA2dpServiceJni" -#define LOG_NDEBUG 0 - #include "com_android_bluetooth.h" #include "hardware/bt_av.h" #include "utils/Log.h" diff --git a/android/app/jni/com_android_bluetooth_a2dp_sink.cpp b/android/app/jni/com_android_bluetooth_a2dp_sink.cpp index a74b18d6fbab4ba81fbe57ca148002f9856b66ee..6b2cbbfbe06772b92d189a215765e6118e537f5c 100644 --- a/android/app/jni/com_android_bluetooth_a2dp_sink.cpp +++ b/android/app/jni/com_android_bluetooth_a2dp_sink.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BluetoothA2dpSinkServiceJni" -#define LOG_NDEBUG 0 - #include "com_android_bluetooth.h" #include "hardware/bt_av.h" #include "utils/Log.h" diff --git a/android/app/jni/com_android_bluetooth_avrcp_controller.cpp b/android/app/jni/com_android_bluetooth_avrcp_controller.cpp index 86bf0687913e240dc2d33de8985bb739eec585c7..316e1d0ac17c52e14582530fb368797064223257 100755 --- a/android/app/jni/com_android_bluetooth_avrcp_controller.cpp +++ b/android/app/jni/com_android_bluetooth_avrcp_controller.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BluetoothAvrcpControllerJni" -#define LOG_NDEBUG 0 - #include "com_android_bluetooth.h" #include "hardware/bt_rc.h" #include "utils/Log.h" diff --git a/android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp b/android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp index 3c5bcdb276a740f927eb24cc1f024dcca988fc91..e761eb638d24c0ae1ec725f711243eb83c9c3dc1 100644 --- a/android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +++ b/android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp @@ -36,6 +36,9 @@ #include <pthread.h> using bluetooth::Uuid; +#ifndef DYNAMIC_LOAD_BLUETOOTH +extern bt_interface_t bluetoothInterface; +#endif namespace android { // Both @@ -846,6 +849,10 @@ static bt_os_callouts_t sBluetoothOsCallouts = { }; int hal_util_load_bt_library(const bt_interface_t** interface) { +#ifndef DYNAMIC_LOAD_BLUETOOTH + *interface = &bluetoothInterface; + return 0; +#else const char* sym = BLUETOOTH_INTERFACE_STRING; bt_interface_t* itf = nullptr; @@ -875,6 +882,7 @@ error: if (handle) dlclose(handle); return -EINVAL; +#endif } static void classInitNative(JNIEnv* env, jclass clazz) { diff --git a/android/app/jni/com_android_bluetooth_csip_set_coordinator.cpp b/android/app/jni/com_android_bluetooth_csip_set_coordinator.cpp index 45ebe6e807ef273ead02c062fa80ca43f93fefa7..431247a9443f5918fb3cd292b50f89d88ff28c9b 100644 --- a/android/app/jni/com_android_bluetooth_csip_set_coordinator.cpp +++ b/android/app/jni/com_android_bluetooth_csip_set_coordinator.cpp @@ -16,7 +16,6 @@ * limitations under the License. */ #define LOG_TAG "BluetoothCsipSetCoordinatorJni" -#define LOG_NDEBUG 0 #include <string.h> #include <shared_mutex> diff --git a/android/app/jni/com_android_bluetooth_gatt.cpp b/android/app/jni/com_android_bluetooth_gatt.cpp index a9802acdb9536a49a01b8aa6c5d4deb6a1e85f07..cb360a80bb64fd4f27287c7e2ffef50029876e30 100644 --- a/android/app/jni/com_android_bluetooth_gatt.cpp +++ b/android/app/jni/com_android_bluetooth_gatt.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BtGatt.JNI" -#define LOG_NDEBUG 0 - #include "com_android_bluetooth.h" #include "hardware/bt_gatt.h" #include "utils/Log.h" diff --git a/android/app/jni/com_android_bluetooth_hap_client.cpp b/android/app/jni/com_android_bluetooth_hap_client.cpp index e94cb59f768e33a5912e7fafe6f43d4deaacee06..1d77a27eb33f000b2e6119b94c200f6dd681ad2f 100644 --- a/android/app/jni/com_android_bluetooth_hap_client.cpp +++ b/android/app/jni/com_android_bluetooth_hap_client.cpp @@ -17,8 +17,6 @@ #define LOG_TAG "BluetoothHapClientJni" -#define LOG_NDEBUG 0 - #include <string.h> #include <shared_mutex> diff --git a/android/app/jni/com_android_bluetooth_hearing_aid.cpp b/android/app/jni/com_android_bluetooth_hearing_aid.cpp index e359faf8a4b15270cdc5fab58be0de80e27315a9..5e2f88e680ae990d09019bfe45b3cf25864fa688 100644 --- a/android/app/jni/com_android_bluetooth_hearing_aid.cpp +++ b/android/app/jni/com_android_bluetooth_hearing_aid.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BluetoothHearingAidServiceJni" -#define LOG_NDEBUG 0 - #include "base/logging.h" #include "com_android_bluetooth.h" #include "hardware/bt_hearing_aid.h" diff --git a/android/app/jni/com_android_bluetooth_hfp.cpp b/android/app/jni/com_android_bluetooth_hfp.cpp index 813bdd0818b8516ff9167131c420b296415f51d9..fffaf8ccb48d014195a9f289c5959296ce2a9808 100644 --- a/android/app/jni/com_android_bluetooth_hfp.cpp +++ b/android/app/jni/com_android_bluetooth_hfp.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BluetoothHeadsetServiceJni" -#define LOG_NDEBUG 0 - #include "com_android_bluetooth.h" #include "hardware/bluetooth_headset_callbacks.h" #include "hardware/bluetooth_headset_interface.h" diff --git a/android/app/jni/com_android_bluetooth_hfpclient.cpp b/android/app/jni/com_android_bluetooth_hfpclient.cpp index 763885e3d3eb6ef2333b8704532e12914e1b508f..c3e0c9842b5df59644f4c593d026285e628541fc 100644 --- a/android/app/jni/com_android_bluetooth_hfpclient.cpp +++ b/android/app/jni/com_android_bluetooth_hfpclient.cpp @@ -16,7 +16,6 @@ */ #define LOG_TAG "BluetoothHeadsetClientServiceJni" -#define LOG_NDEBUG 0 #include "com_android_bluetooth.h" #include "hardware/bt_hf_client.h" diff --git a/android/app/jni/com_android_bluetooth_hid_device.cpp b/android/app/jni/com_android_bluetooth_hid_device.cpp index 17b6e97c015aed4495e7beb70bf3b971078c61a4..2146222acdb48f5c1e5849747b9646f95c9149d8 100644 --- a/android/app/jni/com_android_bluetooth_hid_device.cpp +++ b/android/app/jni/com_android_bluetooth_hid_device.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BluetoothHidDeviceServiceJni" -#define LOG_NDEBUG 0 - #include "com_android_bluetooth.h" #include "hardware/bt_hd.h" #include "utils/Log.h" diff --git a/android/app/jni/com_android_bluetooth_hid_host.cpp b/android/app/jni/com_android_bluetooth_hid_host.cpp index 074e39d5b024c921ca0c4ff3451cad732b40ded3..7a164233bc1b5d7e315691c80f0e5364db3b3666 100644 --- a/android/app/jni/com_android_bluetooth_hid_host.cpp +++ b/android/app/jni/com_android_bluetooth_hid_host.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BluetoothHidHostServiceJni" -#define LOG_NDEBUG 1 - #include "com_android_bluetooth.h" #include "hardware/bt_hh.h" #include "utils/Log.h" diff --git a/android/app/jni/com_android_bluetooth_le_audio.cpp b/android/app/jni/com_android_bluetooth_le_audio.cpp index de2152733240c4bb9b4e2ac556e63126f18fb310..ae0b2c4bbd657b8ae1976dd4db3759ecf53e673e 100644 --- a/android/app/jni/com_android_bluetooth_le_audio.cpp +++ b/android/app/jni/com_android_bluetooth_le_audio.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BluetoothLeAudioServiceJni" -#define LOG_NDEBUG 0 - #include <hardware/bluetooth.h> #include <array> diff --git a/android/app/jni/com_android_bluetooth_pan.cpp b/android/app/jni/com_android_bluetooth_pan.cpp index b02ae9f9b153100ea429be98ffaca8e0fadbb1f0..84d7b1c78b07dbe131d963b2f3c2471f90022e5e 100644 --- a/android/app/jni/com_android_bluetooth_pan.cpp +++ b/android/app/jni/com_android_bluetooth_pan.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BluetoothPanServiceJni" -#define LOG_NDEBUG 0 - #include "com_android_bluetooth.h" #include "hardware/bt_pan.h" #include "utils/Log.h" diff --git a/android/app/jni/com_android_bluetooth_sdp.cpp b/android/app/jni/com_android_bluetooth_sdp.cpp index bba109ac45609c04804ac91a4458f49f566a30ce..ded546a05d85bc6eab7216f7cdac4b3d0c1d9123 100755 --- a/android/app/jni/com_android_bluetooth_sdp.cpp +++ b/android/app/jni/com_android_bluetooth_sdp.cpp @@ -16,8 +16,6 @@ #define LOG_TAG "BluetoothSdpJni" -#define LOG_NDEBUG 0 - #include "com_android_bluetooth.h" #include "hardware/bt_sdp.h" #include "utils/Log.h" diff --git a/android/app/jni/com_android_bluetooth_vc.cpp b/android/app/jni/com_android_bluetooth_vc.cpp index 22baaeaa7fbdaaa59904313125292c33ebd95a4d..cc1e296e55ada059c5f2475c9fb0cf23e0fc5164 100644 --- a/android/app/jni/com_android_bluetooth_vc.cpp +++ b/android/app/jni/com_android_bluetooth_vc.cpp @@ -17,8 +17,6 @@ #define LOG_TAG "BluetoothVolumeControlServiceJni" -#define LOG_NDEBUG 0 - #include <string.h> #include <shared_mutex> diff --git a/apex/Android.bp b/apex/Android.bp index 5315af77fc37318c1bef19d1bc26210b6891a114..e77e22571134737f20a9eef0a1850340fc28bb3a 100644 --- a/apex/Android.bp +++ b/apex/Android.bp @@ -16,9 +16,6 @@ apex_defaults { multilib: { first: { // Extractor process runs only with the primary ABI. - native_shared_libs: [ - "libbluetooth", - ], jni_libs: [ "libbluetooth_jni", ], diff --git a/system/audio_hal_interface/fuzzer/Android.bp b/system/audio_hal_interface/fuzzer/Android.bp index f1724af3d49f5cd212652b0a8ccc1b9f249cafc5..704624f32e58479400f6cd7283b422c7c424a10f 100644 --- a/system/audio_hal_interface/fuzzer/Android.bp +++ b/system/audio_hal_interface/fuzzer/Android.bp @@ -59,6 +59,8 @@ cc_defaults { "libbtcore", "libbt-bta", "libbt-hci", + "libbt_shim_bridge", + "libbt_shim_ffi", "libjsoncpp", "libbt-utils", "libbtdevice", @@ -84,6 +86,7 @@ cc_defaults { "libprotobuf-cpp-lite", "libbt-audio-hal-interface", "libbluetooth_rust_interop", + "libaudio-a2dp-hw-utils", ], include_dirs: [ "packages/modules/Bluetooth/system", diff --git a/system/bta/Android.bp b/system/bta/Android.bp index b022934b39166e4fa2221d24eb9f91537baf7674..0b48c77459be91bf0b0fa288fa2e2d8042b1cacb 100644 --- a/system/bta/Android.bp +++ b/system/bta/Android.bp @@ -9,7 +9,7 @@ package { cc_defaults { name: "fluoride_bta_defaults", - defaults: ["fluoride_defaults"], + defaults: ["fluoride_basic_defaults"], local_include_dirs: [ "include", "sys", @@ -31,9 +31,6 @@ cc_defaults { "packages/modules/Bluetooth/system/utils/include", "packages/modules/Bluetooth/system/gd/rust/shim", ], - shared_libs: [ - "libcutils", - ], header_libs: ["libbluetooth_headers"], cflags: ["-DBUILDCFG"], } @@ -142,21 +139,8 @@ cc_library_static { ], static_libs: [ "avrcp-target-service", - "libflatbuffers-cpp", "lib-bt-packets", - "libbt-platform-protos-lite", ], - shared_libs: [ - "android.hardware.bluetooth.audio@2.0", - "android.hardware.bluetooth.audio@2.1", - ], - target: { - android: { - shared_libs: [ - "android.hardware.bluetooth.audio-V1-ndk", - ], - }, - }, generated_headers: [ "LeAudioSetConfigSchemas_h", ], @@ -180,6 +164,8 @@ cc_test { "test/gatt/database_test.cc", ], shared_libs: [ + "android.hardware.bluetooth.audio@2.0", + "android.hardware.bluetooth.audio@2.1", "libcrypto", "liblog", "libprotobuf-cpp-lite", @@ -256,7 +242,6 @@ cc_test { shared_libs: [ "libbase", "libcrypto", - "libflatbuffers-cpp", "liblog", "libprotobuf-cpp-lite", ], @@ -265,6 +250,7 @@ cc_test { "libbt-common", "libbt-protos-lite", "libbtcore", + "libflatbuffers-cpp", "libgmock", ], sanitize: { diff --git a/system/btcore/Android.bp b/system/btcore/Android.bp index dd9b1ba7aa0b14801ea182ad2afe70d88502bb95..93f75635ba5e8b4fc6148bfb34183b13c86a5d4c 100644 --- a/system/btcore/Android.bp +++ b/system/btcore/Android.bp @@ -10,7 +10,7 @@ package { cc_defaults { name: "libbtcore_defaults", - defaults: ["fluoride_defaults"], + defaults: ["fluoride_basic_defaults"], local_include_dirs: ["include"], include_dirs: [ "packages/modules/Bluetooth/system", @@ -23,15 +23,8 @@ cc_defaults { "src/osi_module.cc", "src/property.cc", ], - shared_libs: [ - "liblog", - ], header_libs: ["libbluetooth_headers"], host_supported: true, - apex_available: [ - "//apex_available:platform", - "com.android.bluetooth", - ], target: { linux_glibc: { cflags: ["-D_GNU_SOURCE"], @@ -49,11 +42,6 @@ cc_library_static { min_sdk_version: "Tiramisu" } -cc_library_static { - name: "libbtcore-static", - defaults: ["libbtcore_defaults"], -} - cc_library_headers { name: "libbtcore_headers", defaults: ["libchrome_support_defaults"], @@ -81,12 +69,14 @@ cc_test { "test/property_test.cc", ], shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", "liblog", ], static_libs: [ - "libbtcore", - "libosi-AllocationTestHarness", "libosi", + "libosi-AllocationTestHarness", + "libbtcore", ], host_supported: true, test_options: { diff --git a/system/btcore/fuzzer/Android.bp b/system/btcore/fuzzer/Android.bp index 7368d715a2ebaf7cba600da5ffaa8d68a0db7b88..0cc342947771d09c1fbe45000a99d7d0fdf07b25 100644 --- a/system/btcore/fuzzer/Android.bp +++ b/system/btcore/fuzzer/Android.bp @@ -26,11 +26,10 @@ package { cc_defaults { name: "btcore_fuzz_defaults", shared_libs: [ - "libcrypto", - "libstatslog_bt", - "libbluetooth", "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", + "libcrypto", + "libstatslog_bt", ], static_libs: [ "libosi", @@ -48,6 +47,9 @@ cc_defaults { "libbluetooth-protos", "libprotobuf-cpp-lite", "libbluetooth_rust_interop", + "libbt_callbacks_cxx", + "libbt_shim_bridge", + "libbt_shim_ffi", ], include_dirs: [ "packages/modules/Bluetooth/system", diff --git a/system/btif/Android.bp b/system/btif/Android.bp index 48d1863a9f9c7a906d2d4020f284db19b086da5b..449c7a862cd20ace696346acfc075f62c5af1473 100644 --- a/system/btif/Android.bp +++ b/system/btif/Android.bp @@ -93,7 +93,7 @@ genrule { // libbtif static library for target cc_defaults { name: "libbtif_defaults", - defaults: ["fluoride_defaults"], + defaults: ["fluoride_basic_defaults"], include_dirs: btifCommonIncludes, srcs: [ // AVRCP Target Service @@ -160,25 +160,8 @@ cc_defaults { "BluetoothGeneratedDumpsysDataSchema_h", "BluetoothGeneratedPackets_h", ], - shared_libs: [ - "android.hardware.bluetooth.a2dp@1.0", - "android.hardware.bluetooth.audio@2.0", - "android.hardware.bluetooth.audio@2.1", - "libcrypto", - "libflatbuffers-cpp", - "libhidlbase", - "libtinyxml2", - "libz", - ], target: { android: { - shared_libs: [ - "android.hardware.bluetooth.audio-V1-ndk", - "libaaudio", - "libbinder_ndk", - "libfmq", - "libstatslog_bt", - ], srcs: ["src/btif_avrcp_audio_track.cc"], }, host: { @@ -188,9 +171,11 @@ cc_defaults { ], }, }, - whole_static_libs: [ + static_libs: [ "avrcp-target-service", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", "libbt-audio-hal-interface", "libaudio-a2dp-hw-utils", ], @@ -206,11 +191,6 @@ cc_library_static { min_sdk_version: "Tiramisu" } -cc_library_static { - name: "libbtif-static", - defaults: ["libbtif_defaults"], -} - // btif unit tests for target cc_test { name: "net_test_btif", @@ -222,37 +202,38 @@ cc_test { ], header_libs: ["libbluetooth_headers"], shared_libs: [ - "libaaudio", "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", + "libaaudio", "libbinder_ndk", + "libcrypto", "libfmq", "libhidlbase", "libprotobuf-cpp-lite", "libprocessgroup", - "libcrypto", ], static_libs: [ + "android.hardware.bluetooth.a2dp@1.0", + "android.system.suspend.control-V1-ndk", + "libbluetooth-types", + "libbt-audio-hal-interface", "libbt-bta", - "libbtcore", "libbt-common", - "libbt-stack", + "libbtcore", + "libbtdevice", + "libbt-hci", + "libbt-protos-lite", "libbt-sbc-decoder", "libbt-sbc-encoder", + "libbt-stack", "libbt-utils", "libFraunhoferAAC", "libg722codec", "liblc3", - "libbtdevice", - "libbt-hci", - "libudrv-uipc", - "libbluetooth-types", "libosi", - "libbt-protos-lite", + "libudrv-uipc", ], whole_static_libs: [ "libbtif", @@ -289,10 +270,12 @@ cc_test { "BluetoothGeneratedPackets_h", ], shared_libs: [ - "libflatbuffers-cpp", + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", ], static_libs: [ "libbluetooth-types", + "libflatbuffers-cpp", "libosi", ], cflags: ["-DBUILDCFG"], @@ -363,7 +346,7 @@ cc_test { cflags: ["-DBUILDCFG"], target: { android: { - shared_libs: [ + static_libs: [ "android.system.suspend.control-V1-ndk", ], }, @@ -465,12 +448,10 @@ cc_test { ], header_libs: ["libbluetooth_headers"], shared_libs: [ - "android.hardware.bluetooth.a2dp@1.0", "android.hardware.bluetooth.audio@2.0", "android.hardware.bluetooth.audio@2.1", "libcrypto", "libcutils", - "libflatbuffers-cpp", "libhidlbase", "liblog", "libtinyxml2", @@ -479,8 +460,16 @@ cc_test { "libbtif", ], static_libs: [ + "android.hardware.bluetooth.a2dp@1.0", + "avrcp-target-service", + "libaudio-a2dp-hw-utils", "libbluetooth-types", + "libbt-audio-hal-interface", "libbtdevice", + "lib-bt-packets", + "lib-bt-packets-avrcp", + "lib-bt-packets-base", + "libflatbuffers-cpp", "libgmock", "libosi", ], diff --git a/system/build/Android.bp b/system/build/Android.bp index 70c509957f04336bdd7a2f9e1e554328b8d57dcc..80ae324829439a6f1d0d166350534d3657148cf5 100644 --- a/system/build/Android.bp +++ b/system/build/Android.bp @@ -25,7 +25,14 @@ bootstrap_go_package { fluoride_defaults { name: "libchrome_support_defaults", - shared_libs: ["libchrome"], + static_libs: [ + "libchrome", + "libmodpb64", + "libevent", + ], + shared_libs: [ + "libbase", + ], cflags: [ "-Wall", "-Wextra", @@ -35,6 +42,12 @@ fluoride_defaults { darwin: { enabled: false, }, + android: { + shared_libs: [ + "libcutils", + "liblog", + ], + } }, } @@ -93,6 +106,9 @@ fluoride_defaults { "libbluetooth-types", "libbt-platform-protos-lite", "libbluetooth_rust_interop", + "libbt_callbacks_cxx", + "libbt_shim_bridge", + "libbt_shim_ffi", "libcutils", ], shared_libs: [ @@ -102,6 +118,147 @@ fluoride_defaults { min_sdk_version: "current", } +fluoride_defaults { + name: "fluoride_test_prod_shared_defaults", + defaults: ["fluoride_defaults"], +} + +fluoride_defaults { + name: "fluoride_test_defaults", + defaults: ["fluoride_test_prod_shared_defaults"], + host_supported: true, + shared_libs: [ + "libcrypto", + "liblog", + "libprotobuf-cpp-lite", + ], + static_libs: [ + "libbt-common", + "libbt-protos-lite", + "libosi", + "libosi-AlarmTestHarness", + "libosi-AllocationTestHarness", + "libcutils", + "libgmock", + ], + sanitize: { + address: true, + cfi: true, + misc_undefined: ["bounds"], + }, +} + +fluoride_defaults { + name: "fluoride_unit_test_defaults", + defaults: ["fluoride_test_defaults"], + test_options: { + unit_test: true, + }, +} + +fluoride_defaults { + name: "fluoride_basic_defaults", + defaults: ["fluoride_test_prod_shared_defaults", "libchrome_support_defaults"], + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + ], + shared_libs: [ + "libcrypto", + "libbase", + "liblog", + "libnativehelper", + ], + static_libs: [ + "android.hardware.bluetooth.a2dp@1.0", + "libflatbuffers-cpp", + "libbt-sbc-decoder", + "libbt-sbc-encoder", + "libFraunhoferAAC", + "libg722codec", + "liblc3", + "libudrv-uipc", + "libprotobuf-cpp-lite", + "libbluetooth_gd", + "libbluetooth-dumpsys", + "libbluetooth_rust_interop", + "libbluetooth-types", + "libbt-platform-protos-lite", + "libbt-protos-lite", + "libbt_callbacks_cxx", + "libbt_shim_bridge", + "libbt_shim_ffi", + "libstatslog_bt", + ], + target: { + android: { + shared_libs: [ + "android.hardware.bluetooth.audio@2.0", + "android.hardware.bluetooth.audio@2.1", + "android.hardware.bluetooth.audio-V1-ndk", + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", + "android.system.suspend-V1-ndk", + "libaaudio", + "libbinder_ndk", + "libcutils", + "libhidlbase", + "libfmq", + "libprocessgroup", + "libtinyxml2", + "libutils", + "libz", + ], + static_libs: [ + "android.system.suspend.control-V1-ndk", + ], + required: [ + "libldacBT_enc", + "libldacBT_abr", + ], + }, + linux_glibc: { + shared_libs: [ + "android.hardware.bluetooth.audio@2.0", + "android.hardware.bluetooth.audio@2.1", + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", + "libbinder_ndk", + "libcutils", + "libhidlbase", + "libfmq", + "libprocessgroup", + "libtinyxml2", + "libutils", + "libz", + ], + }, + }, +} + +fluoride_defaults { + name: "fluoride_full_defaults", + defaults: ["fluoride_basic_defaults"], + static_libs: [ + "libbte", + "libbt-bta", + "libbt-common", + "libbtdevice", + "libbtif", + "libbt-hci", + "libbt-stack", + "libbt-utils", + "libbtcore", + "libosi", + "avrcp-target-service", + "lib-bt-packets", + "libbt-audio-hal-interface", + "libaudio-a2dp-hw-utils", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", + ], +} + fluoride_defaults { name: "fluoride_defaults", defaults: ["fluoride_defaults_fuzzable", "fluoride_types_defaults"], @@ -109,13 +266,17 @@ fluoride_defaults { "libbluetooth_gd", "libbluetooth_rust_interop", "libbt_shim_ffi", + "libbt_callbacks_cxx", + "libbt_shim_bridge", + "libbt_shim_ffi", + "libstatslog_bt", ], target: { darwin: { // libstatslog_bt -> libbinder doesn't build on mac enabled: false, }, - android: { + linux_glibc: { shared_libs: [ "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", @@ -124,6 +285,16 @@ fluoride_defaults { "libstatslog_bt", "libutils", ], + }, + android: { + shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", + "libcutils", + "libhidlbase", + "libstatssocket", + "libutils", + ], cflags: [ "-DOS_ANDROID", ], diff --git a/system/common/Android.bp b/system/common/Android.bp index 37b2c1d8b2a72ee7f4af74762f2d0ec790fec6aa..80075732835a1a83f48c1bdaac65ee0c7a744567 100644 --- a/system/common/Android.bp +++ b/system/common/Android.bp @@ -10,7 +10,7 @@ package { cc_library_static { name: "libbt-common", defaults: [ - "fluoride_defaults", + "fluoride_basic_defaults", "clang_file_coverage", ], host_supported: true, @@ -33,18 +33,11 @@ cc_library_static { target: { android: { srcs: ["metrics.cc"], - shared_libs: ["libstatslog_bt"], }, host: { srcs: ["metrics_linux.cc"], }, }, - shared_libs: [ - "libcrypto", - ], - static_libs: [ - "libbt-protos-lite", - ], min_sdk_version: "Tiramisu" } @@ -107,6 +100,8 @@ cc_test { "test/thread_performance_test.cc", ], shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", "liblog", ], static_libs: [ diff --git a/system/device/Android.bp b/system/device/Android.bp index 152331d66518b37664b1718866a3684204322d29..a632d979a8166b1a3aa979c2eb13b1f3f83aa8b9 100644 --- a/system/device/Android.bp +++ b/system/device/Android.bp @@ -10,7 +10,7 @@ package { cc_library_static { name: "libbtdevice", - defaults: ["fluoride_defaults"], + defaults: ["fluoride_basic_defaults"], host_supported: true, local_include_dirs: [ "include", @@ -26,9 +26,6 @@ cc_library_static { "src/esco_parameters.cc", "src/interop.cc", ], - shared_libs: [ - "liblog", - ], min_sdk_version: "Tiramisu" } @@ -42,6 +39,8 @@ cc_test { "test/interop_test.cc", ], shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", "liblog", "libdl", ], diff --git a/system/gd/Android.bp b/system/gd/Android.bp index 449639bb708831c77706cb270f4d1c3fc1b4568e..35a0914443cc760c3688ac15d6bd42ff9bf48fc7 100644 --- a/system/gd/Android.bp +++ b/system/gd/Android.bp @@ -135,6 +135,7 @@ cc_defaults { defaults: [ "gd_defaults", "gd_clang_file_coverage", + "libchrome_support_defaults", ], host_supported: true, target: { @@ -195,7 +196,6 @@ cc_defaults { "BluetoothGeneratedPackets_h", ], shared_libs: [ - "libchrome", "libcrypto", "libflatbuffers-cpp", ], @@ -204,6 +204,9 @@ cc_defaults { "libbluetooth-protos", "libbluetooth_rust_interop", "libbt-platform-protos-lite", + "libbt_callbacks_cxx", + "libbt_shim_bridge", + "libbt_shim_ffi", ], export_static_lib_headers: [ "libbluetooth_rust_interop" ], } @@ -234,6 +237,7 @@ cc_binary { defaults: [ "gd_defaults", "gd_clang_coverage_bin", + "libchrome_support_defaults", ], host_supported: true, srcs: [ @@ -268,10 +272,12 @@ cc_binary { "libbluetooth_gd", "libflatbuffers-cpp", "libbluetooth_rust_interop", + "libbt_callbacks_cxx", + "libbt_shim_bridge", + "libbt_shim_ffi", ], shared_libs: [ "libbacktrace", - "libchrome", "libcrypto", "libgrpc++", "libgrpc++_unsecure", @@ -310,6 +316,7 @@ cc_test { defaults: [ "gd_defaults", "gd_clang_coverage_bin", + "libchrome_support_defaults", ], host_supported: true, test_options: { @@ -332,16 +339,19 @@ cc_test { ":BluetoothHalTestSources_hci_android_hidl", ":BluetoothOsTestSources_android", ], + static_libs: [ + "android.system.suspend.control-V1-ndk", + "android.system.suspend-V1-ndk", + "libstatslog_bt", + ], shared_libs: [ "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", - "android.system.suspend.control-V1-ndk", - "android.system.suspend-V1-ndk", "libbinder_ndk", + "libcutils", "libhidlbase", "libutils", - "libcutils", - "libstatslog_bt", + "libstatssocket", ], }, }, @@ -377,12 +387,12 @@ cc_test { "libflatbuffers-cpp", "libgmock", "libbluetooth_rust_interop", + "libbt_callbacks_cxx", + "libbt_shim_bridge", + "libbt_shim_ffi", ], shared_libs: [ - "libchrome", "libcrypto", - "libgrpc++", - "libgrpc_wrap", ], sanitize: { address: true, @@ -395,6 +405,7 @@ cc_test { defaults: [ "gd_defaults", "gd_clang_coverage_bin", + "libchrome_support_defaults", ], include_dirs: ["packages/modules/Bluetooth/system/gd"], host_supported: true, @@ -414,12 +425,10 @@ cc_test { cfi: true, }, static_libs: [ - "libchrome", "libbluetooth_rust_interop", - ], - shared_libs: [ - "libgrpc++", - "libgrpc_wrap", + "libbt_callbacks_cxx", + "libbt_shim_bridge", + "libbt_shim_ffi", ], target: { android: { @@ -431,6 +440,15 @@ cc_test { "libcutils", ], }, + linux_glibc: { + shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", + "libhidlbase", + "libutils", + "libcutils", + ], + }, }, } @@ -448,6 +466,9 @@ cc_defaults { "libgmock", "libgtest", "libbluetooth_rust_interop", + "libbt_callbacks_cxx", + "libbt_shim_bridge", + "libbt_shim_ffi", ], host_supported: true, generated_headers: [ @@ -508,7 +529,10 @@ cc_fuzz { cc_benchmark { name: "bluetooth_benchmark_gd", - defaults: ["gd_defaults"], + defaults: [ + "gd_defaults", + "libchrome_support_defaults" + ], host_supported: true, srcs: [ "benchmark.cc", @@ -516,9 +540,7 @@ cc_benchmark { ], static_libs: [ "libbluetooth_gd", - ], - shared_libs: [ - "libchrome", + "libbt_shim_bridge", ], } diff --git a/system/gd/common/byte_array_test.cc b/system/gd/common/byte_array_test.cc index f06b274adb8fbf473dbd69f25a40e1e873e15d82..114a79c3440eb51e56f56040d2710b833ee2ce59 100644 --- a/system/gd/common/byte_array_test.cc +++ b/system/gd/common/byte_array_test.cc @@ -31,7 +31,7 @@ static uint8_t data[16] = { TEST(ByteArrayTest, test_constructor_array) { ByteArray<16> byte_array(data); - for (int i = 0; i < ByteArray<16>::kLength; i++) { + for (size_t i = 0; i < ByteArray<16>::kLength; i++) { ASSERT_EQ(data[i], byte_array.bytes[i]); } } @@ -40,7 +40,7 @@ TEST(ByteArrayTest, test_from_str) { auto byte_array = ByteArray<16>::FromString(test_bytes); ASSERT_TRUE(byte_array); - for (int i = 0; i < ByteArray<16>::kLength; i++) { + for (size_t i = 0; i < ByteArray<16>::kLength; i++) { ASSERT_EQ(test_data[i], byte_array->bytes[i]); } } diff --git a/system/gd/common/circular_buffer_test.cc b/system/gd/common/circular_buffer_test.cc index bc67207944e48a778a215f281143fe0656243ad3..dc238c2f879e80c7bd3ef63c00687ebbd338ef76 100644 --- a/system/gd/common/circular_buffer_test.cc +++ b/system/gd/common/circular_buffer_test.cc @@ -94,7 +94,7 @@ TEST(CircularBufferTest, max_timestamps) { } auto vec = buffer.Pull(); - ASSERT_EQ(10, vec.size()); + ASSERT_EQ(10ul, vec.size()); int i = 0 + 1; for (auto v : vec) { diff --git a/system/gd/common/list_map_test.cc b/system/gd/common/list_map_test.cc index e682eea50868731b3d656cf1e9f580298c436ca2..580616f1a5a363945e301326420e562118f1fb40 100644 --- a/system/gd/common/list_map_test.cc +++ b/system/gd/common/list_map_test.cc @@ -28,7 +28,7 @@ using bluetooth::common::ListMap; TEST(ListMapTest, empty_test) { ListMap<int, int> list_map; - EXPECT_EQ(list_map.size(), 0); + EXPECT_EQ(list_map.size(), 0ul); EXPECT_EQ(list_map.find(42), list_map.end()); list_map.clear(); // should not crash EXPECT_EQ(list_map.find(42), list_map.end()); @@ -180,7 +180,7 @@ TEST(ListMapTest, splice_same_list_test) { TEST(ListMapTest, put_get_and_contains_key_test) { ListMap<int, int> list_map; - EXPECT_EQ(list_map.size(), 0); + EXPECT_EQ(list_map.size(), 0ul); EXPECT_EQ(list_map.find(42), list_map.end()); EXPECT_FALSE(list_map.contains(42)); list_map.insert_or_assign(56, 200); @@ -350,7 +350,7 @@ TEST(ListMapTest, pressure_test) { EXPECT_EQ(iter->second, key); EXPECT_TRUE(list_map.extract(key)); } - EXPECT_EQ(list_map.size(), 0); + EXPECT_EQ(list_map.size(), 0ul); // test execution time auto done = std::chrono::high_resolution_clock::now(); diff --git a/system/gd/common/lru_cache_test.cc b/system/gd/common/lru_cache_test.cc index 62b03dd2e1216c0ec848474fdf270404053f5210..d4aebf3f6eb159da51c3845e5e8088a956fc310b 100644 --- a/system/gd/common/lru_cache_test.cc +++ b/system/gd/common/lru_cache_test.cc @@ -28,7 +28,7 @@ using bluetooth::common::LruCache; TEST(LruCacheTest, empty_test) { LruCache<int, int> cache(3); // capacity = 3; - EXPECT_EQ(cache.size(), 0); + EXPECT_EQ(cache.size(), 0ul); EXPECT_EQ(cache.find(42), cache.end()); cache.clear(); // should not crash EXPECT_EQ(cache.find(42), cache.end()); @@ -167,7 +167,7 @@ TEST(LruCacheTest, erase_in_for_loop_test) { TEST(LruCacheTest, get_and_contains_key_test) { LruCache<int, int> cache(3); // capacity = 3; - EXPECT_EQ(cache.size(), 0); + EXPECT_EQ(cache.size(), 0ul); EXPECT_EQ(cache.find(42), cache.end()); EXPECT_FALSE(cache.contains(42)); EXPECT_FALSE(cache.insert_or_assign(56, 200)); @@ -186,11 +186,11 @@ TEST(LruCacheTest, put_and_get_sequence_1) { // Section 1: Ordered put and ordered get LruCache<int, int> cache(3); // capacity = 3; EXPECT_FALSE(cache.insert_or_assign(1, 10)); - EXPECT_EQ(cache.size(), 1); + EXPECT_EQ(cache.size(), 1ul); EXPECT_FALSE(cache.insert_or_assign(2, 20)); - EXPECT_EQ(cache.size(), 2); + EXPECT_EQ(cache.size(), 2ul); EXPECT_FALSE(cache.insert_or_assign(3, 30)); - EXPECT_EQ(cache.size(), 3); + EXPECT_EQ(cache.size(), 3ul); // 3, 2, 1 after above operations auto evicted = cache.insert_or_assign(4, 40); @@ -210,7 +210,7 @@ TEST(LruCacheTest, put_and_get_sequence_1) { // Section 2: Over capacity put and ordered get evicted = cache.insert_or_assign(5, 50); // 5, 3, 2 after above operations, 4 is evicted - EXPECT_EQ(cache.size(), 3); + EXPECT_EQ(cache.size(), 3ul); EXPECT_TRUE(evicted); EXPECT_EQ(*evicted, std::make_pair(4, 40)); @@ -249,7 +249,7 @@ TEST(LruCacheTest, put_and_get_sequence_2) { EXPECT_EQ(*evicted, std::make_pair(1, 10)); EXPECT_FALSE(cache.insert_or_assign(2, 200)); // 2, 3 in cache, nothing is evicted - EXPECT_EQ(cache.size(), 2); + EXPECT_EQ(cache.size(), 2ul); EXPECT_FALSE(cache.contains(1)); LruCache<int, int>::const_iterator iter; @@ -274,7 +274,7 @@ TEST(LruCacheTest, put_and_get_sequence_2) { EXPECT_TRUE(cache.extract(4)); EXPECT_FALSE(cache.contains(4)); // 3 in cache - EXPECT_EQ(cache.size(), 1); + EXPECT_EQ(cache.size(), 1ul); EXPECT_FALSE(cache.insert_or_assign(2, 2000)); // 2, 3 in cache @@ -289,7 +289,7 @@ TEST(LruCacheTest, put_and_get_sequence_2) { EXPECT_FALSE(cache.insert_or_assign(5, 50)); EXPECT_FALSE(cache.insert_or_assign(1, 100)); EXPECT_FALSE(cache.insert_or_assign(5, 1000)); - EXPECT_EQ(cache.size(), 2); + EXPECT_EQ(cache.size(), 2ul); // 5, 1 in cache evicted = cache.insert_or_assign(6, 2000); @@ -448,7 +448,7 @@ TEST(LruCacheTest, pressure_test) { EXPECT_EQ(iter->second, key); EXPECT_TRUE(cache.extract(key)); } - EXPECT_EQ(cache.size(), 0); + EXPECT_EQ(cache.size(), 0ul); // test execution time auto done = std::chrono::high_resolution_clock::now(); diff --git a/system/gd/common/multi_priority_queue_test.cc b/system/gd/common/multi_priority_queue_test.cc index c0918adfee12d79e5cd96d2bdac6bc33078d16da..b40095205ecdab0f9009cb7b565031ccaab114d7 100644 --- a/system/gd/common/multi_priority_queue_test.cc +++ b/system/gd/common/multi_priority_queue_test.cc @@ -29,7 +29,7 @@ TEST(MultiPriorityQueueTest, without_high_priority_item) { q.push(0); q.push(1, 0); q.push(2); - ASSERT_EQ(q.size(), 3); + ASSERT_EQ(q.size(), 3ul); for (int i = 0; i < 3; i++) { ASSERT_EQ(q.front(), i); q.pop(); diff --git a/system/gd/common/sync_map_count_test.cc b/system/gd/common/sync_map_count_test.cc index 1ed8d6a69d086026ef755d40d96cf62b8315b3ae..d869200389472b5902123a7cc201137c7747b59b 100644 --- a/system/gd/common/sync_map_count_test.cc +++ b/system/gd/common/sync_map_count_test.cc @@ -51,19 +51,19 @@ TEST(SyncMapCount, simple) { SyncMapCount<std::string> map; LoadStringMap(map); - ASSERT_EQ(5, map.Size()); + ASSERT_EQ(5ul, map.Size()); auto m = map.Get(); - ASSERT_EQ(3, m["Three"]); - ASSERT_EQ(2, m["Two"]); - ASSERT_EQ(1, m["One"]); + ASSERT_EQ(3ul, m["Three"]); + ASSERT_EQ(2ul, m["Two"]); + ASSERT_EQ(1ul, m["One"]); } TEST(SyncMapCount, sized) { SyncMapCount<std::string> map(2); LoadStringMap(map); - ASSERT_EQ(2, map.Size()); + ASSERT_EQ(2ul, map.Size()); } TEST(SyncMapCount, sorted_string_value_low_to_high) { @@ -71,8 +71,8 @@ TEST(SyncMapCount, sorted_string_value_low_to_high) { LoadStringMap(map); auto entries = map.GetSortedLowToHigh(); - ASSERT_EQ(3, entries[entries.size() - 1].count); - ASSERT_EQ(2, entries[entries.size() - 2].count); + ASSERT_EQ(3ul, entries[entries.size() - 1].count); + ASSERT_EQ(2ul, entries[entries.size() - 2].count); } TEST(SyncMapCount, sorted_string_value_high_to_low) { @@ -80,8 +80,8 @@ TEST(SyncMapCount, sorted_string_value_high_to_low) { LoadStringMap(map); auto entries = map.GetSortedHighToLow(); - ASSERT_EQ(3, entries[0].count); - ASSERT_EQ(2, entries[1].count); + ASSERT_EQ(3ul, entries[0].count); + ASSERT_EQ(2ul, entries[1].count); } struct TestString { @@ -113,12 +113,12 @@ TEST(SyncMapCount, simple_struct) { SyncMapCount<TestString> map; LoadTestStringMap(map); - ASSERT_EQ(5, map.Size()); + ASSERT_EQ(5ul, map.Size()); auto m = map.Get(); - ASSERT_EQ(3, m[TestString("Three")]); - ASSERT_EQ(2, m[TestString("Two")]); - ASSERT_EQ(1, m[TestString("One")]); + ASSERT_EQ(3ul, m[TestString("Three")]); + ASSERT_EQ(2ul, m[TestString("Two")]); + ASSERT_EQ(1ul, m[TestString("One")]); } TEST(SyncMapCount, sorted_string_struct_value_low_to_high) { @@ -126,8 +126,8 @@ TEST(SyncMapCount, sorted_string_struct_value_low_to_high) { LoadTestStringMap(map); auto entries = map.GetSortedLowToHigh(); - ASSERT_EQ(3, entries[entries.size() - 1].count); - ASSERT_EQ(2, entries[entries.size() - 2].count); + ASSERT_EQ(3ul, entries[entries.size() - 1].count); + ASSERT_EQ(2ul, entries[entries.size() - 2].count); } TEST(SyncMapCount, sorted_string_struct_value_high_to_low) { @@ -135,22 +135,22 @@ TEST(SyncMapCount, sorted_string_struct_value_high_to_low) { LoadTestStringMap(map); auto entries = map.GetSortedHighToLow(); - ASSERT_EQ(3, entries[0].count); - ASSERT_EQ(2, entries[1].count); + ASSERT_EQ(3ul, entries[0].count); + ASSERT_EQ(2ul, entries[1].count); } TEST(SyncMapCount, locked_for_map_copy) { SyncMapCount<TestString> map; LoadTestStringMap(map); - ASSERT_EQ(5, map.Size()); + ASSERT_EQ(5ul, map.Size()); std::vector<SyncMapCount<TestString>::Item> vec; for (auto& it : map.Get()) { map.Clear(); vec.push_back(SyncMapCount<TestString>::Item{it.first, it.second}); } - ASSERT_EQ(0, map.Size()); - ASSERT_EQ(5, vec.size()); + ASSERT_EQ(0ul, map.Size()); + ASSERT_EQ(5ul, vec.size()); } } // namespace testing diff --git a/system/gd/hal/hci_hal_host_test.cc b/system/gd/hal/hci_hal_host_test.cc index da2ada6a0cdf209469b2a7f41408eb53e70e4566..884e4b9bb16f7c01686ff647c077dbc48ff0314b 100644 --- a/system/gd/hal/hci_hal_host_test.cc +++ b/system/gd/hal/hci_hal_host_test.cc @@ -325,7 +325,7 @@ TEST_F(HciHalRootcanalTest, receive_multiple_acl_batch) { for (int i = 0; i < num_packets; i++) { write(fake_server_socket_, incoming_packet.data(), incoming_packet.size()); } - while (incoming_packets_queue_.size() != num_packets) { + while (incoming_packets_queue_.size() != (size_t)num_packets) { } for (int i = 0; i < num_packets; i++) { auto packet = incoming_packets_queue_.front(); diff --git a/system/gd/hci/class_of_device_unittest.cc b/system/gd/hci/class_of_device_unittest.cc index eb0ced265325041c5b36678c5e851350b3e79e28..62d304c54b1dfb2c64626875a8fbbea599f2087b 100644 --- a/system/gd/hci/class_of_device_unittest.cc +++ b/system/gd/hci/class_of_device_unittest.cc @@ -102,12 +102,12 @@ TEST(ClassOfDeviceTest, classOfDeviceFromUint32Legacy) { auto cod = ClassOfDevice::FromUint32Legacy(0); ASSERT_TRUE(cod); ASSERT_THAT(cod->cod, testing::ElementsAre(0x00, 0x00, 0x00)); - ASSERT_EQ(cod->ToUint32Legacy(), 0); + ASSERT_EQ(cod->ToUint32Legacy(), 0ul); cod = ClassOfDevice::FromUint32Legacy(0xab214c); ASSERT_TRUE(cod); ASSERT_THAT(cod->cod, testing::ElementsAre(0xab, 0x21, 0x4c)); - ASSERT_EQ(cod->ToUint32Legacy(), 0xab214c); + ASSERT_EQ(cod->ToUint32Legacy(), 0xab214cul); ASSERT_FALSE(ClassOfDevice::FromUint32Legacy(0x1ab214c)); } diff --git a/system/gd/hci/hci_packets_test.cc b/system/gd/hci/hci_packets_test.cc index 99963354517aa7189d9fb1334b63c2128d4a30c6..06148c1ed6e8d45493e97260f412b294906bf1f8 100644 --- a/system/gd/hci/hci_packets_test.cc +++ b/system/gd/hci/hci_packets_test.cc @@ -73,15 +73,15 @@ TEST(HciPacketsTest, testWriteExtendedInquiryResponse) { auto view = WriteExtendedInquiryResponseView::Create(CommandView::Create(packet_bytes_view)); ASSERT_TRUE(view.IsValid()); auto gap_data = view.GetExtendedInquiryResponse(); - ASSERT_GE(gap_data.size(), 4); + ASSERT_GE(gap_data.size(), 4ul); ASSERT_EQ(gap_data[0].data_type_, GapDataType::COMPLETE_LOCAL_NAME); - ASSERT_EQ(gap_data[0].data_.size(), 10); + ASSERT_EQ(gap_data[0].data_.size(), 10ul); ASSERT_EQ(gap_data[1].data_type_, GapDataType::COMPLETE_LIST_16_BIT_UUIDS); - ASSERT_EQ(gap_data[1].data_.size(), 24); + ASSERT_EQ(gap_data[1].data_.size(), 24ul); ASSERT_EQ(gap_data[2].data_type_, GapDataType::COMPLETE_LIST_32_BIT_UUIDS); - ASSERT_EQ(gap_data[2].data_.size(), 0); + ASSERT_EQ(gap_data[2].data_.size(), 0ul); ASSERT_EQ(gap_data[3].data_type_, GapDataType::COMPLETE_LIST_128_BIT_UUIDS); - ASSERT_EQ(gap_data[3].data_.size(), 128); + ASSERT_EQ(gap_data[3].data_.size(), 128ul); std::vector<GapData> no_padding{gap_data.begin(), gap_data.begin() + 4}; auto builder = WriteExtendedInquiryResponseBuilder::Create(view.GetFecRequired(), no_padding); @@ -171,7 +171,7 @@ TEST(HciPacketsTest, testLeSetExtendedScanParameters) { ASSERT_TRUE(view.IsValid()); ASSERT_EQ(1, view.GetScanningPhys()); auto params = view.GetParameters(); - ASSERT_EQ(1, params.size()); + ASSERT_EQ(1ul, params.size()); ASSERT_EQ(LeScanType::ACTIVE, params[0].le_scan_type_); ASSERT_EQ(18, params[0].le_scan_interval_); ASSERT_EQ(18, params[0].le_scan_window_); @@ -190,7 +190,7 @@ TEST(HciPacketsTest, testLeSetExtendedScanParameters_6553) { ASSERT_TRUE(view.IsValid()); ASSERT_EQ(1, view.GetScanningPhys()); auto params = view.GetParameters(); - ASSERT_EQ(1, params.size()); + ASSERT_EQ(1ul, params.size()); ASSERT_EQ(LeScanType::ACTIVE, params[0].le_scan_type_); ASSERT_EQ(6553, params[0].le_scan_interval_); ASSERT_EQ(6553, params[0].le_scan_window_); @@ -291,8 +291,8 @@ TEST(HciPacketsTest, testLeSetExtendedAdvertisingParametersLegacySet0) { LeAdvertisingCommandView::Create(CommandView::Create(packet_bytes_view))); ASSERT_TRUE(view.IsValid()); ASSERT_EQ(0, view.GetAdvertisingHandle()); - ASSERT_EQ(400, view.GetPrimaryAdvertisingIntervalMin()); - ASSERT_EQ(450, view.GetPrimaryAdvertisingIntervalMax()); + ASSERT_EQ(400ul, view.GetPrimaryAdvertisingIntervalMin()); + ASSERT_EQ(450ul, view.GetPrimaryAdvertisingIntervalMax()); ASSERT_EQ(0x7, view.GetPrimaryAdvertisingChannelMap()); ASSERT_EQ(OwnAddressType::RANDOM_DEVICE_ADDRESS, view.GetOwnAddressType()); ASSERT_EQ(PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS, view.GetPeerAddressType()); @@ -314,8 +314,8 @@ TEST(HciPacketsTest, testLeSetExtendedAdvertisingParametersSet1) { LeAdvertisingCommandView::Create(CommandView::Create(packet_bytes_view))); ASSERT_TRUE(view.IsValid()); ASSERT_EQ(1, view.GetAdvertisingHandle()); - ASSERT_EQ(400, view.GetPrimaryAdvertisingIntervalMin()); - ASSERT_EQ(450, view.GetPrimaryAdvertisingIntervalMax()); + ASSERT_EQ(400ul, view.GetPrimaryAdvertisingIntervalMin()); + ASSERT_EQ(450ul, view.GetPrimaryAdvertisingIntervalMax()); ASSERT_EQ(0x7, view.GetPrimaryAdvertisingChannelMap()); ASSERT_EQ(OwnAddressType::RANDOM_DEVICE_ADDRESS, view.GetOwnAddressType()); ASSERT_EQ(PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS, view.GetPeerAddressType()); @@ -363,7 +363,7 @@ TEST(HciPacketsTest, testLeSetExtendedAdvertisingDisable1) { LeAdvertisingCommandView::Create(CommandView::Create(packet_bytes_view))); ASSERT_TRUE(view.IsValid()); auto disabled_set = view.GetDisabledSets(); - ASSERT_EQ(1, disabled_set.size()); + ASSERT_EQ(1ul, disabled_set.size()); ASSERT_EQ(1, disabled_set[0].advertising_handle_); } @@ -372,7 +372,7 @@ TEST(HciPacketsTest, testLeSetAdvertisingDataBuilderLength) { gap_data.data_type_ = GapDataType::COMPLETE_LOCAL_NAME; gap_data.data_ = std::vector<uint8_t>({'A', ' ', 'g', 'o', 'o', 'd', ' ', 'n', 'a', 'm', 'e'}); auto builder = LeSetAdvertisingDataBuilder::Create({gap_data}); - ASSERT_EQ(2 /*opcode*/ + 1 /* parameter size */ + 1 /* data_length */ + 31 /* data */, builder->size()); + ASSERT_EQ(2ul /*opcode*/ + 1ul /* parameter size */ + 1ul /* data_length */ + 31ul /* data */, builder->size()); auto packet_bytes = std::make_shared<std::vector<uint8_t>>(); packet_bytes->reserve(builder->size()); @@ -380,7 +380,7 @@ TEST(HciPacketsTest, testLeSetAdvertisingDataBuilderLength) { builder->Serialize(bit_inserter); auto command_view = LeAdvertisingCommandView::Create(CommandView::Create(PacketView<kLittleEndian>(packet_bytes))); ASSERT_TRUE(command_view.IsValid()); - ASSERT_EQ(1 /* data_length */ + 31 /* data */, command_view.GetPayload().size()); + ASSERT_EQ(1ul /* data_length */ + 31ul /* data */, command_view.GetPayload().size()); auto view = LeSetAdvertisingDataView::Create(command_view); ASSERT_TRUE(view.IsValid()); } @@ -390,7 +390,7 @@ TEST(HciPacketsTest, testLeSetScanResponseDataBuilderLength) { gap_data.data_type_ = GapDataType::COMPLETE_LOCAL_NAME; gap_data.data_ = std::vector<uint8_t>({'A', ' ', 'g', 'o', 'o', 'd', ' ', 'n', 'a', 'm', 'e'}); auto builder = LeSetScanResponseDataBuilder::Create({gap_data}); - ASSERT_EQ(2 /*opcode*/ + 1 /* parameter size */ + 1 /*data_length */ + 31 /* data */, builder->size()); + ASSERT_EQ(2ul /*opcode*/ + 1ul /* parameter size */ + 1ul /*data_length */ + 31ul /* data */, builder->size()); auto packet_bytes = std::make_shared<std::vector<uint8_t>>(); packet_bytes->reserve(builder->size()); @@ -398,7 +398,7 @@ TEST(HciPacketsTest, testLeSetScanResponseDataBuilderLength) { builder->Serialize(bit_inserter); auto command_view = LeAdvertisingCommandView::Create(CommandView::Create(PacketView<kLittleEndian>(packet_bytes))); ASSERT_TRUE(command_view.IsValid()); - ASSERT_EQ(1 /* data_length */ + 31 /* data */, command_view.GetPayload().size()); + ASSERT_EQ(1ul /* data_length */ + 31ul /* data */, command_view.GetPayload().size()); auto view = LeSetScanResponseDataView::Create(command_view); ASSERT_TRUE(view.IsValid()); } @@ -419,7 +419,7 @@ TEST(HciPacketsTest, testLeMultiAdvSetAdvertisingDataBuilderLength) { ASSERT_TRUE(command_view.IsValid()); auto view = LeMultiAdvtSetDataView::Create(command_view); ASSERT_TRUE(view.IsValid()); - ASSERT_TRUE(view.GetAdvertisingData().size() > 0); + ASSERT_TRUE(view.GetAdvertisingData().size() > 0ul); ASSERT_EQ(view.GetAdvertisingData()[0].data_, gap_data.data_); ASSERT_EQ(view.GetAdvertisingInstance(), 3); } diff --git a/system/gd/l2cap/l2cap_packet_test.cc b/system/gd/l2cap/l2cap_packet_test.cc index 7a413f41c03f901d42e0fe600df1440fe0409cc3..0bf9017c7a023cc021d7fbe03dc17f85f445414b 100644 --- a/system/gd/l2cap/l2cap_packet_test.cc +++ b/system/gd/l2cap/l2cap_packet_test.cc @@ -80,7 +80,7 @@ TEST(L2capPacketsTest, testConfigRequestOptions) { PacketView<kLittleEndian> packet_bytes_view(view_bytes); auto view = ConfigurationRequestView::Create(ControlView::Create(packet_bytes_view)); ASSERT_TRUE(view.IsValid()); - ASSERT_EQ(1, view.GetConfig().size()); + ASSERT_EQ(1ul, view.GetConfig().size()); } { @@ -90,7 +90,7 @@ TEST(L2capPacketsTest, testConfigRequestOptions) { PacketView<kLittleEndian> packet_bytes_view(view_bytes); auto view = ConfigurationRequestView::Create(ControlView::Create(packet_bytes_view)); ASSERT_TRUE(view.IsValid()); - ASSERT_EQ(2, view.GetConfig().size()); + ASSERT_EQ(2ul, view.GetConfig().size()); } { @@ -100,7 +100,7 @@ TEST(L2capPacketsTest, testConfigRequestOptions) { PacketView<kLittleEndian> packet_bytes_view(view_bytes); auto view = ConfigurationRequestView::Create(ControlView::Create(packet_bytes_view)); ASSERT_TRUE(view.IsValid()); - ASSERT_EQ(2, view.GetConfig().size()); + ASSERT_EQ(2ul, view.GetConfig().size()); } { @@ -110,7 +110,7 @@ TEST(L2capPacketsTest, testConfigRequestOptions) { PacketView<kLittleEndian> packet_bytes_view(view_bytes); auto view = ConfigurationRequestView::Create(ControlView::Create(packet_bytes_view)); ASSERT_TRUE(view.IsValid()); - ASSERT_EQ(1, view.GetConfig().size()); + ASSERT_EQ(1ul, view.GetConfig().size()); } { @@ -120,7 +120,7 @@ TEST(L2capPacketsTest, testConfigRequestOptions) { PacketView<kLittleEndian> packet_bytes_view(view_bytes); auto view = ConfigurationRequestView::Create(ControlView::Create(packet_bytes_view)); ASSERT_TRUE(view.IsValid()); - ASSERT_EQ(2, view.GetConfig().size()); + ASSERT_EQ(2ul, view.GetConfig().size()); } } diff --git a/system/gd/os/linux_generic/queue_unittest.cc b/system/gd/os/linux_generic/queue_unittest.cc index 90f061ccdb1c8405d959cafeb160d7c43c7263db..3739735a0a6e9de199030afece766ce6c8490ea5 100644 --- a/system/gd/os/linux_generic/queue_unittest.cc +++ b/system/gd/os/linux_generic/queue_unittest.cc @@ -157,7 +157,7 @@ class TestDequeueEnd { std::unique_ptr<std::string> data = queue_->TryDequeue(); buffer_.push(std::move(data)); - if (buffer_.size() == capacity_) { + if (buffer_.size() == (size_t)capacity_) { queue_->UnregisterDequeue(); } @@ -475,7 +475,7 @@ TEST_F(QueueTest, queue_becomes_full_dequeue_callback_slower) { // Wait for enqueue buffer empty and expect queue is full enqueue_future.wait(); EXPECT_EQ(enqueue_future.get(), 0); - EXPECT_GE(test_dequeue_end.buffer_.size(), kQueueSize - 1); + EXPECT_GE(test_dequeue_end.buffer_.size(), (size_t)(kQueueSize - 1)); test_dequeue_end.UnregisterDequeue(); } @@ -535,7 +535,7 @@ TEST_F(QueueTest, queue_becomes_non_full_during_test) { // Expect kQueueSize data block in enqueue end buffer std::this_thread::sleep_for(std::chrono::milliseconds(20)); - EXPECT_EQ(test_enqueue_end.buffer_.size(), kQueueSize); + EXPECT_EQ(test_enqueue_end.buffer_.size(), (size_t)kQueueSize); // Register dequeue std::unordered_map<int, std::promise<int>> dequeue_promise_map; diff --git a/system/gd/os/linux_generic/wakelock_manager_unittest.cc b/system/gd/os/linux_generic/wakelock_manager_unittest.cc index 0ae9704484148e7018e08e5578c30d26ea87675c..4359371902a5c91359e9b5fcd35da4d7133f768d 100644 --- a/system/gd/os/linux_generic/wakelock_manager_unittest.cc +++ b/system/gd/os/linux_generic/wakelock_manager_unittest.cc @@ -104,12 +104,12 @@ TEST_F(WakelockManagerTest, test_set_os_callouts_repeated_acquire) { WakelockManager::Get().Acquire(); SyncHandler(); - ASSERT_EQ(os_callouts.acquired_lock_counts.size(), 1); + ASSERT_EQ(os_callouts.acquired_lock_counts.size(), (size_t)1); ASSERT_THAT(os_callouts.GetNetAcquiredCount(WakelockManager::kBtWakelockId), Optional(Eq(1))); WakelockManager::Get().Acquire(); SyncHandler(); - ASSERT_EQ(os_callouts.acquired_lock_counts.size(), 1); + ASSERT_EQ(os_callouts.acquired_lock_counts.size(), (size_t)1); ASSERT_THAT(os_callouts.GetNetAcquiredCount(WakelockManager::kBtWakelockId), Optional(Eq(2))); WakelockManager::Get().Release(); @@ -130,12 +130,12 @@ TEST_F(WakelockManagerTest, test_set_os_callouts_repeated_release) { WakelockManager::Get().Acquire(); SyncHandler(); - ASSERT_EQ(os_callouts.acquired_lock_counts.size(), 1); + ASSERT_EQ(os_callouts.acquired_lock_counts.size(), (size_t)1); ASSERT_THAT(os_callouts.GetNetAcquiredCount(WakelockManager::kBtWakelockId), Optional(Eq(1))); WakelockManager::Get().Release(); SyncHandler(); - ASSERT_EQ(os_callouts.acquired_lock_counts.size(), 1); + ASSERT_EQ(os_callouts.acquired_lock_counts.size(), (size_t)1); ASSERT_THAT(os_callouts.GetNetAcquiredCount(WakelockManager::kBtWakelockId), Optional(Eq(0))); // OS callouts allow pass through for repeated release calls @@ -158,7 +158,7 @@ TEST_F(WakelockManagerTest, test_with_os_callouts_in_a_loop_and_dump) { for (size_t i = 0; i < 1000; i++) { WakelockManager::Get().Acquire(); SyncHandler(); - ASSERT_EQ(os_callouts.acquired_lock_counts.size(), 1); + ASSERT_EQ(os_callouts.acquired_lock_counts.size(), (size_t)1); ASSERT_THAT(os_callouts.GetNetAcquiredCount(WakelockManager::kBtWakelockId), Optional(Eq(1))); WakelockManager::Get().Release(); SyncHandler(); diff --git a/system/gd/packet/fragmenting_inserter_unittest.cc b/system/gd/packet/fragmenting_inserter_unittest.cc index c2f1124da5a41df8c268a132a68cb537cb6dfd45..ab833194fdfe0cf8fcd4f9f3fff69a41d651ee0b 100644 --- a/system/gd/packet/fragmenting_inserter_unittest.cc +++ b/system/gd/packet/fragmenting_inserter_unittest.cc @@ -41,7 +41,7 @@ TEST(FragmentingInserterTest, addMoreBits) { it.finalize(); - ASSERT_EQ(1, fragments.size()); + ASSERT_EQ(1ul, fragments.size()); std::vector<uint8_t> bytes; BitInserter bit_inserter(bytes); @@ -71,7 +71,7 @@ TEST(FragmentingInserterTest, observerTest) { it.insert_bits(static_cast<uint8_t>(0b1010), 4); it.finalize(); - ASSERT_EQ(1, fragments.size()); + ASSERT_EQ(1ul, fragments.size()); std::vector<uint8_t> bytes; BitInserter bit_inserter(bytes); @@ -102,22 +102,22 @@ TEST(FragmentingInserterTest, testMtuBoundaries) { FragmentingInserter it(kPacketSize, std::back_insert_iterator(fragments_mtu_is_kPacketSize)); counts.Serialize(it); it.finalize(); - ASSERT_EQ(1, fragments_mtu_is_kPacketSize.size()); + ASSERT_EQ(1ul, fragments_mtu_is_kPacketSize.size()); ASSERT_EQ(kPacketSize, fragments_mtu_is_kPacketSize[0]->size()); std::vector<std::unique_ptr<RawBuilder>> fragments_mtu_is_less; FragmentingInserter it_less(kPacketSize - 1, std::back_insert_iterator(fragments_mtu_is_less)); counts.Serialize(it_less); it_less.finalize(); - ASSERT_EQ(2, fragments_mtu_is_less.size()); - ASSERT_EQ(kPacketSize - 1, fragments_mtu_is_less[0]->size()); - ASSERT_EQ(1, fragments_mtu_is_less[1]->size()); + ASSERT_EQ(2ul, fragments_mtu_is_less.size()); + ASSERT_EQ(kPacketSize - 1ul, fragments_mtu_is_less[0]->size()); + ASSERT_EQ(1ul, fragments_mtu_is_less[1]->size()); std::vector<std::unique_ptr<RawBuilder>> fragments_mtu_is_more; FragmentingInserter it_more(kPacketSize + 1, std::back_insert_iterator(fragments_mtu_is_more)); counts.Serialize(it_more); it_more.finalize(); - ASSERT_EQ(1, fragments_mtu_is_more.size()); + ASSERT_EQ(1ul, fragments_mtu_is_more.size()); ASSERT_EQ(kPacketSize, fragments_mtu_is_more[0]->size()); } diff --git a/system/gd/packet/packet_view_unittest.cc b/system/gd/packet/packet_view_unittest.cc index 208784e796117fc683374f75cc02aae8eee9d56a..c0d7a0e1bb48544d048eba543c7f74dc9a219802 100644 --- a/system/gd/packet/packet_view_unittest.cc +++ b/system/gd/packet/packet_view_unittest.cc @@ -347,15 +347,15 @@ TYPED_TEST(IteratorTest, subrangeTest) { ASSERT_EQ(*(all + 1), 1); auto subrange = all.Subrange(0, 1); - ASSERT_EQ(1, subrange.NumBytesRemaining()); + ASSERT_EQ(1ul, subrange.NumBytesRemaining()); ASSERT_EQ(*(subrange), 0); subrange = this->packet->begin().Subrange(0, 4); - ASSERT_EQ(4, subrange.NumBytesRemaining()); + ASSERT_EQ(4ul, subrange.NumBytesRemaining()); ASSERT_EQ(*(subrange + 1), 1); subrange = all.Subrange(0, 3); - ASSERT_EQ(3, subrange.NumBytesRemaining()); + ASSERT_EQ(3ul, subrange.NumBytesRemaining()); ASSERT_EQ(*(subrange + 1), 1); subrange = all.Subrange(0, all.NumBytesRemaining() - 1); @@ -383,15 +383,15 @@ TYPED_TEST(IteratorTest, subrangeTest) { ASSERT_EQ(*subrange, 2); subrange = all.Subrange(1, 1); - ASSERT_EQ(1, subrange.NumBytesRemaining()); + ASSERT_EQ(1ul, subrange.NumBytesRemaining()); ASSERT_EQ(*(subrange), 1); subrange = all.Subrange(1, 2); - ASSERT_EQ(2, subrange.NumBytesRemaining()); + ASSERT_EQ(2ul, subrange.NumBytesRemaining()); ASSERT_EQ(*(subrange), 1); subrange = all.Subrange(2, 1); - ASSERT_EQ(1, subrange.NumBytesRemaining()); + ASSERT_EQ(1ul, subrange.NumBytesRemaining()); ASSERT_EQ(*(subrange), 2); subrange = this->packet->begin().Subrange(this->packet->size() - 1, 2); diff --git a/system/gd/packet/parser/test/generated_packet_test.cc b/system/gd/packet/parser/test/generated_packet_test.cc index 5a1d582090a4b7b0ee26b5be959b0976f6dac6a2..68709131491658456095f5693560c6ee95b155a3 100644 --- a/system/gd/packet/parser/test/generated_packet_test.cc +++ b/system/gd/packet/parser/test/generated_packet_test.cc @@ -568,7 +568,7 @@ TEST(GeneratedPacketTest, testFixedSizeByteArray) { for (uint32_t i = 0; i < word_array_size; i++) word_array[i] = i; auto packet = PacketWithFixedArraysOfBytesBuilder::Create(byte_array, word_array); - ASSERT_EQ(2 * (256 / 8), packet->size()); + ASSERT_EQ((size_t)(2 * (256 / 8)), packet->size()); std::shared_ptr<std::vector<uint8_t>> packet_bytes = std::make_shared<std::vector<uint8_t>>(); BitInserter it(*packet_bytes); @@ -1118,7 +1118,7 @@ TEST(GeneratedPacketTest, testOneArrayOfStructAndAnotherStruct) { auto view = OneArrayOfStructAndAnotherStructView::Create(packet_bytes_view); ASSERT_TRUE(view.IsValid()); auto one = view.GetOne(); - ASSERT_EQ(one.array_.size(), 3); + ASSERT_EQ(one.array_.size(), 3ul); ASSERT_EQ(one.another_.id_, 4); ASSERT_EQ(one.another_.count_, 0x0804); } @@ -1901,7 +1901,7 @@ TEST(GeneratedPacketTest, testOneGenericStructArrayNoZeroEmpty) { too_few_bytes = std::make_shared<std::vector<uint8_t>>(a_two_byte_struct); view = OneGenericStructArrayNoZeroView::Create(PacketView<kLittleEndian>(too_few_bytes)); ASSERT_TRUE(view.IsValid()); - ASSERT_EQ(1, view.GetAnArray().size()); + ASSERT_EQ(1ul, view.GetAnArray().size()); } TEST(GeneratedPacketTest, testToStringOutput) { diff --git a/system/gd/rust/shim/Android.bp b/system/gd/rust/shim/Android.bp index 6df6a31c0590e654a7c5da3c284e6e227ee0abfc..91e91e1c966a464b09211a7f0e4ff64079d7fda6 100644 --- a/system/gd/rust/shim/Android.bp +++ b/system/gd/rust/shim/Android.bp @@ -46,7 +46,7 @@ rust_defaults { proc_macros: [ "libpaste", ], - whole_static_libs: [ + static_libs: [ "libbt_callbacks_cxx", ], } @@ -68,7 +68,10 @@ rust_ffi_static { cc_library_static { name: "libbt_shim_bridge", - defaults: ["gd_ffi_defaults"], + defaults: [ + "gd_ffi_defaults", + "libchrome_support_defaults" + ], generated_headers: [ "libbt_init_flags_bridge_header", "libbt_shim_bridge_header", @@ -99,16 +102,16 @@ cc_library_static { "//apex_available:platform", "com.android.bluetooth", ], - shared_libs: [ - "libchrome", - ], min_sdk_version: "30", } cc_library_static { name: "libbluetooth_rust_interop", - defaults: ["gd_ffi_defaults"], - whole_static_libs: [ + defaults: [ + "gd_ffi_defaults", + "libchrome_support_defaults" + ], + static_libs: [ "libbt_shim_bridge", "libbt_shim_ffi", ], @@ -122,13 +125,13 @@ cc_library_static { cc_library_static { name: "libbt_callbacks_cxx", - defaults: ["gd_ffi_defaults"], + defaults: [ + "gd_ffi_defaults", + "libchrome_support_defaults" + ], header_libs: ["libbt_callbacks_cxx_headers"], srcs: ["callbacks/callbacks.cc"], generated_headers: ["libbt_shim_bridge_header", "cxx-bridge-header"], - shared_libs: [ - "libchrome", - ], host_supported: true, apex_available: [ "//apex_available:platform", diff --git a/system/gd/rust/topshim/Android.bp b/system/gd/rust/topshim/Android.bp index 8098b1027adf2e11118d5f1beee816bf0eb1404d..b24cbb67d65ff09edc195d70471b062ccf10e0c6 100644 --- a/system/gd/rust/topshim/Android.bp +++ b/system/gd/rust/topshim/Android.bp @@ -43,7 +43,10 @@ rust_library_host_rlib { cc_library_static { name: "libbt_topshim_cxx", - defaults: ["gd_ffi_defaults"], + defaults: [ + "gd_ffi_defaults", + "libchrome_support_defaults", + ], header_libs: ["libbt_callbacks_cxx_headers"], srcs: [ "btav/btav_shim.cc", @@ -62,9 +65,6 @@ cc_library_static { "cxx-bridge-header" ], generated_sources: ["libbt_topshim_bridge_code"], - shared_libs: [ - "libchrome", - ], include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/gd", diff --git a/system/gd/rust/topshim/btav/btav_shim.cc b/system/gd/rust/topshim/btav/btav_shim.cc index fd1173e8649fec8c76307a2b681312384cbfb847..3846eb375cebf47cea9fdbb9c4115a376837af8c 100644 --- a/system/gd/rust/topshim/btav/btav_shim.cc +++ b/system/gd/rust/topshim/btav/btav_shim.cc @@ -215,7 +215,7 @@ int A2dpIntf::set_active_device(RustRawAddress bt_addr) const { int A2dpIntf::config_codec(RustRawAddress bt_addr, ::rust::Vec<A2dpCodecConfig> codec_preferences) const { RawAddress addr = rusty::CopyFromRustAddress(bt_addr); std::vector<btav_a2dp_codec_config_t> prefs; - for (int i = 0; i < codec_preferences.size(); ++i) { + for (size_t i = 0; i < codec_preferences.size(); ++i) { prefs.push_back(internal::from_rust_codec_config(codec_preferences[i])); } return intf_->config_codec(addr, prefs); diff --git a/system/gd/rust/topshim/btif/btif_shim.cc b/system/gd/rust/topshim/btif/btif_shim.cc index e9f53fa85d765ab3a99bb4e9a9166a499c99ca4e..8529605bac0b085ce5eb375c4261b6cdf4b8a607 100644 --- a/system/gd/rust/topshim/btif/btif_shim.cc +++ b/system/gd/rust/topshim/btif/btif_shim.cc @@ -45,7 +45,7 @@ void InitFlags::Convert(::rust::Vec<::rust::String>& initFlags) { flags_ = static_cast<const char**>(std::calloc(initFlags.size() + 1, sizeof(char*))); if (!flags_) return; - for (int i = 0; i < initFlags.size(); ++i) { + for (size_t i = 0; i < initFlags.size(); ++i) { flags_[i] = strndup(initFlags[i].data(), initFlags[i].size()); if (!flags_[i]) { return; diff --git a/system/gd/rust/topshim/facade/Android.bp b/system/gd/rust/topshim/facade/Android.bp index 95648c71ea1a219565c368829a7f5f7606d1b5ee..27f26937fae17092009e009b3365c84f866adc0e 100644 --- a/system/gd/rust/topshim/facade/Android.bp +++ b/system/gd/rust/topshim/facade/Android.bp @@ -9,7 +9,10 @@ package { rust_binary_host { name: "bt_topshim_facade", - defaults: ["gd_rust_defaults"], + defaults: [ + "gd_rust_defaults", + "libchrome_support_defaults" + ], crate_name: "bt_topshim_facade", srcs: ["src/main.rs"], ld_flags: ["-fsanitize=undefined", "-fsanitize-minimal-runtime"], @@ -29,15 +32,21 @@ rust_binary_host { "libbt_shim", ], static_libs: [ + "avrcp-target-service", + "lib-bt-packets", + "lib-bt-packets-avrcp", + "lib-bt-packets-base", + "libchrome", + "libevent", "libbt_topshim_cxx", "libbt-bta", "libbt-common", "libbtdevice", - "libbtif-static", + "libbtif", "libbt-hci", "libbt-stack", "libbt-utils", - "libbtcore-static", + "libbtcore", "libosi", "libbt-protos-lite", "libbte", @@ -52,10 +61,12 @@ rust_binary_host { "libbluetooth-types", "libflatbuffers-cpp", "libbt_shim_bridge", + "libbt_topshim_cxx", + "libbt-audio-hal-interface", + "libaudio-a2dp-hw-utils", ], shared_libs: [ "libcrypto", - "libchrome", "liblog", "libcutils", "libgrpc++", diff --git a/system/gd/storage/config_cache_helper_test.cc b/system/gd/storage/config_cache_helper_test.cc index 7269a4ae859fdb968567dc8a9110321a6ba4cedb..73e3b8dee76b7cd73cc0dddee73230dc3a3c5f73 100644 --- a/system/gd/storage/config_cache_helper_test.cc +++ b/system/gd/storage/config_cache_helper_test.cc @@ -57,7 +57,7 @@ TEST(ConfigCacheHelperTest, set_get_uint64_test) { // zero ConfigCacheHelper(config).SetUint64("A", "B", 0); ASSERT_THAT(config.GetProperty("A", "B"), Optional(StrEq("0"))); - ASSERT_THAT(ConfigCacheHelper(config).GetUint64("A", "B"), Optional(Eq(0))); + ASSERT_THAT(ConfigCacheHelper(config).GetUint64("A", "B"), Optional(Eq(0ul))); } TEST(ConfigCacheHelperTest, set_get_uint32_test) { @@ -76,7 +76,7 @@ TEST(ConfigCacheHelperTest, set_get_uint32_test) { // zero ConfigCacheHelper(config).SetUint32("A", "B", 0); ASSERT_THAT(config.GetProperty("A", "B"), Optional(StrEq("0"))); - ASSERT_THAT(ConfigCacheHelper(config).GetUint32("A", "B"), Optional(Eq(0))); + ASSERT_THAT(ConfigCacheHelper(config).GetUint32("A", "B"), Optional(Eq(0u))); } TEST(ConfigCacheHelperTest, set_get_int64_test) { diff --git a/system/hci/Android.bp b/system/hci/Android.bp index e3050873f526e6868a9f46652d99f63a46518181..af495661b15b06531ee58a2f2c4e349335935060 100644 --- a/system/hci/Android.bp +++ b/system/hci/Android.bp @@ -7,20 +7,10 @@ package { default_applicable_licenses: ["system_bt_license"], } -cc_defaults { - name: "libbt-hci_defaults", - defaults: ["fluoride_defaults"], - shared_libs: [ - "android.hardware.bluetooth@1.0", - "android.hardware.bluetooth@1.1", - "libhidlbase", - ], -} - // HCI static library for target cc_library_static { name: "libbt-hci", - defaults: ["libbt-hci_defaults"], + defaults: ["fluoride_basic_defaults"], srcs: [ "src/btsnoop.cc", "src/btsnoop_mem.cc", @@ -68,7 +58,8 @@ cc_library_static { cc_test { name: "net_test_hci", test_suites: ["device-tests"], - defaults: ["libbt-hci_defaults"], + defaults: ["fluoride_basic_defaults", "fluoride_test_defaults"], + host_supported: false, local_include_dirs: [ "include", ], @@ -85,19 +76,14 @@ cc_test { "test/packet_fragmenter_test.cc", ], shared_libs: [ - "liblog", + "android.hardware.bluetooth.audio@2.0", + "android.hardware.bluetooth.audio@2.1", "libdl", - "libprotobuf-cpp-lite", ], static_libs: [ - "libbt-hci", - "libosi", - "libosi-AlarmTestHarness", - "libosi-AllocationTestHarness", - "libcutils", - "libbtcore", - "libbt-protos-lite", "libbluetooth-for-tests", + "libbtcore", + "libbt-hci", ], } @@ -105,11 +91,7 @@ cc_test { cc_test { name: "net_test_hci_native", test_suites: ["device-tests"], - defaults: ["fluoride_defaults"], - host_supported: true, - test_options: { - unit_test: true, - }, + defaults: ["fluoride_unit_test_defaults"], local_include_dirs: [ "include", ], @@ -122,32 +104,12 @@ cc_test { "test/hci_layer_test.cc", "test/other_stack_stub.cc", ], - shared_libs: [ - "libcrypto", - "liblog", - "libprotobuf-cpp-lite", - ], - static_libs: [ - "libbt-common", - "libbt-protos-lite", - "libosi", - "libosi-AllocationTestHarness", - ], - sanitize: { - address: true, - cfi: true, - misc_undefined: ["bounds"], - }, } cc_test { name: "net_test_hci_fragmenter_native", test_suites: ["device-tests"], - defaults: ["fluoride_defaults"], - host_supported: true, - test_options: { - unit_test: true, - }, + defaults: ["fluoride_unit_test_defaults"], local_include_dirs: [ "include", ], @@ -161,21 +123,5 @@ cc_test { "src/buffer_allocator.cc", "test/packet_fragmenter_host_test.cc", ], - shared_libs: [ - "libcrypto", - "liblog", - "libprotobuf-cpp-lite", - ], - static_libs: [ - "libbt-common", - "libbt-protos-lite", - "libosi", - "libosi-AllocationTestHarness", - ], - sanitize: { - address: true, - cfi: true, - misc_undefined: ["bounds"], - }, } diff --git a/system/include/Android.bp b/system/include/Android.bp index 8bb2b7c3b6b1f4b424172ecc9bbed6089833c0a1..cfe5897f334fce2e7e8dd9b98ca7da798370907e 100644 --- a/system/include/Android.bp +++ b/system/include/Android.bp @@ -16,7 +16,7 @@ cc_library_headers { // We need this in case some file outside of the Bluetooth project includes // bluetooth.h but doesn't include libchrome which avrcp.h depends on. - export_shared_lib_headers: ["libchrome"], + export_static_lib_headers: ["libchrome"], vendor_available: true, host_supported: true, diff --git a/system/main/Android.bp b/system/main/Android.bp index 37acf2429df8321a0b4d203ca8f3edd82152a1f1..ef154dfdd22cf170cd52cf1abb4148a21b42e11d 100644 --- a/system/main/Android.bp +++ b/system/main/Android.bp @@ -21,7 +21,7 @@ filegroup { cc_library_static { name: "libbte", - defaults: ["fluoride_defaults"], + defaults: ["fluoride_basic_defaults"], srcs: [ ":LibBluetoothSources", ":LibBluetoothShimSources", @@ -49,9 +49,6 @@ cc_library_static { "system/security/keystore/include", "hardware/interfaces/keymaster/4.0/support/include", ], - shared_libs: [ - "libflatbuffers-cpp", - ], generated_headers: [ "BluetoothGeneratedBundlerSchema_h_bfbs", "BluetoothGeneratedDumpsysDataSchema_h", @@ -62,14 +59,14 @@ cc_library_static { min_sdk_version: "Tiramisu" } -cc_library_shared { +cc_library { name: "libbluetooth", visibility: [ "//cts/hostsidetests:__subpackages__", "//packages/modules/Bluetooth:__subpackages__", "//vendor:__subpackages__", ], - defaults: ["fluoride_defaults"], + defaults: ["fluoride_full_defaults"], header_libs: ["libbluetooth_headers"], export_header_lib_headers: ["libbluetooth_headers"], include_dirs: [ @@ -94,87 +91,18 @@ cc_library_shared { "hardware/interfaces/keymaster/4.0/support/include", ], logtags: ["../../EventLogTags.logtags"], - shared_libs: [ - "libcrypto", - "libflatbuffers-cpp", - "liblog", - ], - static_libs: [ - "libbte", - "libbt-sbc-decoder", - "libbt-sbc-encoder", - "libFraunhoferAAC", - "libg722codec", - "liblc3", - "libudrv-uipc", - "libprotobuf-cpp-lite", - "libbluetooth_gd", // Gabeldorsche - "libbluetooth-dumpsys", - "libbluetooth_rust_interop", - ], - whole_static_libs: [ - "libbt-bta", - "libbt-common", - "libbtdevice", - "libbtif", - "libbt-hci", - "libbt-stack", - "libbt-utils", - "libbtcore", - "libosi", - "libbt-protos-lite", - ], - target: { - android: { - shared_libs: [ - "android.hardware.bluetooth.a2dp@1.0", - "android.hardware.bluetooth.audio@2.0", - "android.hardware.bluetooth.audio@2.1", - "android.hardware.bluetooth.audio-V1-ndk", - "android.hardware.bluetooth@1.0", - "android.hardware.bluetooth@1.1", - "android.system.suspend.control-V1-ndk", - "android.system.suspend-V1-ndk", - "libaaudio", - "libbinder_ndk", - "libcutils", - "libhidlbase", - "libfmq", - "libprocessgroup", - "libtinyxml2", - "libutils", - "libz", - ], - required: [ - "libldacBT_enc", - "libldacBT_abr", - ], - }, - }, // Shared library link options. // References to global symbols and functions should bind to the library // itself. This is to avoid issues with some of the unit/system tests // that might link statically with some of the code in the library, and // also dlopen(3) the shared library. ldflags: ["-Wl,-Bsymbolic,-Bsymbolic-functions"], - required: [ - "bt_did.conf", - "bt_stack.conf", - "audio_set_scenarios_bfbs", - "audio_set_scenarios_json", - "audio_set_configurations_bfbs", - "audio_set_configurations_json", - ], cflags: [ "-DBUILDCFG", ], sanitize: { never: true, }, - apex_available: [ - "//apex_available:platform", - "com.android.bluetooth", - ], host_supported: true, min_sdk_version: "30", } @@ -260,6 +188,7 @@ cc_test { "libbluetooth-dumpsys", "libbt-common", "libbt-protos-lite", + "libflatbuffers-cpp", "libgmock", "liblog", "libosi", @@ -267,7 +196,6 @@ cc_test { ], shared_libs: [ "libcrypto", - "libflatbuffers-cpp", "libprotobuf-cpp-lite", ], sanitize: { diff --git a/system/osi/Android.bp b/system/osi/Android.bp index 8dcd8858829bbc10d5388542c53ce9a74c70d869..7da7aba1664ae5517f0c9262fb47da83136efe5b 100644 --- a/system/osi/Android.bp +++ b/system/osi/Android.bp @@ -59,7 +59,7 @@ cc_library_static { "//packages/apps/Test/connectivity/sl4n", "//packages/modules/Bluetooth:__subpackages__", ], - defaults: ["fluoride_osi_defaults"], + defaults: ["fluoride_osi_defaults", "fluoride_basic_defaults"], // TODO(mcchou): Remove socket_utils sources after platform specific // dependencies are abstracted. srcs: [ @@ -87,10 +87,6 @@ cc_library_static { "src/thread_scheduler.cc", "src/wakelock.cc", ], - shared_libs: [ - "liblog", - ], - static_libs: ["libbt-protos-lite"], host_supported: true, // TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but // should be compatible for a Linux host OS. We should figure out what to do for @@ -103,10 +99,6 @@ cc_library_static { ], }, }, - apex_available: [ - "//apex_available:platform", - "com.android.bluetooth", - ], min_sdk_version: "Tiramisu" } @@ -137,6 +129,8 @@ cc_test { "test/wakelock_test.cc", ], shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", "liblog", "libprotobuf-cpp-lite", "libcutils", diff --git a/system/packet/Android.bp b/system/packet/Android.bp index 45057d849947188536051a8a262d07586a70d134..d37c9aba3272fdfa6c72aad1a33efc27ca54a125 100644 --- a/system/packet/Android.bp +++ b/system/packet/Android.bp @@ -15,7 +15,7 @@ cc_library_static { "./include", "./", ], - whole_static_libs: [ + static_libs: [ "lib-bt-packets-base", "lib-bt-packets-avrcp", ], @@ -63,19 +63,23 @@ cc_test { "tests/base/packet_test.cc", ], shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", "libbinder_ndk", "libcrypto", ], static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", ], target: { android: { - shared_libs: [ + static_libs: [ "android.system.suspend.control-V1-ndk", ], }, diff --git a/system/packet/tests/fuzzers/Android.bp b/system/packet/tests/fuzzers/Android.bp index eb5090eb7e181d0478e2576685871e7be60dfb29..3a78207324929e33aeac9c91fadaa095807ebdf7 100644 --- a/system/packet/tests/fuzzers/Android.bp +++ b/system/packet/tests/fuzzers/Android.bp @@ -30,6 +30,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -60,6 +62,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -90,6 +94,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -120,6 +126,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -150,6 +158,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -180,6 +190,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -210,6 +222,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -240,6 +254,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -270,6 +286,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -300,6 +318,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -330,6 +350,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -360,6 +382,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -390,6 +414,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -420,6 +446,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -450,6 +478,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -480,6 +510,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -510,6 +542,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -540,6 +574,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -570,6 +606,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -600,6 +638,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -630,6 +670,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -660,6 +702,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -690,6 +734,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -720,6 +766,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", @@ -750,6 +798,8 @@ cc_fuzz { static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", ], cflags: [ "-DBUILDCFG", diff --git a/system/profile/avrcp/Android.bp b/system/profile/avrcp/Android.bp index 903b89d44aa2459c685de66021679b0d34564fb5..db0e336cf5eb1d4a9e55df9e83e13cef0d8b7cad 100644 --- a/system/profile/avrcp/Android.bp +++ b/system/profile/avrcp/Android.bp @@ -12,6 +12,7 @@ cc_library_static { defaults: [ "fluoride_defaults", "clang_file_coverage", + "libchrome_support_defaults", ], host_supported: true, include_dirs: [ @@ -32,7 +33,6 @@ cc_library_static { "libosi", ], shared_libs: [ - "libchrome", "liblog", ], apex_available: [ @@ -48,6 +48,7 @@ cc_test { defaults: [ "fluoride_defaults", "clang_coverage_bin", + "libchrome_support_defaults", ], host_supported: true, test_options: { @@ -62,9 +63,15 @@ cc_test { "tests/avrcp_connection_handler_test.cc", "tests/avrcp_device_test.cc", ], + shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", + ], static_libs: [ "libgmock", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", "libosi", "liblog", "libcutils", @@ -72,9 +79,6 @@ cc_test { "libbtdevice", "avrcp-target-service", ], - shared_libs: [ - "libchrome", - ], sanitize: { cfi: false, }, @@ -87,6 +91,7 @@ cc_fuzz { host_supported: true, defaults: [ "fluoride_defaults_fuzzable", + "libchrome_support_defaults", ], srcs: [ "tests/avrcp_device_fuzz/avrcp_device_fuzz.cc", @@ -100,8 +105,9 @@ cc_fuzz { static_libs: [ "avrcp-target-service", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", "libbase", - "libchrome", "libcutils", "libevent", "liblog", diff --git a/system/profile/sdp/Android.bp b/system/profile/sdp/Android.bp index 8bb883ba0c67eb59be08398e0c84afc77e03e020..7db1a4d4b412b080628f51431ac53466b74b7d8c 100644 --- a/system/profile/sdp/Android.bp +++ b/system/profile/sdp/Android.bp @@ -44,6 +44,8 @@ cc_test { "libgmock", "sdp_service", "lib-bt-packets", + "lib-bt-packets-base", + "lib-bt-packets-avrcp", "libbluetooth-types", ], } diff --git a/system/service/Android.bp b/system/service/Android.bp index becc865f1575307f53d184a8216f216d34ea57d6..950cdc0a7c00425cfdfd60492e6c50736d3fd5ab 100644 --- a/system/service/Android.bp +++ b/system/service/Android.bp @@ -92,20 +92,63 @@ cc_binary { btserviceDaemonSrc + ["main.cc"], static_libs: [ + "avrcp-target-service", + "libaudio-a2dp-hw-utils", "libbluetooth-binder-common", - "libbtcore", + "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", + "libchrome", + "libflatbuffers-cpp", + "libFraunhoferAAC", + "libg722codec", + "liblc3", "libosi", + "libudrv-uipc", ], shared_libs: [ - "libchrome", + "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-V1-ndk", + ], + }, + }, } // Native system service unit tests for target and host @@ -125,14 +168,49 @@ cc_test { ], }, 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", + "libchrome", "libgmock", "liblog", - "libbluetooth-types", "libutils", + "libflatbuffers-cpp", + "libFraunhoferAAC", + "libg722codec", + "liblc3", + "libosi", + "libudrv-uipc", ], shared_libs: [ - "libchrome", + "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, @@ -148,10 +226,14 @@ cc_test { "test/ParcelableTest.aidl", ], static_libs: [ + "android.system.suspend.control-V1-ndk", "libbluetooth-binder-common", ], shared_libs: [ + "android.hardware.bluetooth.audio-V1-ndk", + "android.system.suspend-V1-ndk", "libbinder", + "libvndksupport", ], }, host: { diff --git a/system/service/hal/bluetooth_interface.cc b/system/service/hal/bluetooth_interface.cc index db3cc25418fabc52b27bf847801709eb1240bc43..fbf0ef8cd2bf1568038fb1646a73df8d685b8bae 100644 --- a/system/service/hal/bluetooth_interface.cc +++ b/system/service/hal/bluetooth_interface.cc @@ -38,6 +38,10 @@ using shared_mutex_impl = std::shared_mutex; using shared_mutex_impl = std::shared_timed_mutex; #endif +#ifndef DYNAMIC_LOAD_BLUETOOTH +extern bt_interface_t bluetoothInterface; +#endif + namespace bluetooth { namespace hal { @@ -265,6 +269,12 @@ constexpr char kLibbluetooth[] = "libbluetooth.so"; constexpr char kBluetoothInterfaceSym[] = "bluetoothInterface"; int hal_util_load_bt_library_from_dlib(const bt_interface_t** interface) { +#ifndef DYNAMIC_LOAD_BLUETOOTH + (void)kLibbluetooth; + (void)kBluetoothInterfaceSym; + *interface = &bluetoothInterface; + return 0; +#else bt_interface_t* itf{nullptr}; // Always try to load the default Bluetooth stack on GN builds. @@ -296,6 +306,7 @@ error: if (handle) dlclose(handle); return -EINVAL; +#endif } } // namespace diff --git a/system/stack/Android.bp b/system/stack/Android.bp index 82ca5d3e1a162b228da545fe2d4dca968cb84906..744a342ce1b5d4d8e4eafe08de84cddca80242ca 100644 --- a/system/stack/Android.bp +++ b/system/stack/Android.bp @@ -27,7 +27,7 @@ cc_test_library { // Bluetooth stack static library for target cc_library_static { name: "libbt-stack", - defaults: ["fluoride_defaults"], + defaults: ["fluoride_basic_defaults"], local_include_dirs: [ "include", "avct", @@ -202,17 +202,6 @@ cc_library_static { ], static_libs: [ "libbt-hci", - "libFraunhoferAAC", - "libbt-platform-protos-lite", - ], - shared_libs: [ - "libcutils", - "liblog", - "libcrypto", - ], - required: [ - "libldacBT_enc", - "libldacBT_abr", ], host_supported: true, min_sdk_version: "Tiramisu" @@ -238,11 +227,9 @@ cc_test { 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.hardware.bluetooth.audio-V1-ndk", - "android.system.suspend.control-V1-ndk", "libaaudio", "libbinder_ndk", "libcutils", @@ -258,6 +245,8 @@ cc_test { "libcrypto", ], static_libs: [ + "android.hardware.bluetooth.a2dp@1.0", + "android.system.suspend.control-V1-ndk", "libbt-audio-hal-interface", "libbluetooth-dumpsys", "libbtcore", @@ -386,12 +375,14 @@ cc_test { "BluetoothGeneratedPackets_h", ], shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", "libcrypto", "libcutils", - "libflatbuffers-cpp", ], static_libs: [ "liblog", + "libflatbuffers-cpp", "libgmock", "libosi", ], @@ -419,12 +410,14 @@ cc_test { "test/ble_advertiser_test.cc", ], shared_libs: [ - "android.system.suspend.control-V1-ndk", + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", "libbinder_ndk", "libcrypto", "libcutils", ], static_libs: [ + "android.system.suspend.control-V1-ndk", "libbluetooth-types", "liblog", "libgmock", @@ -446,11 +439,13 @@ cc_test { "test/ad_parser_unittest.cc", ], shared_libs: [ - "android.system.suspend.control-V1-ndk", + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", "libbinder_ndk", "libcrypto", ], static_libs: [ + "android.system.suspend.control-V1-ndk", "libbluetooth-types", "liblog", "libgmock", @@ -830,6 +825,7 @@ cc_test { "libbt-protos-lite", "libbtdevice", "libbt-utils", + "libflatbuffers-cpp", "libgmock", "liblog", "libosi", @@ -837,7 +833,6 @@ cc_test { ], shared_libs: [ "libcrypto", - "libflatbuffers-cpp", "libprotobuf-cpp-lite", ], sanitize: { @@ -981,6 +976,7 @@ cc_test { "libbt-common", "libbt-protos-lite", "libbtdevice", + "libflatbuffers-cpp", "libgmock", "liblog", "libosi", @@ -988,7 +984,6 @@ cc_test { shared_libs: [ "libbinder_ndk", "libcrypto", - "libflatbuffers-cpp", "libprotobuf-cpp-lite", ], sanitize: { @@ -1052,6 +1047,7 @@ cc_test { "libbt-common", "libbt-protos-lite", "libbtdevice", + "libflatbuffers-cpp", "libgmock", "liblog", "libosi", @@ -1059,7 +1055,6 @@ cc_test { shared_libs: [ "libbinder_ndk", "libcrypto", - "libflatbuffers-cpp", "libprotobuf-cpp-lite", ], sanitize: { diff --git a/system/test/headless/Android.bp b/system/test/headless/Android.bp index b0f6c343e299daf260934eec2318fa8e27db0496..36e33f7150bfeaca3e62d72a9cb41e162a26a9c2 100644 --- a/system/test/headless/Android.bp +++ b/system/test/headless/Android.bp @@ -33,37 +33,46 @@ cc_test { "libbtcore", ], static_libs: [ - "libFraunhoferAAC", + "android.hardware.bluetooth.a2dp@1.0", + "android.system.suspend.control-V1-ndk", + "avrcp-target-service", + "libaudio-a2dp-hw-utils", + "libbluetooth-dumpsys", "libbluetooth_gd", + "libbluetooth_rust_interop", + "libbt-audio-hal-interface", "libbt-bta", + "libbt_callbacks_cxx", "libbt-common", - "libbluetooth-dumpsys", + "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_shim_bridge", + "libbt_shim_ffi", "libbt-stack", "libbt-utils", - "libbtdevice", - "libbte", - "libbtif", "libflatbuffers-cpp", + "libFraunhoferAAC", "libg722codec", "liblc3", "libosi", "libprotobuf-cpp-lite", "libudrv-uipc", "libz", - "libbluetooth_rust_interop", ], shared_libs: [ - "android.hardware.bluetooth.a2dp@1.0", + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", "android.hardware.bluetooth.audio@2.0", "android.hardware.bluetooth.audio@2.1", "android.hardware.bluetooth.audio-V1-ndk", - "android.hardware.bluetooth@1.0", - "android.hardware.bluetooth@1.1", - "android.system.suspend.control-V1-ndk", "android.system.suspend-V1-ndk", "libaaudio", "libbase", diff --git a/system/test/rootcanal/Android.bp b/system/test/rootcanal/Android.bp index a6c41d606eb1ea0f335d1bca731124d8f58f8cfa..f0bd2ab8e8a67f92d287ce2fa0ae56b604da8e2a 100644 --- a/system/test/rootcanal/Android.bp +++ b/system/test/rootcanal/Android.bp @@ -24,7 +24,10 @@ package { cc_binary { name: "android.hardware.bluetooth@1.1-service.sim", - defaults: ["gd_defaults"], + defaults: [ + "gd_defaults", + "libchrome_support_defaults" + ], proprietary: true, relative_install_path: "hw", srcs: [ @@ -39,7 +42,6 @@ cc_binary { "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", "libbase", - "libchrome", "libcutils", "libhidlbase", "libjsoncpp", @@ -77,7 +79,10 @@ cc_binary { cc_library_shared { name: "android.hardware.bluetooth@1.1-impl-sim", - defaults: ["gd_defaults"], + defaults: [ + "gd_defaults", + "libchrome_support_defaults" + ], proprietary: true, relative_install_path: "hw", srcs: [ @@ -91,7 +96,6 @@ cc_library_shared { "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", "libbase", - "libchrome", "libcutils", "libhidlbase", "libjsoncpp", diff --git a/system/test/suite/Android.bp b/system/test/suite/Android.bp index 5dc6bcc4cfc2e781f8719e2153c62a966d0e6368..4d45f814b3693f853180b504413028270f56c935 100644 --- a/system/test/suite/Android.bp +++ b/system/test/suite/Android.bp @@ -8,71 +8,121 @@ package { default_applicable_licenses: ["system_bt_license"], } -cc_test { - name: "net_test_bluetooth", - test_suites: ["device-tests"], +cc_defaults { + name: "net_test_defaults", defaults: ["fluoride_defaults"], include_dirs: [ + "frameworks/av/media/libaaudio/include", "packages/modules/Bluetooth/system", + "packages/modules/Bluetooth/system/bta/dm", + "packages/modules/Bluetooth/system/bta/include", + "packages/modules/Bluetooth/system/bta/sys", + "packages/modules/Bluetooth/system/btif/avrcp", + "packages/modules/Bluetooth/system/btif/co", + "packages/modules/Bluetooth/system/btif/include", + "packages/modules/Bluetooth/system/device/include", + "packages/modules/Bluetooth/system/embdrv/sbc/decoder/include", + "packages/modules/Bluetooth/system/embdrv/sbc/encoder/include", "packages/modules/Bluetooth/system/gd", "packages/modules/Bluetooth/system/include", + "packages/modules/Bluetooth/system/internal_include", + "packages/modules/Bluetooth/system/stack/a2dp", + "packages/modules/Bluetooth/system/stack/avdt", + "packages/modules/Bluetooth/system/stack/btm", "packages/modules/Bluetooth/system/stack/include", + "packages/modules/Bluetooth/system/stack/l2cap", + "packages/modules/Bluetooth/system/udrv/include", + "packages/modules/Bluetooth/system/utils/include", + "packages/modules/Bluetooth/system/vnd/include", + "system/libfmq/include", + "system/libhwbinder/include", ], srcs: [ - ":TestCommonMockFunctions", - ":TestMockBluetoothInterface", - ":TestMockDevice", - "adapter/adapter_unittest.cc", "adapter/bluetooth_test.cc", - "gatt/gatt_test.cc", - "gatt/gatt_unittest.cc", + ":BtaDmSources", + ":TestCommonMockFunctions", + ":TestMockAndroidHardware", + ":TestMockCommon", + ":TestMockFrameworks", + ":TestMockHci", + ":TestMockSystemLibfmq", + ":TestMockUdrv", ], - header_libs: ["libhardware_headers"], shared_libs: [ - "liblog", - "libcutils", + "android.hardware.bluetooth.audio@2.0", + "android.hardware.bluetooth.audio@2.1", + "android.system.suspend-V1-ndk", "libbinder", + "libbinder_ndk", + "libcrypto", + "libcutils", + "libhidlbase", + "liblog", + "libstatssocket", + "libtinyxml2", "libutils", ], static_libs: [ + "android.hardware.bluetooth.a2dp@1.0", + "android.system.suspend.control-V1-ndk", + "avrcp-target-service", + "libaudio-a2dp-hw-utils", + "libbluetooth-dumpsys", + "libbluetooth-types", + "libbluetoothtbd_hal", + "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-sbc-decoder", + "libbt-sbc-encoder", + "libbt-stack", + "libbt-utils", + "libflatbuffers-cpp", + "libFraunhoferAAC", + "libg722codec", + "libgmock", + "liblc3", "libosi", + "libstatslog_bt", ], - whole_static_libs: [ - "libbluetoothtbd_hal", + header_libs: [ + "libhardware_headers", + "libbluetooth_headers", + ], + target: { + android: { + shared_libs: [ + "android.hardware.bluetooth.audio-V1-ndk", + ], + }, + }, +} + +cc_test { + name: "net_test_bluetooth", + test_suites: ["device-tests"], + defaults: ["net_test_defaults"], + srcs: [ + "adapter/adapter_unittest.cc", + "gatt/gatt_test.cc", + "gatt/gatt_unittest.cc", ], } // Bluetooth test suite for target cc_test { name: "net_test_rfcomm_suite", - defaults: ["fluoride_defaults"], - include_dirs: [ - "packages/modules/Bluetooth/system", - "packages/modules/Bluetooth/system/gd", - "packages/modules/Bluetooth/system/include", - "packages/modules/Bluetooth/system/stack/include", - ], + defaults: ["net_test_defaults"], srcs: [ - ":TestMockBluetoothInterface", - ":TestMockDevice", - ":TestCommonMockFunctions", - "adapter/bluetooth_test.cc", "rfcomm/rfcomm_test.cc", "rfcomm/rfcomm_unittest.cc", ], - header_libs: ["libhardware_headers"], - shared_libs: [ - "liblog", - "libcutils", - "libbinder", - "libutils", - ], - static_libs: [ - "libbtcore", - "libosi", - ], - whole_static_libs: [ - "libbluetoothtbd_hal", - ], } diff --git a/system/test/suite/adapter/bluetooth_test.cc b/system/test/suite/adapter/bluetooth_test.cc index be5660e088fc1677b2917d1f8b8f34a055da18fc..6b24b7509c801df75c58b436af90995092fb1d34 100644 --- a/system/test/suite/adapter/bluetooth_test.cc +++ b/system/test/suite/adapter/bluetooth_test.cc @@ -48,16 +48,16 @@ void BluetoothTest::SetUp() { acl_state_ = BT_ACL_STATE_DISCONNECTED; bond_state_ = BT_BOND_STATE_NONE; - adapter_properties_callback_sem_ = semaphore_new(0); - remote_device_properties_callback_sem_ = semaphore_new(0); - adapter_state_changed_callback_sem_ = semaphore_new(0); - discovery_state_changed_callback_sem_ = semaphore_new(0); - remove("/data/misc/bluedroid/bt_config.conf.encrypted-checksum"); remove("/data/misc/bluedroid/bt_config.bak.encrypted-checksum"); bluetooth::hal::BluetoothInterface::Initialize(); ASSERT_TRUE(bluetooth::hal::BluetoothInterface::IsInitialized()); + adapter_properties_callback_sem_ = semaphore_new(0); + remote_device_properties_callback_sem_ = semaphore_new(0); + adapter_state_changed_callback_sem_ = semaphore_new(0); + discovery_state_changed_callback_sem_ = semaphore_new(0); + auto bt_hal_interface = bluetooth::hal::BluetoothInterface::Get(); bt_hal_interface->AddObserver(this); bt_interface_ = bt_hal_interface->GetHALInterface(); diff --git a/system/types/Android.bp b/system/types/Android.bp index 827b596cdc2c8d0b8b900245fb3ca02c5e93b7cc..4caa05f23bb8fff033ca321599e63a78bc7b1706 100644 --- a/system/types/Android.bp +++ b/system/types/Android.bp @@ -56,4 +56,8 @@ cc_test { "test/raw_address_unittest.cc", "test/bluetooth/uuid_unittest.cc", ], + shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", + ], }