• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_team: "trendy_team_context_hub",
19    default_applicable_licenses: ["system_chre_license"],
20}
21
22license {
23    name: "system_chre_license",
24    visibility: [":__subpackages__"],
25    license_kinds: [
26        "SPDX-license-identifier-Apache-2.0",
27        "SPDX-license-identifier-BSD",
28    ],
29    license_text: [
30        "NOTICE",
31    ],
32}
33
34filegroup {
35    name: "contexthub_hal_socket",
36    srcs: ["host/common/socket_server.cc"],
37}
38
39filegroup {
40    name: "contexthub_hal_wifi",
41    srcs: ["host/common/wifi_ext_hal_handler.cc"],
42}
43
44filegroup {
45    name: "contexthub_hal_core",
46    srcs: [
47        "host/common/bt_snoop_log_parser.cc",
48        "host/common/config_util.cc",
49        "host/common/log.cc",
50        "host/common/log_message_parser.cc",
51        "host/common/preloaded_nanoapp_loader.cc",
52        "host/common/time_syncer.cc",
53        "host/hal_generic/common/hal_client_manager.cc",
54        "host/hal_generic/common/multi_client_context_hub_base.cc",
55        "host/hal_generic/common/permissions_util.cc",
56    ],
57}
58
59filegroup {
60    name: "bluetooth_socket_hal_core",
61    srcs: ["host/hal_generic/common/bluetooth_socket_fbs_hal.cc"],
62}
63
64filegroup {
65    name: "contexthub_hal_common_srcs",
66    srcs: [
67        "host/common/file_stream.cc",
68        "host/common/fragmented_load_transaction.cc",
69        "host/common/host_protocol_host.cc",
70        "host/common/log.cc",
71        "host/hal_generic/common/context_hub_v4_impl.cc",
72        "host/hal_generic/common/host_protocol_host_v4.cc",
73        "host/hal_generic/common/message_hub_manager.cc",
74        "platform/shared/host_protocol_common.cc",
75    ],
76}
77
78filegroup {
79    name: "contexthub_hal_client_srcs",
80    srcs: [
81        "host/common/hal_client.cc",
82        "host/common/pigweed/hal_channel_output.cc",
83        "host/common/pigweed/hal_rpc_client.cc",
84        "host/common/socket_client.cc",
85    ],
86}
87
88cc_defaults {
89    name: "contexthub_hal_defaults",
90    vendor: true,
91    srcs: [":contexthub_hal_common_srcs"],
92    include_dirs: [
93        "system/chre/host/common/include/",
94        "system/chre/host/hal_generic/aidl/",
95        "system/chre/host/hal_generic/common/",
96        "system/chre/platform/shared/include/",
97        "system/chre/platform/shared/fbs/include",
98        "system/chre/util/include/",
99    ],
100    header_libs: [
101        "chre_api",
102        "chre_flatbuffers",
103    ],
104    shared_libs: [
105        "android.frameworks.stats-V2-ndk",
106        "android.hardware.contexthub-V4-ndk",
107        "chre_atoms_log",
108        "chremetrics-cpp",
109        "libaconfig_storage_read_api_cc",
110        "libbase",
111        "libbinder_ndk",
112        "libcutils",
113        "libjsoncpp",
114        "liblog",
115        "libprotobuf-cpp-lite",
116        "libutils",
117        "server_configurable_flags",
118    ],
119    static_libs: [
120        "chre_flags_c_lib",
121        "chre_metrics_reporter",
122        "event_logger",
123    ],
124    cflags: [
125        "-DCHRE_IS_HOST_BUILD",
126        "-DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4000", // Needed to import CHRE APIs
127        "-Wall",
128        "-Werror",
129    ],
130}
131
132cc_library_static {
133    name: "chre_client",
134    vendor_available: true,
135    local_include_dirs: [
136        "chre_api/include/chre_api",
137    ],
138    export_include_dirs: [
139        "host/common/include",
140        "platform/shared/include",
141        "platform/shared/fbs/include",
142        "util/include",
143    ],
144    srcs: [
145        "host/common/file_stream.cc",
146        "host/common/fragmented_load_transaction.cc",
147        "host/common/hal_client.cc",
148        "host/common/host_protocol_host.cc",
149        "host/common/log.cc",
150        "host/common/pigweed/hal_channel_output.cc",
151        "host/common/pigweed/hal_rpc_client.cc",
152        "host/common/socket_client.cc",
153        "platform/shared/host_protocol_common.cc",
154    ],
155    header_libs: ["chre_flatbuffers"],
156    export_header_lib_headers: ["chre_flatbuffers"],
157    shared_libs: [
158        "android.hardware.contexthub-V3-ndk",
159        "libaconfig_storage_read_api_cc",
160        "libbase",
161        "libbinder_ndk",
162        "libcutils",
163        "liblog",
164        "libutils",
165        "server_configurable_flags",
166    ],
167    static_libs: [
168        "chre_flags_c_lib",
169    ],
170    cflags: [
171        "-DCHRE_IS_HOST_BUILD",
172        "-DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4000", // Needed to import CHRE APIs.
173        "-Wall",
174        "-Werror",
175        "-Wthread-safety", // Need to be explicitly set
176    ],
177    defaults: [
178        "pw_rpc_cflags_chre",
179        "pw_rpc_nanopb_lib_dependencies",
180    ],
181}
182
183cc_library_static {
184    name: "chre_metrics_reporter",
185    export_include_dirs: [
186        "host/common/include",
187    ],
188    srcs: [
189        "host/common/log.cc",
190        "host/common/metrics_reporter.cc",
191    ],
192    shared_libs: [
193        "android.frameworks.stats-V2-ndk",
194        "chre_atoms_log",
195        "chremetrics-cpp",
196        "libbinder_ndk",
197        "libcutils",
198        "liblog",
199        "libutils",
200    ],
201    vendor: true,
202    cflags: [
203        "-Wall",
204        "-Werror",
205    ],
206}
207
208cc_binary {
209    name: "chre_test_client",
210    vendor: true,
211    local_include_dirs: [
212        "chre_api/include/chre_api",
213        "util/include",
214    ],
215    srcs: [
216        "host/common/test/chre_test_client.cc",
217    ],
218    cflags: [
219        "-Wall",
220        "-Werror",
221    ],
222    shared_libs: [
223        "libcutils",
224        "liblog",
225        "libutils",
226    ],
227    static_libs: [
228        "chre_client",
229        "chre_host_common",
230    ],
231}
232
233genrule {
234    name: "rpc_world_proto_header",
235    defaults: [
236        "pw_rpc_generate_nanopb_proto",
237    ],
238    srcs: ["apps/rpc_world/rpc/rpc_world.proto"],
239    out: [
240        "rpc_world.pb.h",
241    ],
242}
243
244genrule {
245    name: "rpc_world_proto_source",
246    defaults: [
247        "pw_rpc_generate_nanopb_proto",
248    ],
249    srcs: ["apps/rpc_world/rpc/rpc_world.proto"],
250    out: [
251        "rpc_world.pb.c",
252    ],
253}
254
255genrule {
256    name: "rpc_world_rpc_header",
257    defaults: [
258        "pw_rpc_generate_nanopb_rpc_header",
259    ],
260    srcs: ["apps/rpc_world/rpc/rpc_world.proto"],
261    out: [
262        "rpc_world.rpc.pb.h",
263    ],
264}
265
266cc_binary {
267    name: "chre_test_rpc",
268    vendor: true,
269    local_include_dirs: [
270        "chre_api/include/chre_api",
271        "util/include",
272    ],
273    srcs: [
274        "host/common/test/chre_test_rpc.cc",
275    ],
276    cflags: [
277        "-Wall",
278        "-Werror",
279    ],
280    shared_libs: [
281        "libcutils",
282        "liblog",
283        "libutils",
284    ],
285    static_libs: [
286        "chre_client",
287        "libprotobuf-c-nano",
288    ],
289    generated_sources: [
290        "rpc_world_proto_source",
291    ],
292    generated_headers: [
293        "rpc_world_proto_header",
294        "rpc_world_rpc_header",
295    ],
296    defaults: [
297        "pw_rpc_cflags_chre",
298        "pw_rpc_nanopb_lib_dependencies",
299    ],
300}
301
302cc_binary {
303    name: "chre_power_test_client",
304    vendor: true,
305    local_include_dirs: [
306        "apps/power_test/common/include",
307        "apps/power_test/common/generated/include",
308        "chre_api/include/chre_api",
309        "util/include",
310    ],
311    srcs: [
312        "host/common/test/power_test/chre_power_test_client.cc",
313    ],
314    cflags: [
315        "-Wall",
316        "-Werror",
317    ],
318    shared_libs: [
319        "libcutils",
320        "liblog",
321        "libutils",
322    ],
323    static_libs: ["chre_client"],
324}
325
326filegroup {
327    name: "st_hal_lpma_handler",
328    srcs: ["host/common/st_hal_lpma_handler.cc"],
329}
330
331cc_binary {
332    name: "chre_aidl_hal_client",
333    vendor: true,
334    cpp_std: "c++20",
335    local_include_dirs: [
336        "chre_api/include",
337        "host/common/include",
338    ],
339    srcs: [
340        "host/common/chre_aidl_hal_client.cc",
341        "host/common/file_stream.cc",
342        "host/common/log.cc",
343    ],
344    shared_libs: [
345        "android.hardware.contexthub-V3-ndk",
346        "libbase",
347        "libbinder_ndk",
348        "libjsoncpp",
349        "liblog",
350        "libutils",
351    ],
352    static_libs: [
353        "chre_client",
354    ],
355    cflags: [
356        "-DLOG_TAG=\"CHRE.HAL.CLIENT\"",
357        "-Wall",
358        "-Werror",
359        "-fexceptions",
360    ],
361}
362
363cc_test {
364    name: "audio_stress_test",
365    vendor: true,
366    local_include_dirs: [
367        "chre_api/include/chre_api",
368        "util/include",
369    ],
370    srcs: [
371        "host/common/audio_stress_test/audio_stress_test.cc",
372    ],
373    cflags: [
374        "-Wall",
375        "-Werror",
376    ],
377    shared_libs: [
378        "libcutils",
379        "liblog",
380        "libutils",
381    ],
382    static_libs: ["chre_client"],
383    gtest: false,
384}
385
386cc_library_headers {
387    name: "android.hardware.contexthub@1.X-shared-impl",
388    vendor: true,
389    export_include_dirs: ["host/hal_generic/common/"],
390    cflags: [
391        "-Wall",
392        "-Werror",
393    ],
394    shared_libs: [
395        "android.hardware.contexthub@1.0",
396        "libcutils",
397        "libhidlbase",
398        "liblog",
399        "libutils",
400    ],
401    static_libs: ["chre_client"],
402}
403
404cc_library_shared {
405    name: "android.hardware.contexthub@1.0-impl.generic",
406    vendor: true,
407    relative_install_path: "hw",
408    srcs: [
409        "host/hal_generic/V1_0/generic_context_hub_v1_0.cc",
410        "host/hal_generic/common/hal_chre_socket_connection.cc",
411        "host/hal_generic/common/permissions_util.cc",
412    ],
413    cflags: [
414        "-Wall",
415        "-Werror",
416    ],
417    header_libs: [
418        "android.hardware.contexthub@1.X-common-utils",
419        "android.hardware.contexthub@1.X-shared-impl",
420    ],
421    shared_libs: [
422        "android.hardware.contexthub@1.0",
423        "android.hardware.contexthub@1.1",
424        "android.hardware.contexthub@1.2",
425        "libcutils",
426        "libhidlbase",
427        "liblog",
428        "libutils",
429    ],
430    static_libs: ["chre_client"],
431}
432
433cc_library_static {
434    name: "android.hardware.contexthub@1.1-common-impl",
435    vendor: true,
436    srcs: [
437        "host/hal_generic/V1_1/generic_context_hub_v1_1.cc",
438        "host/hal_generic/common/context_hub_settings_util.cc",
439        "host/hal_generic/common/hal_chre_socket_connection.cc",
440        "host/hal_generic/common/permissions_util.cc",
441    ],
442    cflags: [
443        "-Wall",
444        "-Werror",
445    ],
446    export_header_lib_headers: [
447        "android.hardware.contexthub@1.X-common-utils",
448        "android.hardware.contexthub@1.X-shared-impl",
449    ],
450    export_static_lib_headers: [
451        "chre_client",
452    ],
453    export_include_dirs: ["host/hal_generic/V1_1/"],
454    header_libs: [
455        "android.hardware.contexthub@1.X-common-utils",
456        "android.hardware.contexthub@1.X-shared-impl",
457    ],
458    shared_libs: [
459        "android.hardware.contexthub@1.0",
460        "android.hardware.contexthub@1.1",
461        "android.hardware.contexthub@1.2",
462        "libcutils",
463        "libhidlbase",
464        "liblog",
465        "libutils",
466    ],
467    static_libs: ["chre_client"],
468}
469
470cc_binary {
471    name: "android.hardware.contexthub@1.1-service.generic",
472    defaults: ["hidl_defaults"],
473    vendor: true,
474    relative_install_path: "hw",
475    srcs: [
476        "host/hal_generic/V1_1/service.cc",
477    ],
478    init_rc: ["host/hal_generic/V1_1/android.hardware.contexthub@1.1-service-generic.rc"],
479    cflags: [
480        "-Wall",
481        "-Werror",
482    ],
483    shared_libs: [
484        "android.hardware.contexthub@1.0",
485        "android.hardware.contexthub@1.1",
486        "android.hardware.contexthub@1.2",
487        "libcutils",
488        "libhidlbase",
489        "liblog",
490        "libutils",
491    ],
492    static_libs: [
493        "android.hardware.contexthub@1.1-common-impl",
494        "chre_client",
495    ],
496    vintf_fragments: ["host/hal_generic/V1_1/android.hardware.contexthub@1.1-generic.xml"],
497}
498
499cc_binary {
500    name: "android.hardware.contexthub@1.2-service.generic",
501    defaults: ["hidl_defaults"],
502    vendor: true,
503    relative_install_path: "hw",
504    srcs: [
505        "host/hal_generic/V1_2/generic_context_hub_v1_2.cc",
506        "host/hal_generic/V1_2/service.cc",
507        "host/hal_generic/common/context_hub_settings_util.cc",
508        "host/hal_generic/common/hal_chre_socket_connection.cc",
509        "host/hal_generic/common/permissions_util.cc",
510    ],
511    init_rc: ["host/hal_generic/V1_2/android.hardware.contexthub@1.2-service-generic.rc"],
512    cflags: [
513        "-Wall",
514        "-Werror",
515    ],
516    header_libs: [
517        "android.hardware.contexthub@1.X-common-utils",
518        "android.hardware.contexthub@1.X-shared-impl",
519    ],
520    shared_libs: [
521        "android.hardware.contexthub@1.0",
522        "android.hardware.contexthub@1.1",
523        "android.hardware.contexthub@1.2",
524        "libcutils",
525        "libhidlbase",
526        "liblog",
527        "libutils",
528    ],
529    static_libs: ["chre_client"],
530    vintf_fragments: ["host/hal_generic/V1_2/android.hardware.contexthub@1.2-generic.xml"],
531}
532
533cc_library_static {
534    name: "event_logger",
535    vendor: true,
536    host_supported: true,
537    srcs: [
538        "host/hal_generic/aidl/event_logger.cc",
539    ],
540    local_include_dirs: [
541        "host/common/include",
542        "platform/android/include",
543        "platform/include",
544        "util/include",
545    ],
546    shared_libs: [
547        "android.hardware.contexthub-V4-ndk",
548        "libcutils",
549        "libutils",
550    ],
551    header_libs: [
552        "chre_api",
553        "chre_flatbuffers",
554    ],
555    cflags: [
556        "-DCHRE_IS_HOST_BUILD",
557        "-DCHRE_MINIMUM_LOG_LEVEL=CHRE_LOG_LEVEL_DEBUG",
558        "-Wall",
559        "-Werror",
560    ],
561}
562
563cc_library_static {
564    name: "chre_host_common",
565    vendor: true,
566    host_supported: true,
567    cpp_std: "c++20",
568    srcs: [
569        "host/common/log.cc",
570    ],
571    local_include_dirs: [
572        "host/common/include",
573        "util/include",
574    ],
575    shared_libs: [
576        "libcutils",
577        "liblog",
578        "libutils",
579    ],
580    cflags: [
581        "-DCHRE_IS_HOST_BUILD",
582        "-Wall",
583        "-Werror",
584    ],
585}
586
587cc_test_host {
588    name: "hal_unit_tests",
589    vendor: true,
590    srcs: [
591        "host/common/fragmented_load_transaction.cc",
592        "host/common/hal_client.cc",
593        "host/hal_generic/common/hal_client_manager.cc",
594        "host/hal_generic/common/message_hub_manager.cc",
595        "host/test/**/*_test.cc",
596    ],
597    local_include_dirs: [
598        "host/common/include",
599        "host/hal_generic/aidl/",
600        "host/hal_generic/common/",
601        "platform/android/include",
602        "platform/include",
603        "platform/shared/include/",
604        "platform/shared/fbs/include",
605        "util/include/",
606    ],
607    static_libs: [
608        "android.hardware.contexthub-V4-ndk",
609        "chre_flags_c_lib",
610        "chre_host_common",
611        "event_logger",
612        "libgmock",
613        "pw_detokenizer",
614    ],
615    shared_libs: [
616        "android.frameworks.stats-V2-ndk",
617        "android.hardware.contexthub-V4-ndk",
618        "chre_atoms_log",
619        "libaconfig_storage_read_api_cc",
620        "libbase",
621        "libbinder_ndk",
622        "libcutils",
623        "libjsoncpp",
624        "liblog",
625        "libutils",
626        "server_configurable_flags",
627    ],
628    header_libs: [
629        "chre_api",
630        "chre_flatbuffers",
631    ],
632    defaults: [
633        "chre_linux_cflags",
634    ],
635    cflags: [
636        "-DCHRE_IS_HOST_BUILD",
637        "-Wall",
638        "-Werror",
639    ],
640    test_options: {
641        unit_test: true,
642    },
643}
644
645genrule {
646    name: "chre_atoms_log.h",
647    tools: ["stats-log-api-gen"],
648    srcs: [
649        ":libprotobuf-internal-descriptor-proto",
650        ":libstats_atom_options_protos",
651        "core/chre_metrics.proto",
652        "core/chre_metrics_with_atom.proto",
653    ],
654    cmd: "$(location stats-log-api-gen) --header $(out) " +
655        "--module chre " +
656        "--namespace android,chre,Atoms " +
657        "--vendor-proto $(location core/chre_metrics_with_atom.proto)",
658    out: [
659        "chre_atoms_log.h",
660    ],
661}
662
663cc_library {
664    name: "chre_atoms_log",
665    vendor: true,
666    host_supported: true,
667    generated_headers: ["chre_atoms_log.h"],
668    export_generated_headers: ["chre_atoms_log.h"],
669}
670
671cc_library {
672    name: "chremetrics-cpp",
673    vendor: true,
674    proto: {
675        type: "lite",
676        export_proto_headers: true,
677    },
678    srcs: [
679        "core/chre_metrics.proto",
680    ],
681}
682
683cc_library_headers {
684    name: "chre_api",
685    vendor: true,
686    export_include_dirs: [
687        "chre_api/include",
688        "chre_api/include/chre_api",
689    ],
690    host_supported: true,
691}
692
693cc_library_headers {
694    name: "chre_flatbuffers",
695    vendor_available: true,
696    host_supported: true,
697    export_include_dirs: [
698        "external/flatbuffers/include",
699    ],
700}
701
702cc_library_headers {
703    name: "chre_pal",
704    vendor: true,
705    export_include_dirs: [
706        "pal/include",
707    ],
708    header_libs: [
709        "chre_api",
710    ],
711    export_header_lib_headers: [
712        "chre_api",
713    ],
714    host_supported: true,
715}
716
717cc_library_headers {
718    name: "chre_test_common",
719    vendor: true,
720    export_include_dirs: [
721        "test/common/include",
722    ],
723    host_supported: true,
724}
725
726cc_library_static {
727    name: "chre_pal_linux",
728    vendor: true,
729    srcs: [
730        "platform/linux/assert.cc",
731        "platform/linux/fatal_error.cc",
732        "platform/linux/memory.cc",
733        "platform/linux/pal_gnss.cc",
734        "platform/linux/pal_nan.cc",
735        "platform/linux/pal_wifi.cc",
736        "platform/linux/pal_wwan.cc",
737        "platform/linux/platform_log.cc",
738        "platform/linux/system_time.cc",
739        "platform/linux/task_util/task.cc",
740        "platform/linux/task_util/task_manager.cc",
741        "platform/shared/pal_system_api.cc",
742        "util/duplicate_message_detector.cc",
743        "util/dynamic_vector_base.cc",
744    ],
745    export_include_dirs: [
746        "platform/include",
747        "platform/linux/include",
748        "platform/shared/include",
749        "platform/shared/fbs/include",
750        "util/include",
751    ],
752    header_libs: [
753        "chre_pal",
754    ],
755    static_libs: [
756        "libgmock",
757        "libgtest",
758    ],
759    defaults: [
760        "chre_linux_cflags",
761    ],
762    host_supported: true,
763}
764
765cc_test_host {
766    name: "chre_unit_tests",
767    isolated: true,
768    test_suites: ["general-tests"],
769    srcs: [
770        "core/tests/**/*.cc",
771        "pal/tests/**/*_test.cc",
772        "pal/util/tests/**/*.cc",
773        "pal/util/wifi_pal_convert.c",
774        "pal/util/wifi_scan_cache.c",
775        "platform/linux/tests/**/*.cc",
776        "platform/tests/**/*.cc",
777        "util/tests/**/*.cc",
778    ],
779    exclude_srcs: [
780        // Exclude slow PAL tests.
781        "pal/tests/src/gnss_pal_impl_test.cc",
782    ],
783    local_include_dirs: [
784        "chre_api/include",
785        "chre_api/include/chre_api",
786        "core/include",
787        "pal/include",
788        "pal/tests/include",
789        "pal/util/include",
790        "platform/include",
791        "platform/linux/include",
792        "platform/shared/include",
793        "platform/shared/fbs/include",
794        "platform/shared/pw_trace/include",
795        "util/include",
796    ],
797    header_libs: [
798        "chre_flatbuffers",
799    ],
800    static_libs: [
801        "chre_linux",
802        "libgmock",
803        "pw_allocator",
804        "pw_containers",
805        "pw_intrusive_ptr",
806    ],
807    defaults: [
808        "chre_linux_cflags",
809    ],
810    sanitize: {
811        address: true,
812    },
813}
814
815// PW_RPC rules.
816
817cc_defaults {
818    name: "pw_rpc_cflags_chre",
819    cflags: [
820        "-DPW_RPC_COMPLETION_REQUEST_CALLBACK",
821        "-DPW_RPC_DYNAMIC_ALLOCATION",
822        "-DPW_RPC_USE_GLOBAL_MUTEX=0",
823    ],
824}
825
826// Lib dependencies for apps and libs using PW_RPC with nanopb.
827cc_defaults {
828    name: "pw_rpc_nanopb_lib_dependencies",
829    static_libs: [
830        "pw_assert_log",
831        "pw_chrono_stl",
832        "pw_containers",
833        "pw_log_android",
834        "pw_protobuf",
835        "pw_rpc_chre",
836        "pw_rpc_nanopb_chre",
837        "pw_status",
838        "pw_stream",
839        "pw_sync_stl",
840        "pw_thread_stl",
841        "pw_varint",
842    ],
843    export_static_lib_headers: [
844        "pw_assert_log",
845        "pw_chrono_stl",
846        "pw_log_android",
847        "pw_sync_stl",
848        "pw_thread_stl",
849    ],
850    shared_libs: [
851        "liblog",
852    ],
853}
854
855cc_library_static {
856    name: "pw_rpc_chre",
857    defaults: [
858        "pw_rpc_cflags_chre",
859        "pw_rpc_defaults",
860    ],
861    static_libs: [
862        "pw_assert_log",
863        "pw_chrono_stl",
864        "pw_log_android",
865        "pw_sync_stl",
866        "pw_thread_stl",
867    ],
868    export_static_lib_headers: [
869        "pw_assert_log",
870        "pw_chrono_stl",
871        "pw_log_android",
872        "pw_sync_stl",
873        "pw_thread_stl",
874    ],
875    shared_libs: [
876        "liblog",
877    ],
878    host_supported: true,
879    vendor_available: true,
880}
881
882cc_library_static {
883    name: "pw_rpc_nanopb_chre",
884    defaults: [
885        "pw_rpc_cflags_chre",
886        "pw_rpc_nanopb_defaults",
887    ],
888    static_libs: [
889        "pw_rpc_chre",
890        "pw_rpc_raw_chre",
891    ],
892    export_static_lib_headers: [
893        "pw_rpc_chre",
894        "pw_rpc_raw_chre",
895    ],
896    host_supported: true,
897    vendor_available: true,
898}
899
900cc_library_static {
901    name: "pw_rpc_raw_chre",
902    defaults: [
903        "pw_rpc_cflags_chre",
904        "pw_rpc_raw_defaults",
905    ],
906    static_libs: [
907        "pw_rpc_chre",
908    ],
909    host_supported: true,
910    vendor_available: true,
911}
912
913genrule {
914    name: "rpc_test_proto_header",
915    defaults: [
916        "pw_rpc_generate_nanopb_proto",
917    ],
918    srcs: ["test/simulation/rpc/rpc_test.proto"],
919    out: [
920        "rpc_test.pb.h",
921    ],
922}
923
924genrule {
925    name: "rpc_test_proto_source",
926    defaults: [
927        "pw_rpc_generate_nanopb_proto",
928    ],
929    srcs: ["test/simulation/rpc/rpc_test.proto"],
930    out: [
931        "rpc_test.pb.c",
932    ],
933}
934
935genrule {
936    name: "rpc_test_rpc_header",
937    defaults: [
938        "pw_rpc_generate_nanopb_rpc_header",
939    ],
940    srcs: ["test/simulation/rpc/rpc_test.proto"],
941    out: [
942        "rpc_test.rpc.pb.h",
943    ],
944}
945
946cc_test_host {
947    name: "chre_simulation_tests",
948    // TODO(b/232537107): Evaluate if isolated can be turned on
949    isolated: false,
950    test_suites: ["general-tests"],
951    srcs: [
952        "test/simulation/*_test.cc",
953        "test/simulation/test_base.cc",
954        "test/simulation/test_util.cc",
955    ],
956    generated_sources: [
957        "rpc_test_proto_source",
958    ],
959    generated_headers: [
960        "rpc_test_proto_header",
961        "rpc_test_rpc_header",
962    ],
963    local_include_dirs: [
964        "platform/shared",
965        "platform/shared/public_platform_ble_pal",
966        "platform/shared/public_platform_debug_dump_manager",
967        "platform/shared/public_platform_gnss_pal",
968        "platform/shared/public_platform_wifi_pal",
969        "platform/shared/public_platform_wwan_pal",
970        "test/simulation/inc",
971    ],
972    static_libs: [
973        "chre_linux",
974        "chre_pal_linux",
975        "libgmock",
976        "libgtest",
977        "libprotobuf-c-nano",
978        "pw_allocator",
979        "pw_containers",
980        "pw_intrusive_ptr",
981    ],
982    shared_libs: [
983        "libbase",
984    ],
985    defaults: [
986        "chre_linux_cflags",
987        "pw_rpc_cflags_chre",
988        "pw_rpc_nanopb_lib_dependencies",
989    ],
990    sanitize: {
991        address: true,
992    },
993}
994
995cc_library_static {
996    name: "chre_linux",
997    vendor: true,
998    srcs: [
999        "core/audio_request_manager.cc",
1000        "core/ble_request.cc",
1001        "core/ble_request_manager.cc",
1002        "core/ble_request_multiplexer.cc",
1003        "core/chre_message_hub_manager.cc",
1004        "core/debug_dump_manager.cc",
1005        "core/event.cc",
1006        "core/event_loop.cc",
1007        "core/event_loop_manager.cc",
1008        "core/event_ref_queue.cc",
1009        "core/gnss_manager.cc",
1010        "core/host_comms_manager.cc",
1011        "core/host_endpoint_manager.cc",
1012        "core/host_message_hub_manager.cc",
1013        "core/init.cc",
1014        "core/nanoapp.cc",
1015        "core/sensor.cc",
1016        "core/sensor_request.cc",
1017        "core/sensor_request_manager.cc",
1018        "core/sensor_request_multiplexer.cc",
1019        "core/sensor_type.cc",
1020        "core/sensor_type_helpers.cc",
1021        "core/settings.cc",
1022        "core/system_health_monitor.cc",
1023        "core/timer_pool.cc",
1024        "core/wifi_request_manager.cc",
1025        "core/wifi_scan_request.cc",
1026        "platform/linux/assert.cc",
1027        "platform/linux/context.cc",
1028        "platform/linux/fatal_error.cc",
1029        "platform/linux/host_link.cc",
1030        "platform/linux/memory.cc",
1031        "platform/linux/memory_manager.cc",
1032        "platform/linux/pal_audio.cc",
1033        "platform/linux/pal_ble.cc",
1034        "platform/linux/pal_gnss.cc",
1035        "platform/linux/pal_nan.cc",
1036        "platform/linux/pal_sensor.cc",
1037        "platform/linux/pal_wifi.cc",
1038        "platform/linux/platform_debug_dump_manager.cc",
1039        "platform/linux/platform_log.cc",
1040        "platform/linux/platform_nanoapp.cc",
1041        "platform/linux/platform_pal.cc",
1042        "platform/linux/power_control_manager.cc",
1043        "platform/linux/system_time.cc",
1044        "platform/linux/system_timer.cc",
1045        "platform/linux/task_util/task.cc",
1046        "platform/linux/task_util/task_manager.cc",
1047        "platform/shared/audio_pal/platform_audio.cc",
1048        "platform/shared/chre_api_audio.cc",
1049        "platform/shared/chre_api_ble.cc",
1050        "platform/shared/chre_api_core.cc",
1051        "platform/shared/chre_api_gnss.cc",
1052        "platform/shared/chre_api_msg.cc",
1053        "platform/shared/chre_api_re.cc",
1054        "platform/shared/chre_api_sensor.cc",
1055        "platform/shared/chre_api_user_settings.cc",
1056        "platform/shared/chre_api_wifi.cc",
1057        "platform/shared/log_buffer.cc",
1058        "platform/shared/memory_manager.cc",
1059        "platform/shared/nanoapp_abort.cc",
1060        "platform/shared/pal_system_api.cc",
1061        "platform/shared/platform_ble.cc",
1062        "platform/shared/platform_gnss.cc",
1063        "platform/shared/platform_wifi.cc",
1064        "platform/shared/sensor_pal/platform_sensor.cc",
1065        "platform/shared/sensor_pal/platform_sensor_manager.cc",
1066        "platform/shared/sensor_pal/platform_sensor_type_helpers.cc",
1067        "platform/shared/system_time.cc",
1068        "platform/shared/version.cc",
1069        "util/**/*.cc",
1070    ],
1071    exclude_srcs: [
1072        "util/tests/**/*",
1073    ],
1074    export_include_dirs: [
1075        "chre_api/include",
1076        "chre_api/include/chre_api",
1077        "core/include",
1078        "pal/include",
1079        "pal/util/include",
1080        "platform/include",
1081        "platform/linux/include",
1082        "platform/shared/audio_pal/include",
1083        "platform/shared/include",
1084        "platform/shared/fbs/include",
1085        "platform/shared/public_platform_ble_pal",
1086        "platform/shared/public_platform_debug_dump_manager",
1087        "platform/shared/public_platform_gnss_pal",
1088        "platform/shared/public_platform_wifi_pal",
1089        "platform/shared/public_platform_wwan_pal",
1090        "platform/shared/sensor_pal/include",
1091        "util/include",
1092    ],
1093    header_libs: [
1094        "chre_api",
1095        "chre_flatbuffers",
1096    ],
1097    defaults: [
1098        "chre_linux_cflags",
1099        "pw_rpc_cflags_chre",
1100    ],
1101    static_libs: [
1102        "libgmock",
1103        "libgtest",
1104        "pw_allocator",
1105        "pw_intrusive_ptr",
1106        "pw_rpc_chre",
1107    ],
1108    shared_libs: [
1109        "libbase",
1110    ],
1111    host_supported: true,
1112}
1113
1114cc_defaults {
1115    name: "chre_linux_cflags",
1116    cflags: [
1117        "-DCHRE_ASSERTIONS_ENABLED=true",
1118        "-DCHRE_AUDIO_SUPPORT_ENABLED",
1119        "-DCHRE_BLE_SOCKET_SUPPORT_ENABLED",
1120        "-DCHRE_BLE_SUPPORT_ENABLED",
1121        "-DCHRE_FILENAME=__FILE__",
1122        "-DCHRE_FIRST_SUPPORTED_API_VERSION=CHRE_API_VERSION_1_1",
1123        "-DCHRE_GNSS_SUPPORT_ENABLED",
1124        "-DCHRE_LARGE_PAYLOAD_MAX_SIZE=32000",
1125        "-DCHRE_MESSAGE_ROUTER_MAX_HOST_ENDPOINTS=8",
1126        "-DCHRE_MESSAGE_ROUTER_MAX_HOST_HUBS=2",
1127        "-DCHRE_MESSAGE_ROUTER_SUPPORT_ENABLED",
1128        "-DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4096",
1129        "-DCHRE_MINIMUM_LOG_LEVEL=CHRE_LOG_LEVEL_DEBUG",
1130        "-DCHRE_PLATFORM_ID=1",
1131        "-DCHRE_RELIABLE_MESSAGE_SUPPORT_ENABLED",
1132        "-DCHRE_SENSORS_SUPPORT_ENABLED",
1133        "-DCHRE_TEST_ASYNC_RESULT_TIMEOUT_NS=300000000",
1134        "-DCHRE_TEST_WIFI_RANGING_RESULT_TIMEOUT_NS=300000000",
1135        "-DCHRE_TEST_WIFI_SCAN_RESULT_TIMEOUT_NS=300000000",
1136        "-DCHRE_WIFI_NAN_SUPPORT_ENABLED",
1137        "-DCHRE_WIFI_SUPPORT_ENABLED",
1138        "-DGTEST",
1139        "-Wextra-semi",
1140        "-Wvla-extension",
1141    ],
1142}
1143
1144subdirs = [
1145    "apps/wifi_offload",
1146]
1147
1148cc_defaults {
1149    name: "chre_daemon_common",
1150    local_include_dirs: [
1151        "external/flatbuffers/include",
1152        "host/common/include",
1153        "platform/shared/include",
1154        "platform/shared/fbs/include",
1155        "util/include",
1156    ],
1157    srcs: [
1158        "host/common/bt_snoop_log_parser.cc",
1159        "host/common/daemon_base.cc",
1160        "host/common/fbs_daemon_base.cc",
1161        "host/common/file_stream.cc",
1162        "host/common/fragmented_load_transaction.cc",
1163        "host/common/host_protocol_host.cc",
1164        "host/common/log_message_parser.cc",
1165        "host/common/socket_server.cc",
1166        "host/common/st_hal_lpma_handler.cc",
1167        "platform/shared/host_protocol_common.cc",
1168    ],
1169    shared_libs: [
1170        "libaconfig_storage_read_api_cc",
1171        "libbase",
1172        "libbinder_ndk",
1173        "libcutils",
1174        "libjsoncpp",
1175        "liblog",
1176        "libutils",
1177        "server_configurable_flags",
1178    ],
1179    static_libs: [
1180        "chre_config_util",
1181        "chre_flags_c_lib",
1182        "chre_metrics_reporter",
1183    ],
1184}
1185
1186cc_library_static {
1187    name: "chre_config_util",
1188    vendor: true,
1189    host_supported: true,
1190    export_include_dirs: [
1191        "host/common/include",
1192    ],
1193    srcs: [
1194        "host/common/config_util.cc",
1195    ],
1196    shared_libs: [
1197        "libjsoncpp",
1198        "liblog",
1199    ],
1200}
1201
1202cc_binary {
1203    name: "chre_daemon_exynos",
1204    cpp_std: "c++20",
1205    defaults: ["chre_daemon_common"],
1206    soc_specific: true,
1207    local_include_dirs: [
1208        "host/exynos",
1209    ],
1210    cflags: ["-DCHRE_LPMA_REQUEST_START_RECOGNITION"],
1211    srcs: [
1212        "host/exynos/exynos_daemon.cc",
1213        "host/exynos/main.cc",
1214    ],
1215    static_libs: [
1216        "pw_detokenizer",
1217        "pw_polyfill",
1218        "pw_span",
1219        "pw_varint",
1220    ],
1221    shared_libs: [
1222        "android.hardware.soundtrigger@2.0",
1223        "libhidlbase",
1224        "libpower",
1225    ],
1226    init_rc: ["host/exynos/chre_daemon_exynos.rc"],
1227}
1228
1229java_library_static {
1230    name: "chre_api_test_proto_java_lite",
1231    host_supported: true,
1232    proto: {
1233        type: "lite",
1234        include_dirs: ["external/protobuf/src"],
1235    },
1236    srcs: [
1237        ":libprotobuf-internal-protos",
1238        "apps/test/common/chre_api_test/rpc/chre_api_test.proto",
1239    ],
1240    sdk_version: "current",
1241}
1242
1243cc_library_static {
1244    name: "chre_host_util",
1245    vendor_available: true,
1246    host_supported: true,
1247    export_include_dirs: [
1248        "host/common/include",
1249    ],
1250    srcs: [
1251        "host/common/file_stream.cc",
1252    ],
1253    shared_libs: [
1254        "liblog",
1255    ],
1256    cflags: [
1257        "-Wall",
1258        "-Werror",
1259    ],
1260}
1261
1262aconfig_declarations {
1263    name: "chre_flags",
1264    package: "android.chre.flags",
1265    container: "system",
1266    srcs: ["chre_flags.aconfig"],
1267}
1268
1269cc_aconfig_library {
1270    name: "chre_flags_c_lib",
1271    aconfig_declarations: "chre_flags",
1272    host_supported: true,
1273    vendor_available: true,
1274}
1275
1276filegroup {
1277    name: "chre_daemon_srcs",
1278    srcs: [
1279        "host/common/bt_snoop_log_parser.cc",
1280        "host/common/config_util.cc",
1281        "host/common/daemon_base.cc",
1282        "host/common/fbs_daemon_base.cc",
1283        "host/common/file_stream.cc",
1284        "host/common/fragmented_load_transaction.cc",
1285        "host/common/host_protocol_host.cc",
1286        "host/common/log_message_parser.cc",
1287        "host/common/socket_server.cc",
1288        "host/common/st_hal_lpma_handler.cc",
1289        "host/common/wifi_ext_hal_handler.cc",
1290        "platform/shared/host_protocol_common.cc",
1291    ],
1292}
1293