1// Copyright (C) 2022 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15//
16
17package {
18    default_team: "trendy_team_automotive",
19    default_applicable_licenses: ["Android-Apache-2.0"],
20}
21
22cc_defaults {
23    name: "evsmanagerd_defaults",
24    defaults: ["android.hardware.graphics.common-ndk_static"],
25    shared_libs: [
26        "android.hardware.automotive.evs@1.0",
27        "android.hardware.automotive.evs@1.1",
28        "libbase",
29        "libbinder_ndk",
30        "libcamera_metadata",
31        "libhardware",
32        "libhidlbase",
33        "liblog",
34        "libprocessgroup",
35        "libstatslog_evsmanagerd",
36        "libutils",
37    ],
38    static_libs: [
39        "android.hardware.automotive.evs-V2-ndk",
40        "android.hardware.common-V2-ndk",
41        "libaidlcommonsupport",
42        "libc++fs",
43        "libcutils",
44    ],
45    header_libs: [
46        "libarect_headers",
47        "libui_headers",
48    ],
49    cflags: [
50        "-DGL_GLEXT_PROTOTYPES",
51        "-DEGL_EGLEXT_PROTOTYPES",
52        "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
53        "-Wall",
54        "-Werror",
55        "-Wunused",
56        "-Wunreachable-code",
57        "-Wthread-safety",
58    ],
59    export_include_dirs: [
60        ".",
61        "./include",
62        "./stats/include",
63        "./wrappers/include",
64    ],
65    product_variables: {
66        debuggable: {
67            cflags: [
68                "-DEVS_DEBUG",
69            ],
70        },
71    },
72}
73
74filegroup {
75    name: "evsmanagerd_sources",
76    srcs: [
77        "wrappers/src/HidlCameraStream.cpp",
78        "wrappers/src/AidlDisplay.cpp",
79        "wrappers/src/AidlCamera.cpp",
80        "wrappers/src/HidlEnumerator.cpp",
81        "wrappers/src/AidlCameraStream.cpp",
82        "wrappers/src/AidlEnumerator.cpp",
83        "wrappers/src/HidlDisplay.cpp",
84        "wrappers/src/HidlCamera.cpp",
85        "stats/src/CameraUsageStats.cpp",
86        "stats/src/StatsCollector.cpp",
87        "stats/src/LooperWrapper.cpp",
88        "utils/src/Utils.cpp",
89        "src/HalDisplay.cpp",
90        "src/VirtualCamera.cpp",
91        "src/Enumerator.cpp",
92        "src/HalCamera.cpp",
93    ],
94}
95
96cc_library_static {
97    name: "libevsmanagerd_static",
98    defaults: ["evsmanagerd_defaults"],
99    srcs: [":evsmanagerd_sources"],
100    export_include_dirs: [
101        "./include",
102        "./stats/include",
103        "./wrappers/include",
104    ],
105}
106
107cc_binary {
108    name: "evsmanagerd",
109    defaults: ["evsmanagerd_defaults"],
110    static_libs: ["libevsmanagerd_static"],
111    srcs: ["src/service.cpp"],
112    init_rc: ["evsmanagerd.rc"],
113    vintf_fragments: ["manifest_evsmanagerd.xml"],
114}
115
116cc_test {
117    name: "evsmanagerd_test",
118    defaults: ["evsmanagerd_defaults"],
119    test_suites: [
120        "general-tests",
121        "automotive-tests",
122    ],
123    srcs: [
124        ":evsmanagerd_sources",
125        "tests/unit/**/*.cpp",
126    ],
127    local_include_dirs: ["tests/unit/include"],
128    shared_libs: [
129        "libcamera_client",
130        "libnativewindow",
131        "libui",
132    ],
133    static_libs: [
134        "libgmock",
135        "libgtest",
136        "libevsmanagerd_static",
137    ],
138}
139
140cc_test_library {
141    name: "libmockevshal",
142    defaults: ["android.hardware.graphics.common-ndk_static"],
143    local_include_dirs: [
144        "include",
145        "tests/unit/include",
146    ],
147    export_include_dirs: ["tests/unit/include"],
148    srcs: [
149        "tests/unit/src/MockEvsHal.cpp",
150        "tests/unit/src/MockHidlEvsHal.cpp",
151        "tests/unit/src/MockHidlEvsHal_1_0.cpp",
152    ],
153    shared_libs: [
154        "android.hardware.automotive.evs@1.0",
155        "android.hardware.automotive.evs@1.1",
156        "libbase",
157        "libbinder_ndk",
158        "libcamera_client",
159        "libcamera_metadata",
160        "libcutils",
161        "libhidlbase",
162        "libnativewindow",
163        "libui",
164        "libutils",
165    ],
166    static_libs: [
167        "android.hardware.automotive.evs-V2-ndk",
168        "android.hardware.common-V2-ndk",
169        "libaidlcommonsupport",
170        "libgmock",
171        "libgtest",
172    ],
173    cflags: ["-DLOG_TAG=\"MockEVS\""],
174}
175
176cc_library_headers {
177    name: "libmockevshal_headers",
178    export_include_dirs: ["tests/unit/include"],
179}
180
181cc_library {
182    name: "libstatslog_evsmanagerd",
183    generated_sources: ["statslog_evsmanagerd.cpp"],
184    generated_headers: ["statslog_evsmanagerd.h"],
185    export_generated_headers: ["statslog_evsmanagerd.h"],
186    min_sdk_version: "30",
187    shared_libs: [
188        "libbinder",
189        "libstatsbootstrap",
190        "libutils",
191        "android.os.statsbootstrap_aidl-cpp",
192    ],
193}
194
195genrule {
196    name: "statslog_evsmanagerd.h",
197    tools: ["stats-log-api-gen"],
198    cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_evsmanagerd.h --module evs" +
199        " --namespace aidl,android,automotive,evs,stats --bootstrap",
200    out: [
201        "statslog_evsmanagerd.h",
202    ],
203}
204
205genrule {
206    name: "statslog_evsmanagerd.cpp",
207    tools: ["stats-log-api-gen"],
208    cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_evsmanagerd.cpp --module evs" +
209        " --namespace aidl,android,automotive,evs,stats --importHeader statslog_evsmanagerd.h" +
210        " --bootstrap",
211    out: [
212        "statslog_evsmanagerd.cpp",
213    ],
214}
215