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