1// Common variables 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 11btifCommonIncludes = [ 12 "packages/modules/Bluetooth/system", 13 "packages/modules/Bluetooth/system/bta/include", 14 "packages/modules/Bluetooth/system/btif/include", 15 "packages/modules/Bluetooth/system/gd", 16 "packages/modules/Bluetooth/system/include", 17 "packages/modules/Bluetooth/system/stack/include", 18] 19 20cc_library { 21 name: "libstatslog_bt", 22 defaults: ["bluetooth_cflags"], 23 host_supported: true, 24 generated_sources: ["statslog_bt.cpp"], 25 generated_headers: ["statslog_bt.h"], 26 export_generated_headers: ["statslog_bt.h"], 27 apex_available: [ 28 "com.android.btservices", 29 ], 30 min_sdk_version: "30", 31 shared_libs: [ 32 "libstatssocket", 33 ], 34 export_shared_lib_headers: [ 35 "libstatssocket", 36 ], 37 target: { 38 host: { 39 static_libs: [ 40 "libbase", 41 ], 42 }, 43 darwin: { 44 enabled: false, 45 }, 46 }, 47} 48 49cc_library_static { 50 name: "libbt-jni-thread", 51 defaults: ["fluoride_defaults"], 52 host_supported: true, 53 include_dirs: [ 54 "packages/modules/Bluetooth/system", 55 "packages/modules/Bluetooth/system/gd", 56 "packages/modules/Bluetooth/system/include", 57 "packages/modules/Bluetooth/system/stack/include", 58 "packages/modules/Bluetooth/system/types", 59 ], 60 srcs: ["src/btif_jni_task.cc"], 61 static_libs: [ 62 "libbluetooth_log", 63 "libbt_shim_bridge", 64 "libosi", 65 ], 66 shared_libs: [ 67 "libchrome", 68 ], 69 apex_available: [ 70 "com.android.btservices", 71 ], 72 min_sdk_version: "Tiramisu", 73} 74 75genrule { 76 name: "statslog_bt.h", 77 tools: ["stats-log-api-gen"], 78 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_bt.h --module bluetooth" + 79 " --namespace bluetooth", 80 out: ["statslog_bt.h"], 81} 82 83genrule { 84 name: "statslog_bt.cpp", 85 tools: ["stats-log-api-gen"], 86 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_bt.cpp --module bluetooth" + 87 " --namespace bluetooth --importHeader statslog_bt.h", 88 out: ["statslog_bt.cpp"], 89} 90 91// libbtif static library for target 92 93cc_library_static { 94 name: "libbtif", 95 defaults: ["fluoride_defaults"], 96 include_dirs: btifCommonIncludes, 97 srcs: [ 98 // AVRCP Target Service 99 "avrcp/avrcp_service.cc", 100 // Callouts 101 "co/bta_av_co.cc", 102 "co/bta_av_co_peer.cc", 103 "co/bta_hh_co.cc", 104 "co/bta_pan_co.cc", 105 // HAL layer 106 "src/bluetooth.cc", 107 // BTIF implementation 108 "src/btif_a2dp.cc", 109 "src/btif_a2dp_control.cc", 110 "src/btif_a2dp_sink.cc", 111 "src/btif_a2dp_source.cc", 112 "src/btif_av.cc", 113 "src/btif_csis_client.cc", 114 "src/btif_has_client.cc", 115 "src/btif_hd.cc", 116 "src/btif_hearing_aid.cc", 117 "src/btif_hf.cc", 118 "src/btif_hf_client.cc", 119 "src/btif_hh.cc", 120 "src/btif_iot_config.cc", 121 "src/btif_le_audio.cc", 122 "src/btif_le_audio_broadcaster.cc", 123 "src/btif_pan.cc", 124 "src/btif_profile_queue.cc", 125 "src/btif_profile_storage.cc", 126 "src/btif_rc.cc", 127 "src/btif_vc.cc", 128 ], 129 generated_headers: [ 130 "BluetoothGeneratedDumpsysDataSchema_h", 131 ], 132 local_include_dirs: [ 133 "include", 134 ], 135 target: { 136 android: { 137 whole_static_libs: [ 138 "libPlatformProperties", 139 ], 140 srcs: ["src/btif_avrcp_audio_track.cc"], 141 shared_libs: ["libaaudio"], 142 }, 143 host: { 144 srcs: [ 145 "src/btif_avrcp_audio_track_linux.cc", 146 "src/btif_leaudio_hal_version_host.cc", 147 ], 148 }, 149 }, 150 static_libs: [ 151 "avrcp-target-service", 152 "bluetooth_flags_c_lib", 153 "lib-bt-packets", 154 "lib-bt-packets-avrcp", 155 "lib-bt-packets-base", 156 "libaudio-a2dp-hw-utils", 157 "libbluetooth-types", 158 "libbluetooth_hci_pdl", 159 "libbluetooth_log", 160 "libbt-audio-hal-interface", 161 "libbt-platform-protos-lite", 162 "libbt-stack", 163 "libbt-stack-core", 164 "libbt_shim_bridge", 165 "libbtif-core", 166 "libflatbuffers-cpp", 167 ], 168 cflags: [ 169 "-Wno-unused-parameter", 170 ], 171 apex_available: [ 172 "com.android.btservices", 173 ], 174 host_supported: true, 175 min_sdk_version: "Tiramisu", 176} 177 178cc_library_static { 179 name: "libbtif-core", 180 defaults: ["fluoride_defaults"], 181 include_dirs: btifCommonIncludes, 182 srcs: [ 183 // Callouts 184 "co/bta_dm_co.cc", 185 "co/bta_gatts_co.cc", 186 // BTIF implementation 187 "src/btif_ble_scanner.cc", 188 "src/btif_bqr.cc", 189 "src/btif_config.cc", 190 "src/btif_core.cc", 191 "src/btif_debug_conn.cc", 192 "src/btif_dm.cc", 193 "src/btif_gatt.cc", 194 "src/btif_gatt_client.cc", 195 "src/btif_gatt_server.cc", 196 "src/btif_gatt_util.cc", 197 "src/btif_iot_config.cc", 198 "src/btif_keystore.cc", 199 "src/btif_metrics_logging.cc", 200 "src/btif_profile_queue.cc", 201 "src/btif_sdp.cc", 202 "src/btif_sdp_server.cc", 203 "src/btif_sock.cc", 204 "src/btif_sock_l2cap.cc", 205 "src/btif_sock_logging.cc", 206 "src/btif_sock_rfc.cc", 207 "src/btif_sock_sco.cc", 208 "src/btif_sock_sdp.cc", 209 "src/btif_sock_thread.cc", 210 "src/btif_sock_util.cc", 211 "src/btif_storage.cc", 212 "src/btif_uid.cc", 213 "src/btif_util.cc", 214 "src/stack_manager.cc", 215 ], 216 generated_headers: [ 217 "BluetoothGeneratedDumpsysDataSchema_h", 218 ], 219 target: { 220 android: { 221 whole_static_libs: [ 222 "libPlatformProperties", 223 ], 224 srcs: ["src/btif_avrcp_audio_track.cc"], 225 shared_libs: ["libaaudio"], 226 }, 227 host: { 228 srcs: [ 229 "src/btif_avrcp_audio_track_linux.cc", 230 "src/btif_leaudio_hal_version_host.cc", 231 ], 232 }, 233 }, 234 static_libs: [ 235 "lib-bt-packets", 236 "lib-bt-packets-base", 237 "libaudio-a2dp-hw-utils", 238 "libbluetooth_crypto_toolbox", 239 "libbluetooth_hci_pdl", 240 "libbluetooth_log", 241 "libbt-audio-hal-interface", 242 "libbt-jni-thread", 243 "libbt-platform-protos-lite", 244 "libbt-stack-core", 245 "libbt_shim_bridge", 246 "libcom.android.sysprop.bluetooth.wrapped", 247 "libflatbuffers-cpp", 248 "libstatslog_bt", 249 ], 250 whole_static_libs: [ 251 "bluetooth_flags_c_lib", 252 ], 253 shared_libs: [ 254 "libcrypto", 255 ], 256 cflags: [ 257 "-Wno-unused-parameter", 258 /* we export all classes, so change default visibility, instead of having EXPORT_SYMBOL on each class*/ 259 "-fvisibility=default", 260 ], 261 apex_available: [ 262 "com.android.btservices", 263 ], 264 host_supported: true, 265 min_sdk_version: "Tiramisu", 266 header_libs: ["libbluetooth_headers"], 267} 268 269cc_test { 270 name: "net_test_btif", 271 defaults: [ 272 "fluoride_defaults", 273 "latest_android_hardware_audio_common_ndk_static", 274 "latest_android_hardware_bluetooth_audio_ndk_static", 275 "latest_android_media_audio_common_types_ndk_static", 276 "mts_defaults", 277 ], 278 test_suites: ["general-tests"], 279 host_supported: true, 280 include_dirs: btifCommonIncludes, 281 srcs: [ 282 ":OsiCompatSources", 283 ":TestCommonMockFunctions", 284 ":TestFakeOsi", 285 "test/btif_dm_test.cc", 286 "test/btif_storage_test.cc", 287 ], 288 header_libs: ["libbluetooth_headers"], 289 shared_libs: [ 290 "libaconfig_storage_read_api_cc", 291 "libbase", 292 "libcrypto", 293 "libcutils", 294 "libhidlbase", 295 "liblog", 296 "libutils", 297 "server_configurable_flags", 298 ], 299 static_libs: [ 300 "android.hardware.audio.common@5.0", 301 "android.hardware.bluetooth.audio@2.0", 302 "android.hardware.bluetooth.audio@2.1", 303 "libFraunhoferAAC", 304 "libbase", 305 "libbluetooth-dumpsys", 306 "libbluetooth-for-tests", 307 "libbluetooth-gdx", 308 "libbluetooth-types", 309 "libbluetooth_core_rs", 310 "libbluetooth_crypto_toolbox", 311 "libbluetooth_log", 312 "libbt-audio-asrc", 313 "libbt-audio-hal-interface", 314 "libbt-bta", 315 "libbt-bta-core", 316 "libbt-btu-main-thread", 317 "libbt-common", 318 "libbt-hci", 319 "libbt-jni-thread", 320 "libbt-sbc-decoder", 321 "libbt-sbc-encoder", 322 "libbt-stack", 323 "libbt-stack-core", 324 "libbt_shim_bridge", 325 "libbtcore", 326 "libbtdevice", 327 "libbtif", 328 "libbtif-core", 329 "libchrome", 330 "libcom.android.sysprop.bluetooth.wrapped", 331 "libevent", 332 "libflagtest", 333 "libflatbuffers-cpp", 334 "libfmq", 335 "libg722codec", 336 "libgmock", 337 "liblc3", 338 "libopus", 339 "libprotobuf-cpp-lite", 340 "libstatslog_bt", 341 "libudrv-uipc", 342 ], 343 target: { 344 android: { 345 shared_libs: [ 346 "libPlatformProperties", 347 "libbinder_ndk", 348 "libstatssocket", 349 ], 350 static_libs: [ 351 "android.hardware.bluetooth.a2dp@1.0", 352 "android.hardware.bluetooth@1.0", 353 "android.hardware.bluetooth@1.1", 354 "android.hardware.common-V2-ndk", 355 "android.hardware.common.fmq-V1-ndk", 356 "android.system.suspend-V1-ndk", 357 "android.system.suspend.control-V1-ndk", 358 "libaaudio", 359 ], 360 }, 361 host: { 362 static_libs: [ 363 "libbinder_ndk", 364 ], 365 }, 366 }, 367 sanitize: { 368 integer_overflow: true, 369 }, 370} 371 372// btif profile queue unit tests for target 373cc_test { 374 name: "net_test_btif_profile_queue", 375 defaults: [ 376 "fluoride_defaults", 377 "mts_defaults", 378 ], 379 test_suites: ["general-tests"], 380 include_dirs: btifCommonIncludes, 381 srcs: [ 382 "src/btif_profile_queue.cc", 383 "test/btif_profile_queue_test.cc", 384 ], 385 header_libs: ["libbluetooth_headers"], 386 generated_headers: [ 387 "BluetoothGeneratedDumpsysDataSchema_h", 388 ], 389 static_libs: [ 390 "libbluetooth-types", 391 "libbluetooth_gd", 392 "libbluetooth_log", 393 "libbt_shim_bridge", 394 "libbt_shim_ffi", 395 "libchrome", 396 "libosi", 397 ], 398 cflags: [ 399 "-Wno-unused-parameter", 400 ], 401 shared_libs: [ 402 "libbase", 403 "liblog", 404 ], 405} 406 407// btif avrcp audio track unit tests 408cc_test { 409 name: "net_test_btif_avrcp_audio_track", 410 defaults: [ 411 "fluoride_defaults", 412 "mts_defaults", 413 ], 414 test_suites: ["general-tests"], 415 host_supported: true, 416 include_dirs: btifCommonIncludes + [ 417 "frameworks/av/media/libaaudio/include", 418 ], 419 srcs: [ 420 ":TestCommonMockFunctions", 421 ":TestMockFrameworks", 422 "src/btif_avrcp_audio_track.cc", 423 "test/btif_avrcp_audio_track_test.cc", 424 ], 425 header_libs: ["libbluetooth_headers"], 426 generated_headers: [ 427 "BluetoothGeneratedDumpsysDataSchema_h", 428 ], 429 static_libs: [ 430 "libbluetooth-types", 431 "libbluetooth_log", 432 "libbt_shim_bridge", 433 "libbt_shim_ffi", 434 "libchrome", 435 "libosi", 436 ], 437 shared_libs: [ 438 "libbase", 439 "liblog", 440 ], 441 cflags: [ 442 "-Wno-unused-parameter", 443 ], 444} 445 446// btif rc unit tests for target 447cc_test { 448 name: "net_test_btif_rc", 449 defaults: [ 450 "fluoride_defaults", 451 "mts_defaults", 452 ], 453 test_suites: ["general-tests"], 454 host_supported: true, 455 test_options: { 456 unit_test: true, 457 }, 458 include_dirs: btifCommonIncludes, 459 srcs: [ 460 ":TestCommonMockFunctions", 461 ":TestMockBtaAv", 462 ":TestMockOsi", 463 ":TestMockStackAvrc", 464 "src/btif_util.cc", 465 "test/btif_rc_test.cc", 466 ], 467 header_libs: ["libbluetooth_headers"], 468 shared_libs: [ 469 "libbase", 470 "libcrypto", 471 "libcutils", 472 "liblog", 473 ], 474 static_libs: [ 475 "libbluetooth-types", 476 "libbluetooth_crypto_toolbox", 477 "libbluetooth_gd", 478 "libbluetooth_log", 479 "libbt-common", 480 "libbt-platform-protos-lite", 481 "libbt_shim_bridge", 482 "libbt_shim_ffi", 483 "libchrome", 484 "libevent", 485 ], 486 target: { 487 android: { 488 shared_libs: ["libstatssocket"], 489 }, 490 }, 491 cflags: [ 492 "-Wno-unused-parameter", 493 ], 494 sanitize: { 495 address: true, 496 cfi: true, 497 misc_undefined: ["bounds"], 498 }, 499} 500 501// btif hf client service tests for target 502cc_test { 503 name: "net_test_btif_hf_client_service", 504 defaults: [ 505 "fluoride_defaults", 506 "mts_defaults", 507 ], 508 test_suites: ["general-tests"], 509 include_dirs: btifCommonIncludes, 510 srcs: [ 511 ":TestCommonMockFunctions", 512 ":TestFakeOsi", 513 ":TestMockStack", 514 "test/btif_hf_client_service_test.cc", 515 ], 516 header_libs: ["libbluetooth_headers"], 517 shared_libs: [ 518 "libbase", 519 "libcutils", 520 "liblog", 521 ], 522 static_libs: [ 523 "libbluetooth-types", 524 "libbluetooth_log", 525 "libbt-platform-protos-lite", 526 "libbt_shim_bridge", 527 "libbt_shim_ffi", 528 "libchrome", 529 "libcom.android.sysprop.bluetooth.wrapped", 530 "libgmock", 531 ], 532 cflags: [ 533 "-Wno-unused-parameter", 534 ], 535} 536 537cc_test { 538 name: "net_test_btif_hh", 539 host_supported: true, 540 defaults: [ 541 "fluoride_defaults", 542 "latest_android_hardware_audio_common_ndk_static", 543 "latest_android_hardware_bluetooth_audio_ndk_static", 544 "latest_android_media_audio_common_types_ndk_static", 545 "mts_defaults", 546 ], 547 test_suites: ["general-tests"], 548 include_dirs: btifCommonIncludes + 549 ["frameworks/av/media/libaaudio/include"], 550 srcs: [ 551 ":BtaDmSources", 552 ":LibBluetoothSources", 553 ":OsiCompatSources", 554 ":TestCommonCoreInterface", 555 ":TestCommonMainHandler", 556 ":TestCommonMockFunctions", 557 ":TestMockBtaAg", 558 ":TestMockBtaAr", 559 ":TestMockBtaAv", 560 ":TestMockBtaCsis", 561 ":TestMockBtaGatt", 562 ":TestMockBtaGroups", 563 ":TestMockBtaHas", 564 ":TestMockBtaHd", 565 ":TestMockBtaHearingAid", 566 ":TestMockBtaHf", 567 ":TestMockBtaHh", 568 ":TestMockBtaJv", 569 ":TestMockBtaLeAudio", 570 ":TestMockBtaLeAudioHalVerifier", 571 ":TestMockBtaPan", 572 ":TestMockBtaRas", 573 ":TestMockBtaScn", 574 ":TestMockBtaSdp", 575 ":TestMockBtaSys", 576 ":TestMockBtaVc", 577 ":TestMockBtcore", 578 ":TestMockBtu", 579 ":TestMockHci", 580 ":TestMockMainShim", 581 ":TestMockMainShimDumpsys", 582 ":TestMockMainShimEntry", 583 ":TestMockStack", 584 ":TestMockUdrv", 585 "test/btif_hh_test.cc", 586 ], 587 generated_headers: [ 588 "BluetoothGeneratedBundlerSchema_h_bfbs", 589 "BluetoothGeneratedDumpsysDataSchema_h", 590 ], 591 header_libs: ["libbluetooth_headers"], 592 shared_libs: [ 593 "libaconfig_storage_read_api_cc", 594 "libbase", 595 "libcrypto", 596 "libcutils", 597 "libfmq", 598 "libhidlbase", 599 "liblog", 600 "libutils", 601 "server_configurable_flags", 602 ], 603 static_libs: [ 604 "android.hardware.audio.common@5.0", 605 "android.hardware.bluetooth.a2dp@1.0", 606 "android.hardware.bluetooth.audio@2.0", 607 "android.hardware.bluetooth.audio@2.1", 608 "avrcp-target-service", 609 "bluetooth_flags_c_lib", 610 "lib-bt-packets", 611 "lib-bt-packets-avrcp", 612 "lib-bt-packets-base", 613 "libaudio-a2dp-hw-utils", 614 "libbluetooth-types", 615 "libbluetooth_crypto_toolbox", 616 "libbluetooth_gd", 617 "libbluetooth_log", 618 "libbt-audio-hal-interface", 619 "libbt-common", 620 "libbt-jni-thread", 621 "libbt-platform-protos-lite", 622 "libbt-sbc-decoder", 623 "libbt-sbc-encoder", 624 "libbt-stack", 625 "libbt-stack-core", 626 "libbt_shim_bridge", 627 "libbt_shim_ffi", 628 "libbtdevice", 629 "libbtif", 630 "libbtif-core", 631 "libchrome", 632 "libcom.android.sysprop.bluetooth.wrapped", 633 "libevent", 634 "libgmock", 635 "libosi", 636 "libprotobuf-cpp-lite", 637 "libstatslog_bt", 638 ], 639 target: { 640 android: { 641 static_libs: [ 642 "android.hardware.common-V2-ndk", 643 "android.hardware.common.fmq-V1-ndk", 644 ], 645 shared_libs: [ 646 "libaaudio", 647 "libbinder_ndk", 648 "libstatssocket", 649 ], 650 }, 651 }, 652 sanitize: { 653 address: true, 654 cfi: true, 655 misc_undefined: ["bounds"], 656 }, 657} 658 659// Cycle stack test 660cc_test { 661 name: "net_test_btif_stack", 662 host_supported: true, 663 defaults: [ 664 "fluoride_defaults", 665 "latest_android_hardware_audio_common_ndk_static", 666 "latest_android_hardware_bluetooth_audio_ndk_static", 667 "latest_android_media_audio_common_types_ndk_static", 668 "mts_defaults", 669 ], 670 test_suites: ["general-tests"], 671 include_dirs: btifCommonIncludes + 672 ["frameworks/av/media/libaaudio/include"], 673 srcs: [ 674 ":BtaDmSources", 675 ":LibBluetoothSources", 676 ":OsiCompatSources", 677 ":TestCommonCoreInterface", 678 ":TestCommonMockFunctions", 679 ":TestFakeOsi", 680 ":TestMockBtaAg", 681 ":TestMockBtaAr", 682 ":TestMockBtaAv", 683 ":TestMockBtaCsis", 684 ":TestMockBtaGatt", 685 ":TestMockBtaGroups", 686 ":TestMockBtaHas", 687 ":TestMockBtaHd", 688 ":TestMockBtaHearingAid", 689 ":TestMockBtaHf", 690 ":TestMockBtaHh", 691 ":TestMockBtaJv", 692 ":TestMockBtaLeAudio", 693 ":TestMockBtaLeAudioHalVerifier", 694 ":TestMockBtaPan", 695 ":TestMockBtaRas", 696 ":TestMockBtaScn", 697 ":TestMockBtaSdp", 698 ":TestMockBtaSys", 699 ":TestMockBtaVc", 700 ":TestMockBtcore", 701 ":TestMockBtu", 702 ":TestMockHci", 703 ":TestMockMainShim", 704 ":TestMockMainShimDumpsys", 705 ":TestMockMainShimEntry", 706 ":TestMockStack", 707 ":TestMockUdrv", 708 "test/btif_core_test.cc", 709 ], 710 generated_headers: [ 711 "BluetoothGeneratedBundlerSchema_h_bfbs", 712 "BluetoothGeneratedDumpsysDataSchema_h", 713 ], 714 header_libs: ["libbluetooth_headers"], 715 shared_libs: [ 716 "libaconfig_storage_read_api_cc", 717 "libbase", 718 "libcrypto", 719 "libcutils", 720 "libfmq", 721 "libhidlbase", 722 "liblog", 723 "libutils", 724 "server_configurable_flags", 725 ], 726 static_libs: [ 727 "android.hardware.audio.common@5.0", 728 "android.hardware.bluetooth.audio@2.0", 729 "android.hardware.bluetooth.audio@2.1", 730 "avrcp-target-service", 731 "bluetooth_flags_c_lib", 732 "lib-bt-packets", 733 "lib-bt-packets-avrcp", 734 "lib-bt-packets-base", 735 "libaudio-a2dp-hw-utils", 736 "libbluetooth-types", 737 "libbluetooth_crypto_toolbox", 738 "libbluetooth_gd", 739 "libbluetooth_hci_pdl", 740 "libbluetooth_log", 741 "libbt-audio-hal-interface", 742 "libbt-btu-main-thread", 743 "libbt-common", 744 "libbt-jni-thread", 745 "libbt-platform-protos-lite", 746 "libbt-sbc-decoder", 747 "libbt-sbc-encoder", 748 "libbt_shim_bridge", 749 "libbt_shim_ffi", 750 "libbtdevice", 751 "libbtif", 752 "libbtif-core", 753 "libchrome", 754 "libcom.android.sysprop.bluetooth.wrapped", 755 "libevent", 756 "libflatbuffers-cpp", 757 "libgmock", 758 "libprotobuf-cpp-lite", 759 "libstatslog_bt", 760 ], 761 target: { 762 android: { 763 static_libs: [ 764 "android.hardware.bluetooth.a2dp@1.0", 765 "android.hardware.common-V2-ndk", 766 "android.hardware.common.fmq-V1-ndk", 767 ], 768 shared_libs: [ 769 "libbinder_ndk", 770 "libstatssocket", 771 ], 772 }, 773 }, 774 sanitize: { 775 address: true, 776 cfi: true, 777 misc_undefined: ["bounds"], 778 }, 779} 780