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