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