1// Copyright (C) 2019 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_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21cc_defaults {
22    name: "android.automotive.evs.manager_defaults",
23
24    shared_libs: [
25        "[email protected]",
26        "[email protected]",
27        "libbase",
28        "libcamera_metadata",
29        "libcutils",
30        "libhardware",
31        "libhidlbase",
32        "libpng",
33        "libprocessgroup",
34        "libstatslog_evs",
35        "libui",
36        "libutils",
37    ],
38
39    cflags: [
40        "-DLOG_TAG=\"EvsManagerV1_1\"",
41        "-DGL_GLEXT_PROTOTYPES",
42        "-DEGL_EGLEXT_PROTOTYPES",
43        "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
44        "-Wall",
45        "-Werror",
46        "-Wunused",
47        "-Wunreachable-code",
48        "-Wthread-safety",
49    ],
50
51    export_include_dirs: [
52        "./",
53        "stats/",
54    ],
55
56    product_variables: {
57        debuggable: {
58            cflags: [
59                "-DEVS_DEBUG",
60            ],
61        },
62    },
63}
64
65filegroup {
66    name: "android.automotive.evs.manager_sources",
67
68    srcs: [
69        "Enumerator.cpp",
70        "EnumeratorProxy.cpp",
71        "HalCamera.cpp",
72        "HalDisplay.cpp",
73        "VirtualCamera.cpp",
74        "emul/EvsEmulatedCamera.cpp",
75        "emul/VideoCapture.cpp",
76        "stats/CameraUsageStats.cpp",
77        "stats/LooperWrapper.cpp",
78        "stats/StatsCollector.cpp",
79    ],
80}
81
82cc_library_static {
83    name: "libevsmanager_static",
84    defaults: ["android.automotive.evs.manager_defaults"],
85    srcs: [":android.automotive.evs.manager_sources"],
86    export_include_dirs: ["."],
87}
88
89vintf_fragment {
90    name: "[email protected]",
91    src: "[email protected]",
92}
93
94cc_binary {
95    name: "[email protected]",
96    defaults: ["android.automotive.evs.manager_defaults"],
97    srcs: [
98        ":android.automotive.evs.manager_sources",
99        "service.cpp",
100    ],
101    init_rc: ["[email protected]"],
102    vintf_fragment_modules: ["[email protected]"],
103}
104
105cc_library {
106    name: "libstatslog_evs",
107    generated_sources: ["statslog_evs.cpp"],
108    generated_headers: ["statslog_evs.h"],
109    export_generated_headers: ["statslog_evs.h"],
110    min_sdk_version: "30",
111    shared_libs: [
112        "libbinder",
113        "libstatsbootstrap",
114        "libutils",
115        "android.os.statsbootstrap_aidl-cpp",
116    ],
117}
118
119genrule {
120    name: "statslog_evs.h",
121    tools: ["stats-log-api-gen"],
122    cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_evs.h --module evs" +
123        " --namespace android,automotive,evs,stats --bootstrap",
124    out: [
125        "statslog_evs.h",
126    ],
127}
128
129genrule {
130    name: "statslog_evs.cpp",
131    tools: ["stats-log-api-gen"],
132    cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_evs.cpp --module evs" +
133        " --namespace android,automotive,evs,stats --importHeader statslog_evs.h" +
134        " --bootstrap",
135    out: [
136        "statslog_evs.cpp",
137    ],
138}
139
140////////////////////////////////////////////////////////////////////////////////
141// Tests
142// TODO(b/206829268):  This target should allow for host supported testing, but
143// currently has platform specific dependencies.
144////////////////////////////////////////////////////////////////////////////////
145cc_test {
146    name: "EvsEnumeratorTest",
147    srcs: ["test/unit/EvsEnumeratorTest.cpp"],
148    static_libs: [
149        "libevsmanager_static",
150        "libgmock",
151    ],
152    defaults: ["android.automotive.evs.manager_defaults"],
153
154    // TODO(b/206829268):  See above.
155    // host_supported: true,
156}
157
158cc_test {
159    name: "EnumeratorProxyTest",
160    srcs: ["test/unit/EnumeratorProxyTest.cpp"],
161    static_libs: [
162        "libevsmanager_static",
163        "libgmock",
164    ],
165    defaults: ["android.automotive.evs.manager_defaults"],
166}
167
168cc_test {
169    name: "StatsCollectorTest",
170    srcs: ["test/unit/StatsCollectorTest.cpp"],
171    static_libs: [
172        "libevsmanager_static",
173        "libgmock",
174    ],
175    defaults: ["android.automotive.evs.manager_defaults"],
176
177    // TODO(b/206829268):  See above.
178    // host_supported: true,
179}
180