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