1// Bluetooth main HW module / shared library for target 2package { 3 // See: http://go/android-license-faq 4 // A large-scale-change added 'default_applicable_licenses' to import 5 // all of the 'license_kinds' from "system_bt_license" 6 // to get the below license kinds: 7 // SPDX-license-identifier-Apache-2.0 8 default_applicable_licenses: ["system_bt_license"], 9} 10 11filegroup { 12 name: "LibBluetoothSources", 13 srcs: [ 14 "bte_conf.cc", 15 "stack_config.cc", 16 ], 17} 18 19cc_library_static { 20 name: "libbte", 21 defaults: ["fluoride_defaults"], 22 srcs: [ 23 ":BluetoothStackManagerSources", 24 ":LibBluetoothShimSources", 25 ":LibBluetoothSources", 26 ], 27 include_dirs: [ 28 "hardware/interfaces/keymaster/4.0/support/include", 29 "packages/modules/Bluetooth/system", 30 "packages/modules/Bluetooth/system/bta/dm", 31 "packages/modules/Bluetooth/system/bta/include", 32 "packages/modules/Bluetooth/system/bta/sys", 33 "packages/modules/Bluetooth/system/btif/co", 34 "packages/modules/Bluetooth/system/embdrv/sbc/decoder/include", 35 "packages/modules/Bluetooth/system/embdrv/sbc/encoder/include", 36 "packages/modules/Bluetooth/system/gd", 37 "packages/modules/Bluetooth/system/stack/a2dp", 38 "packages/modules/Bluetooth/system/stack/avdt", 39 "packages/modules/Bluetooth/system/stack/btm", 40 "packages/modules/Bluetooth/system/stack/include", 41 "packages/modules/Bluetooth/system/stack/l2cap", 42 "packages/modules/Bluetooth/system/udrv/include", 43 "system/security/keystore/include", 44 ], 45 generated_headers: [ 46 "BluetoothGeneratedBundlerSchema_h_bfbs", 47 "BluetoothGeneratedDumpsysDataSchema_h", 48 ], 49 apex_available: [ 50 "com.android.btservices", 51 ], 52 host_supported: true, 53 min_sdk_version: "Tiramisu", 54 static_libs: [ 55 "libbluetooth_gd", 56 "libbluetooth_log", 57 "libbt-platform-protos-lite", 58 "libbt_shim_bridge", 59 "libcom.android.sysprop.bluetooth.wrapped", 60 ], 61 header_libs: ["libbluetooth_headers"], 62 cflags: ["-Wno-unused-parameter"], 63} 64 65cc_library { 66 name: "libbluetooth", 67 visibility: [ 68 "//cts/hostsidetests:__subpackages__", 69 "//packages/modules/Bluetooth:__subpackages__", 70 "//vendor:__subpackages__", 71 ], 72 defaults: ["fluoride_defaults"], 73 header_libs: ["libbluetooth_headers"], 74 export_header_lib_headers: ["libbluetooth_headers"], 75 include_dirs: [ 76 "hardware/interfaces/keymaster/4.0/support/include", 77 "packages/modules/Bluetooth/system", 78 "packages/modules/Bluetooth/system/bta/dm", 79 "packages/modules/Bluetooth/system/bta/include", 80 "packages/modules/Bluetooth/system/bta/sys", 81 "packages/modules/Bluetooth/system/btif/co", 82 "packages/modules/Bluetooth/system/embdrv/sbc/decoder/include", 83 "packages/modules/Bluetooth/system/embdrv/sbc/encoder/include", 84 "packages/modules/Bluetooth/system/stack/a2dp", 85 "packages/modules/Bluetooth/system/stack/avdt", 86 "packages/modules/Bluetooth/system/stack/btm", 87 "packages/modules/Bluetooth/system/stack/include", 88 "packages/modules/Bluetooth/system/stack/l2cap", 89 "packages/modules/Bluetooth/system/udrv/include", 90 "system/security/keystore/include", 91 ], 92 shared_libs: [ 93 "android.hardware.bluetooth@1.0", 94 "android.hardware.bluetooth@1.1", 95 ], 96 target: { 97 android: { 98 shared_libs: [ 99 "libstatssocket", 100 ], 101 }, 102 }, 103 // Shared library link options. 104 // References to global symbols and functions should bind to the library 105 // itself. This is to avoid issues with some of the unit/system tests 106 // that might link statically with some of the code in the library, and 107 // also dlopen(3) the shared library. 108 ldflags: ["-Wl,-Bsymbolic,-Bsymbolic-functions"], 109 sanitize: { 110 scs: true, 111 }, 112 apex_available: [ 113 "com.android.btservices", 114 ], 115 host_supported: true, 116 min_sdk_version: "30", 117} 118 119cc_library_static { 120 name: "libbluetooth-for-tests", 121 defaults: ["fluoride_defaults"], 122 123 srcs: [ 124 ":BluetoothStackManagerSources", 125 ":LibBluetoothShimSources", 126 ":LibBluetoothSources", 127 ], 128 host_supported: true, 129 include_dirs: [ 130 "packages/modules/Bluetooth/system", 131 "packages/modules/Bluetooth/system/bta/include", 132 "packages/modules/Bluetooth/system/gd", 133 "packages/modules/Bluetooth/system/stack/include", 134 ], 135 generated_headers: [ 136 "BluetoothGeneratedBundlerSchema_h_bfbs", 137 "BluetoothGeneratedDumpsysDataSchema_h", 138 ], 139 cflags: [ 140 "-Wno-unused-parameter", 141 ], 142 shared_libs: [ 143 ], 144 whole_static_libs: [ 145 "libbluetooth_gd", // Gabeldorsche 146 ], 147 header_libs: ["libbluetooth_headers"], 148 static_libs: [ 149 "libbluetooth_log", 150 "libbt-platform-protos-lite", 151 "libbt_shim_bridge", 152 "libcom.android.sysprop.bluetooth.wrapped", 153 ], 154} 155 156cc_test { 157 name: "net_test_main_shim", 158 test_suites: ["general-tests"], 159 host_supported: true, 160 test_options: { 161 unit_test: true, 162 }, 163 defaults: [ 164 "fluoride_defaults", 165 "mts_defaults", 166 ], 167 include_dirs: [ 168 "packages/modules/Bluetooth/system", 169 "packages/modules/Bluetooth/system/gd", 170 "packages/modules/Bluetooth/system/stack/btm", 171 "packages/modules/Bluetooth/system/stack/include", 172 ], 173 srcs: [ 174 ":BluetoothOsSources_host", 175 ":TestCommonMainHandler", 176 ":TestCommonMockFunctions", 177 ":TestMockBta", 178 ":TestMockBtif", 179 ":TestMockBtu", 180 ":TestMockJni", 181 ":TestMockLegacyHciCommands", 182 ":TestMockLegacyHciInterface", 183 ":TestMockMainShimEntry", 184 ":TestMockStack", 185 "shim/acl.cc", 186 "shim/acl_api.cc", 187 "shim/acl_legacy_interface.cc", 188 "shim/btm_api.cc", 189 "shim/config.cc", 190 "shim/distance_measurement_manager.cc", 191 "shim/dumpsys.cc", 192 "shim/hci_layer.cc", 193 "shim/le_advertising_manager.cc", 194 "shim/le_scanning_manager.cc", 195 "shim/metric_id_api.cc", 196 "shim/metrics_api.cc", 197 "shim/shim.cc", 198 "shim/stack.cc", 199 "shim/utils.cc", 200 "test/common_stack_test.cc", 201 "test/main_shim_dumpsys_test.cc", 202 "test/main_shim_stack_lifecycle_test.cc", 203 "test/main_shim_test.cc", 204 ], 205 static_libs: [ 206 "libbase", 207 "libbluetooth-dumpsys", 208 "libbluetooth-gdx", 209 "libbluetooth-types", 210 "libbluetooth_crypto_toolbox", 211 "libbluetooth_gd", 212 "libbluetooth_hci_pdl", 213 "libbluetooth_log", 214 "libbt-common", 215 "libbt-platform-protos-lite", 216 "libbt_shim_bridge", 217 "libbt_shim_ffi", 218 "libbtdevice", 219 "libchrome", 220 "libcom.android.sysprop.bluetooth.wrapped", 221 "libevent", 222 "libflatbuffers-cpp", 223 "libgmock", 224 "liblog", 225 "libosi", 226 ], 227 shared_libs: [ 228 "libPlatformProperties", 229 "libaconfig_storage_read_api_cc", 230 "libbinder_ndk", 231 "libcrypto", 232 "server_configurable_flags", 233 ], 234 sanitize: { 235 address: true, 236 all_undefined: true, 237 cfi: true, 238 integer_overflow: true, 239 scs: true, 240 diag: { 241 undefined: true, 242 }, 243 }, 244 generated_headers: [ 245 "BluetoothGeneratedBundlerSchema_h_bfbs", 246 "BluetoothGeneratedDumpsysDataSchema_h", 247 ], 248 min_sdk_version: "Tiramisu", 249 header_libs: ["libbluetooth_headers"], 250 cflags: ["-Wno-unused-parameter"], 251} 252 253cc_test { 254 name: "net_test_main_dumpsys", 255 test_suites: ["general-tests"], 256 host_supported: true, 257 test_options: { 258 unit_test: true, 259 }, 260 defaults: [ 261 "fluoride_defaults", 262 "mts_defaults", 263 ], 264 include_dirs: [ 265 "packages/modules/Bluetooth/system", 266 "packages/modules/Bluetooth/system/gd", 267 "packages/modules/Bluetooth/system/stack/btm", 268 "packages/modules/Bluetooth/system/stack/include", 269 ], 270 generated_headers: [ 271 "BluetoothGeneratedBundlerSchema_h_bfbs", 272 "BluetoothGeneratedDumpsysDataSchema_h", 273 ], 274 srcs: [ 275 ":BluetoothOsSources_host", 276 ":BluetoothStackManagerSources", 277 ":LibBluetoothShimSources", 278 ":TestCommonMainHandler", 279 ":TestCommonMockFunctions", 280 ":TestMockBta", 281 ":TestMockBtif", 282 ":TestMockBtu", 283 ":TestMockJni", 284 ":TestMockLegacyHciCommands", 285 ":TestMockLegacyHciInterface", 286 ":TestMockStack", 287 "test/main_shim_stack_dumpsys_test.cc", 288 ], 289 static_libs: [ 290 "libbase", 291 "libbluetooth-dumpsys", 292 "libbluetooth-gdx", 293 "libbluetooth-types", 294 "libbluetooth_crypto_toolbox", 295 "libbluetooth_gd", 296 "libbluetooth_hci_pdl", 297 "libbluetooth_log", 298 "libbt-common", 299 "libbt-platform-protos-lite", 300 "libbt_shim_bridge", 301 "libbt_shim_ffi", 302 "libbtdevice", 303 "libchrome", 304 "libcom.android.sysprop.bluetooth.wrapped", 305 "libevent", 306 "libflatbuffers-cpp", 307 "libgmock", 308 "liblog", 309 "libosi", 310 ], 311 shared_libs: [ 312 "libPlatformProperties", 313 "libaconfig_storage_read_api_cc", 314 "libcrypto", 315 "server_configurable_flags", 316 ], 317 target: { 318 linux: { 319 srcs: [ 320 ":BluetoothOsSources_fake_timer", 321 ], 322 }, 323 android: { 324 static_libs: [ 325 "android.hardware.bluetooth@1.0", 326 "android.hardware.bluetooth@1.1", 327 "android.system.suspend-V1-ndk", 328 "android.system.suspend.control-V1-ndk", 329 "libstatslog_bt", 330 ], 331 shared_libs: [ 332 "libbinder_ndk", 333 "libcutils", 334 "libhidlbase", 335 "libstatssocket", 336 "libutils", 337 ], 338 }, 339 }, 340 sanitize: { 341 address: true, 342 all_undefined: true, 343 cfi: true, 344 integer_overflow: true, 345 scs: true, 346 diag: { 347 undefined: true, 348 }, 349 }, 350 min_sdk_version: "Tiramisu", 351 header_libs: ["libbluetooth_headers"], 352} 353