1/* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package { 18 default_applicable_licenses: ["system_chre_license"], 19} 20 21// Added automatically by a large-scale-change that took the approach of 22// 'apply every license found to every target'. While this makes sure we respect 23// every license restriction, it may not be entirely correct. 24// 25// e.g. GPL in an MIT project might only apply to the contrib/ directory. 26// 27// Please consider splitting the single license below into multiple licenses, 28// taking care not to lose any license_kind information, and overriding the 29// default license using the 'licenses: [...]' property on targets as needed. 30// 31// For unused files, consider creating a 'fileGroup' with "//visibility:private" 32// to attach the license to, and including a comment whether the files may be 33// used in the current project. 34// See: http://go/android-license-faq 35license { 36 name: "system_chre_license", 37 visibility: [":__subpackages__"], 38 license_kinds: [ 39 "SPDX-license-identifier-Apache-2.0", 40 "SPDX-license-identifier-BSD", 41 ], 42 license_text: [ 43 "NOTICE", 44 ], 45} 46 47cc_library_static { 48 name: "chre_client", 49 vendor_available: true, 50 export_include_dirs: [ 51 "host/common/include", 52 "platform/shared/include", 53 "util/include", 54 ], 55 srcs: [ 56 "host/common/fragmented_load_transaction.cc", 57 "host/common/host_protocol_host.cc", 58 "host/common/socket_client.cc", 59 "platform/shared/host_protocol_common.cc", 60 ], 61 header_libs: ["chre_flatbuffers"], 62 export_header_lib_headers: ["chre_flatbuffers"], 63 shared_libs: [ 64 "libcutils", 65 "liblog", 66 "libutils", 67 ], 68 cflags: ["-Wall", "-Werror"], 69} 70 71cc_binary { 72 name: "chre_test_client", 73 vendor: true, 74 local_include_dirs: [ 75 "chre_api/include/chre_api", 76 "util/include", 77 ], 78 srcs: [ 79 "host/common/test/chre_test_client.cc", 80 ], 81 cflags: ["-Wall", "-Werror"], 82 shared_libs: [ 83 "libcutils", 84 "liblog", 85 "libutils", 86 ], 87 static_libs: ["chre_client"], 88} 89 90cc_binary { 91 name: "chre_power_test_client", 92 vendor: true, 93 local_include_dirs: [ 94 "chre_api/include/chre_api", 95 "util/include", 96 "apps/power_test/common/include", 97 ], 98 srcs: [ 99 "host/common/test/power_test/chre_power_test_client.cc", 100 ], 101 cflags: ["-Wall", "-Werror"], 102 shared_libs: [ 103 "libcutils", 104 "liblog", 105 "libutils", 106 ], 107 static_libs: ["chre_client"], 108} 109 110cc_test { 111 name: "audio_stress_test", 112 vendor: true, 113 local_include_dirs: [ 114 "chre_api/include/chre_api", 115 "util/include", 116 ], 117 srcs: [ 118 "host/common/audio_stress_test/audio_stress_test.cc", 119 ], 120 cflags: ["-Wall", "-Werror"], 121 shared_libs: [ 122 "libcutils", 123 "liblog", 124 "libutils", 125 ], 126 static_libs: ["chre_client"], 127 gtest: false, 128} 129 130cc_library_headers { 131 name: "android.hardware.contexthub@1.X-shared-impl", 132 vendor: true, 133 export_include_dirs: ["host/hal_generic/common/"], 134 cflags: ["-Wall", "-Werror"], 135 shared_libs: [ 136 "libcutils", 137 "liblog", 138 "libhidlbase", 139 "libutils", 140 "android.hardware.contexthub@1.0", 141 ], 142 static_libs: ["chre_client"], 143} 144 145cc_library_shared { 146 name: "android.hardware.contexthub@1.0-impl.generic", 147 vendor: true, 148 relative_install_path: "hw", 149 srcs: [ 150 "host/hal_generic/V1_0/generic_context_hub_v1_0.cc", 151 "host/hal_generic/common/hal_chre_socket_connection.cc", 152 "host/hal_generic/common/permissions_util.cc", 153 ], 154 cflags: ["-Wall", "-Werror"], 155 header_libs: [ 156 "android.hardware.contexthub@1.X-shared-impl", 157 "android.hardware.contexthub@1.X-common-utils", 158 ], 159 shared_libs: [ 160 "libcutils", 161 "liblog", 162 "libhidlbase", 163 "libutils", 164 "android.hardware.contexthub@1.0", 165 "android.hardware.contexthub@1.1", 166 "android.hardware.contexthub@1.2", 167 ], 168 static_libs: ["chre_client"], 169} 170 171cc_binary { 172 name: "android.hardware.contexthub@1.1-service.generic", 173 defaults: ["hidl_defaults"], 174 vendor: true, 175 relative_install_path: "hw", 176 srcs: [ 177 "host/hal_generic/V1_1/generic_context_hub_v1_1.cc", 178 "host/hal_generic/V1_1/service.cc", 179 "host/hal_generic/common/context_hub_settings_util.cc", 180 "host/hal_generic/common/hal_chre_socket_connection.cc", 181 "host/hal_generic/common/permissions_util.cc", 182 ], 183 init_rc: ["host/hal_generic/V1_1/android.hardware.contexthub@1.1-service-generic.rc"], 184 cflags: ["-Wall", "-Werror"], 185 header_libs: [ 186 "android.hardware.contexthub@1.X-shared-impl", 187 "android.hardware.contexthub@1.X-common-utils", 188 ], 189 shared_libs: [ 190 "libcutils", 191 "liblog", 192 "libhidlbase", 193 "libutils", 194 "android.hardware.contexthub@1.0", 195 "android.hardware.contexthub@1.1", 196 "android.hardware.contexthub@1.2", 197 ], 198 static_libs: ["chre_client"], 199 vintf_fragments: ["host/hal_generic/V1_1/android.hardware.contexthub@1.1-generic.xml"], 200} 201 202cc_binary { 203 name: "android.hardware.contexthub@1.2-service.generic", 204 defaults: ["hidl_defaults"], 205 vendor: true, 206 relative_install_path: "hw", 207 srcs: [ 208 "host/hal_generic/V1_2/generic_context_hub_v1_2.cc", 209 "host/hal_generic/V1_2/service.cc", 210 "host/hal_generic/common/context_hub_settings_util.cc", 211 "host/hal_generic/common/hal_chre_socket_connection.cc", 212 "host/hal_generic/common/permissions_util.cc", 213 ], 214 init_rc: ["host/hal_generic/V1_2/android.hardware.contexthub@1.2-service-generic.rc"], 215 cflags: ["-Wall", "-Werror"], 216 header_libs: [ 217 "android.hardware.contexthub@1.X-shared-impl", 218 "android.hardware.contexthub@1.X-common-utils", 219 ], 220 shared_libs: [ 221 "libcutils", 222 "liblog", 223 "libhidlbase", 224 "libutils", 225 "android.hardware.contexthub@1.0", 226 "android.hardware.contexthub@1.1", 227 "android.hardware.contexthub@1.2", 228 ], 229 static_libs: ["chre_client"], 230 vintf_fragments: ["host/hal_generic/V1_2/android.hardware.contexthub@1.2-generic.xml"], 231} 232 233cc_library_static { 234 name: "event_logger", 235 vendor: true, 236 host_supported: true, 237 srcs: [ 238 "host/hal_generic/aidl/event_logger.cc", 239 ], 240 local_include_dirs: [ 241 "util/include", 242 "host/common/include", 243 ], 244 shared_libs: [ 245 "android.hardware.contexthub-V1-ndk", 246 "libcutils", 247 "libutils", 248 ], 249 header_libs: [ 250 "chre_flatbuffers", 251 ], 252 cflags: [ 253 "-Wall", 254 "-Werror", 255 "-DCHRE_IS_HOST_BUILD", 256 ], 257} 258 259cc_test_host { 260 name: "hal_unit_tests", 261 vendor: true, 262 srcs: [ 263 "host/test/**/*_test.cc", 264 ], 265 local_include_dirs: [ 266 "util/include", 267 "host/common/include", 268 ], 269 static_libs: [ 270 "android.hardware.contexthub-V1-ndk", 271 "event_logger", 272 "libgmock", 273 ], 274 shared_libs: [ 275 "libcutils", 276 "libutils", 277 ], 278 header_libs: [ 279 "chre_flatbuffers", 280 ], 281 defaults: [ 282 "chre_linux_cflags", 283 ], 284 cflags: [ 285 "-Wall", 286 "-Werror", 287 "-DCHRE_IS_HOST_BUILD", 288 ], 289} 290 291cc_binary { 292 name: "android.hardware.contexthub-service.generic", 293 defaults: ["hidl_defaults"], 294 vendor: true, 295 relative_install_path: "hw", 296 srcs: [ 297 "host/hal_generic/aidl/generic_context_hub_aidl.cc", 298 "host/hal_generic/aidl/service.cc", 299 "host/hal_generic/common/hal_chre_socket_connection.cc", 300 "host/hal_generic/common/permissions_util.cc", 301 ], 302 local_include_dirs: [ 303 "host/hal_generic/common/", 304 "util/include", 305 ], 306 init_rc: ["host/hal_generic/aidl/android.hardware.contexthub-service.generic.rc"], 307 cflags: [ 308 "-Wall", 309 "-Werror", 310 "-DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4000", // Needed to import CHRE APIs. 311 "-DCHRE_HAL_SOCKET_METRICS_ENABLED", 312 "-DCHRE_IS_HOST_BUILD", 313 ], 314 shared_libs: [ 315 "android.frameworks.stats-V1-ndk", 316 "libcutils", 317 "liblog", 318 "libprotobuf-cpp-lite", 319 "libutils", 320 "libbase", 321 "libbinder_ndk", 322 "android.hardware.contexthub-V1-ndk", 323 "//hardware/google/pixel:pixelatoms-cpp", 324 ], 325 header_libs: [ 326 "chre_api", 327 ], 328 static_libs: [ 329 "chre_client", 330 "event_logger", 331 ], 332 vintf_fragments: ["host/hal_generic/aidl/android.hardware.contexthub-service.generic.xml"], 333} 334 335cc_library_headers { 336 name: "chre_api", 337 vendor: true, 338 export_include_dirs: [ 339 "chre_api/include/chre_api", 340 "chre_api/include", 341 ], 342 host_supported: true, 343} 344 345cc_library_headers { 346 name: "chre_flatbuffers", 347 vendor_available: true, 348 host_supported: true, 349 export_include_dirs: [ 350 "external/flatbuffers/include", 351 ], 352} 353 354cc_library_headers { 355 name: "chre_pal", 356 vendor: true, 357 export_include_dirs: [ 358 "pal/include", 359 ], 360 header_libs: [ 361 "chre_api", 362 ], 363 export_header_lib_headers: [ 364 "chre_api", 365 ], 366 host_supported: true, 367} 368 369cc_library_headers { 370 name: "chre_test_common", 371 vendor: true, 372 export_include_dirs: [ 373 "test/common/include", 374 ], 375 host_supported: true, 376} 377 378cc_library_static { 379 name: "chre_pal_linux", 380 vendor: true, 381 srcs: [ 382 "platform/shared/pal_system_api.cc", 383 "platform/linux/assert.cc", 384 "platform/linux/fatal_error.cc", 385 "platform/linux/memory.cc", 386 "platform/linux/pal_gnss.cc", 387 "platform/linux/pal_nan.cc", 388 "platform/linux/pal_wifi.cc", 389 "platform/linux/pal_wwan.cc", 390 "platform/linux/platform_log.cc", 391 "platform/linux/system_time.cc", 392 ], 393 export_include_dirs: [ 394 "platform/shared/include", 395 "platform/include", 396 "platform/linux/include", 397 "util/include", 398 ], 399 header_libs: [ 400 "chre_pal", 401 ], 402 static_libs: [ 403 "libgtest", 404 "libgmock", 405 ], 406 defaults: [ 407 "chre_linux_cflags", 408 ], 409 host_supported: true, 410} 411 412cc_test_host { 413 name: "chre_unit_tests", 414 srcs: [ 415 "core/tests/**/*.cc", 416 "pal/tests/**/*_test.cc", 417 "pal/util/tests/**/*.cc", 418 "pal/util/wifi_pal_convert.c", 419 "pal/util/wifi_scan_cache.c", 420 "platform/tests/**/*.cc", 421 "util/tests/**/*.cc", 422 ], 423 exclude_srcs: [ 424 // Exclude slow PAL tests. 425 "pal/tests/src/gnss_pal_impl_test.cc", 426 ], 427 local_include_dirs: [ 428 "chre_api/include", 429 "chre_api/include/chre_api", 430 "core/include", 431 "pal/include", 432 "pal/tests/include", 433 "pal/util/include", 434 "platform/include", 435 "platform/linux/include", 436 "platform/shared/include", 437 "util/include", 438 ], 439 cflags: [ 440 "-DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4096", 441 "-DCHRE_MINIMUM_LOG_LEVEL=CHRE_LOG_LEVEL_DEBUG", 442 "-DCHRE_ASSERTIONS_ENABLED=true", 443 "-DCHRE_FILENAME=__FILE__", 444 "-DGTEST", 445 ], 446 static_libs: [ 447 "chre_linux", 448 "libgmock", 449 ], 450 sanitize: { 451 address: true, 452 }, 453} 454 455cc_test_host { 456 name: "chre_simulation_tests", 457 srcs: [ 458 "test/simulation/*.cc", 459 ], 460 local_include_dirs: [ 461 "test/simulation/inc", 462 "platform/shared", 463 ], 464 static_libs: [ 465 "chre_linux", 466 "chre_pal_linux", 467 ], 468 defaults: [ 469 "chre_linux_cflags", 470 ], 471 sanitize: { 472 address: true, 473 }, 474} 475 476cc_library_static { 477 name: "chre_linux", 478 vendor: true, 479 srcs: [ 480 "core/audio_request_manager.cc", 481 "core/ble_request_manager.cc", 482 "core/ble_request_multiplexer.cc", 483 "core/ble_request.cc", 484 "core/debug_dump_manager.cc", 485 "core/event_loop_manager.cc", 486 "core/event_loop.cc", 487 "core/event_ref_queue.cc", 488 "core/event.cc", 489 "core/gnss_manager.cc", 490 "core/host_comms_manager.cc", 491 "core/host_notifications.cc", 492 "core/init.cc", 493 "core/nanoapp.cc", 494 "core/sensor_request_manager.cc", 495 "core/sensor_request_multiplexer.cc", 496 "core/sensor_request.cc", 497 "core/sensor_type_helpers.cc", 498 "core/sensor_type.cc", 499 "core/sensor.cc", 500 "core/settings.cc", 501 "core/timer_pool.cc", 502 "core/wifi_request_manager.cc", 503 "core/wifi_scan_request.cc", 504 "platform/linux/assert.cc", 505 "platform/linux/context.cc", 506 "platform/linux/fatal_error.cc", 507 "platform/linux/host_link.cc", 508 "platform/linux/memory_manager.cc", 509 "platform/linux/memory.cc", 510 "platform/linux/pal_audio.cc", 511 "platform/linux/pal_ble.cc", 512 "platform/linux/pal_gnss.cc", 513 "platform/linux/pal_nan.cc", 514 "platform/linux/pal_sensor.cc", 515 "platform/linux/pal_wifi.cc", 516 "platform/linux/platform_debug_dump_manager.cc", 517 "platform/linux/platform_log.cc", 518 "platform/linux/platform_nanoapp.cc", 519 "platform/linux/platform_pal.cc", 520 "platform/linux/platform_sensor_type_helpers.cc", 521 "platform/linux/platform_sensor.cc", 522 "platform/linux/power_control_manager.cc", 523 "platform/linux/system_time.cc", 524 "platform/linux/system_timer.cc", 525 "platform/linux/testing/platform_audio.cc", 526 "platform/shared/chre_api_audio.cc", 527 "platform/shared/chre_api_ble.cc", 528 "platform/shared/chre_api_core.cc", 529 "platform/shared/chre_api_gnss.cc", 530 "platform/shared/chre_api_re.cc", 531 "platform/shared/chre_api_sensor.cc", 532 "platform/shared/chre_api_user_settings.cc", 533 "platform/shared/chre_api_wifi.cc", 534 "platform/shared/log_buffer.cc", 535 "platform/shared/memory_manager.cc", 536 "platform/shared/pal_system_api.cc", 537 "platform/shared/platform_ble.cc", 538 "platform/shared/platform_gnss.cc", 539 "platform/shared/platform_sensor_manager.cc", 540 "platform/shared/platform_wifi.cc", 541 "platform/shared/system_time.cc", 542 "platform/shared/version.cc", 543 "util/**/*.cc", 544 ], 545 // TODO(b/217952682) Exclude pigweed because it can't be built via 546 // Android.bp 547 exclude_srcs: [ 548 "util/pigweed/*.cc", 549 "util/tests/**/*", 550 ], 551 export_include_dirs: [ 552 "chre_api/include", 553 "chre_api/include/chre_api", 554 "core/include", 555 "pal/include", 556 "pal/util/include", 557 "platform/linux/include", 558 "platform/linux/testing/include", 559 "platform/shared/include", 560 "platform/include", 561 "util/include", 562 ], 563 header_libs: [ 564 "chre_api", 565 ], 566 defaults: [ 567 "chre_linux_cflags", 568 ], 569 static_libs: [ 570 "libgtest", 571 "libgmock", 572 ], 573 host_supported: true, 574} 575 576cc_defaults { 577 name: "chre_linux_cflags", 578 cflags: [ 579 "-DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4096", 580 "-DCHRE_MINIMUM_LOG_LEVEL=CHRE_LOG_LEVEL_DEBUG", 581 "-DCHRE_ASSERTIONS_ENABLED=true", 582 "-DCHRE_FILENAME=__FILE__", 583 "-DGTEST", 584 "-DCHRE_FIRST_SUPPORTED_API_VERSION=CHRE_API_VERSION_1_1", 585 "-DCHRE_AUDIO_SUPPORT_ENABLED", 586 "-DCHRE_BLE_SUPPORT_ENABLED", 587 "-DCHRE_GNSS_SUPPORT_ENABLED", 588 "-DCHRE_SENSORS_SUPPORT_ENABLED", 589 "-DCHRE_WIFI_SUPPORT_ENABLED", 590 "-DCHRE_WIFI_NAN_SUPPORT_ENABLED", 591 ], 592} 593 594subdirs = [ 595 "apps/wifi_offload", 596] 597