• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2020 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
15package {
16    default_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19cc_defaults {
20    name: "carwatchdogd_defaults",
21    cflags: [
22        "-Wall",
23        "-Wno-missing-field-initializers",
24        "-Werror",
25        "-Wno-unused-variable",
26        "-Wunused-parameter",
27        "-Wno-error=deprecated",
28        "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
29    ],
30    include_dirs: [
31        "system/libbase/include",
32    ],
33    shared_libs: [
34        "libbase",
35        "libbinder",
36        "libbinder_ndk",
37        "liblog",
38        "libutils",
39        "packagemanager_aidl-cpp",
40    ],
41    static_libs: [
42        "android.automotive.watchdog.internal-V3-ndk",
43        "android.automotive.watchdog-V3-ndk",
44        "libvhalclient",
45    ],
46    whole_static_libs: [
47        "libwatchdog_properties",
48    ],
49    header_libs: [
50        "libgtest_prod_headers",
51    ],
52    defaults: [
53        "vhalclient_defaults",
54    ],
55}
56
57cc_library {
58  name: "libwatchdog_package_info_resolver",
59  srcs: [
60      "src/PackageInfoResolver.cpp",
61  ],
62  defaults: [
63      "carwatchdogd_defaults",
64  ],
65  shared_libs: [
66      "libcutils",
67  ],
68  export_include_dirs: [
69       "src",
70  ],
71}
72
73cc_defaults {
74    name: "libwatchdog_perf_service_defaults",
75    shared_libs: [
76        "libcutils",
77        "libprocessgroup",
78        "libtinyxml2",
79    ],
80}
81
82cc_library {
83    name: "libwatchdog_binder_utils",
84    srcs: [
85        "src/AIBinderDeathRegistrationWrapper.cpp",
86    ],
87    defaults: [
88        "carwatchdogd_defaults",
89    ],
90}
91
92cc_library {
93    name: "libwatchdog_perf_service",
94    defaults: [
95        "carwatchdogd_defaults",
96        "libwatchdog_perf_service_defaults",
97    ],
98    srcs: [
99        "src/WatchdogPerfService.cpp",
100        "src/IoOveruseConfigs.cpp",
101        "src/IoOveruseMonitor.cpp",
102        "src/PerformanceProfiler.cpp",
103        "src/LooperWrapper.cpp",
104        "src/OveruseConfigurationXmlHelper.cpp",
105        "src/ProcDiskStatsCollector.cpp",
106        "src/ProcStatCollector.cpp",
107        "src/UidCpuStatsCollector.cpp",
108        "src/UidIoStatsCollector.cpp",
109        "src/UidProcStatsCollector.cpp",
110        "src/UidStatsCollector.cpp",
111    ],
112    static_libs: [
113        "libwatchdog_binder_utils",
114        "libwatchdog_package_info_resolver",
115    ],
116    export_include_dirs: [
117        "src",
118    ],
119}
120
121filegroup {
122    name: "watchdog_test_xml_files",
123    srcs: [
124        "tests/data/*.xml",
125    ],
126}
127
128cc_test {
129    name: "libwatchdog_test",
130    defaults: [
131        "carwatchdogd_defaults",
132        "libwatchdog_perf_service_defaults",
133        "libwatchdog_process_service_defaults",
134        "libwatchdog_service_manager_defaults",
135    ],
136    test_suites: [
137        "general-tests",
138        "automotive-tests",
139    ],
140    tidy_disabled_srcs: [
141        // b/207508335
142        "tests/PackageInfoResolverTest.cpp",
143    ],
144    tidy_timeout_srcs: [
145        "tests/IoOveruseMonitorTest.cpp",
146        "tests/WatchdogServiceHelperTest.cpp",
147    ],
148    srcs: [
149        "tests/IoOveruseConfigsTest.cpp",
150        "tests/IoOveruseMonitorTest.cpp",
151        "tests/PerformanceProfilerTest.cpp",
152        "tests/LooperStub.cpp",
153        "tests/OveruseConfigurationTestUtils.cpp",
154        "tests/OveruseConfigurationXmlHelperTest.cpp",
155        "tests/PackageInfoResolverTest.cpp",
156        "tests/PackageInfoTestUtils.cpp",
157        "tests/ProcDiskStatsCollectorTest.cpp",
158        "tests/ProcPidDir.cpp",
159        "tests/ProcStatCollectorTest.cpp",
160        "tests/ThreadPriorityControllerTest.cpp",
161        "tests/UidIoStatsCollectorTest.cpp",
162        "tests/UidProcStatsCollectorTest.cpp",
163        "tests/UidCpuStatsCollectorTest.cpp",
164        "tests/UidStatsCollectorTest.cpp",
165        "tests/WatchdogBinderMediatorTest.cpp",
166        "tests/WatchdogInternalHandlerTest.cpp",
167        "tests/WatchdogPerfServiceTest.cpp",
168        "tests/WatchdogProcessServiceTest.cpp",
169        "tests/WatchdogServiceHelperTest.cpp",
170
171    ],
172    static_libs: [
173        "android.hardware.automotive.vehicle@2.0",
174        "libgmock",
175        "libgtest",
176        "libwatchdog_binder_mediator",
177        "libwatchdog_perf_service",
178        "libwatchdog_process_service",
179        "libwatchdog_service_manager",
180    ],
181    data: [":watchdog_test_xml_files"],
182}
183
184cc_defaults {
185    name: "libwatchdog_process_service_defaults",
186    shared_libs: [
187        "libhidlbase",
188    ],
189}
190
191cc_library_static {
192    name: "libwatchdog_process_service",
193    srcs: [
194        "src/WatchdogProcessService.cpp",
195    ],
196    static_libs: [
197        "libwatchdog_binder_utils",
198    ],
199    defaults: [
200        "carwatchdogd_defaults",
201        "libwatchdog_process_service_defaults",
202    ],
203    shared_libs: [
204        "android.hardware.automotive.vehicle@2.0",
205    ],
206}
207
208cc_library {
209    name: "libwatchdog_binder_mediator",
210    defaults: [
211        "carwatchdogd_defaults",
212        "libwatchdog_perf_service_defaults",
213        "libwatchdog_process_service_defaults",
214    ],
215    srcs: [
216        "src/ThreadPriorityController.cpp",
217        "src/WatchdogBinderMediator.cpp",
218        "src/WatchdogInternalHandler.cpp",
219        "src/WatchdogServiceHelper.cpp",
220    ],
221    shared_libs: [
222        "android.hardware.automotive.vehicle@2.0",
223    ],
224    static_libs: [
225        "libwatchdog_binder_utils",
226        "libwatchdog_perf_service",
227        "libwatchdog_process_service",
228    ],
229    export_include_dirs: [
230        "src",
231    ],
232}
233
234cc_defaults {
235    name: "libwatchdog_service_manager_defaults",
236    defaults: [
237        "libwatchdog_perf_service_defaults",
238        "libwatchdog_process_service_defaults",
239    ],
240    static_libs: [
241        "libwatchdog_binder_mediator",
242        "libwatchdog_binder_utils",
243        "libwatchdog_package_info_resolver",
244        "libwatchdog_perf_service",
245        "libwatchdog_process_service",
246    ],
247}
248
249cc_library {
250    name: "libwatchdog_service_manager",
251    defaults: [
252        "carwatchdogd_defaults",
253        "libwatchdog_service_manager_defaults",
254    ],
255    srcs: [
256        "src/ServiceManager.cpp",
257    ],
258}
259
260cc_binary {
261    name: "carwatchdogd",
262    defaults: [
263        "carwatchdogd_defaults",
264        "libwatchdog_service_manager_defaults",
265    ],
266    srcs: [
267        "src/main.cpp",
268    ],
269    init_rc: ["carwatchdogd.rc"],
270    shared_libs: [
271        "android.hardware.automotive.vehicle@2.0",
272    ],
273    static_libs: [
274        "libwatchdog_binder_utils",
275        "libwatchdog_service_manager",
276    ],
277    vintf_fragments: ["carwatchdogd.xml"],
278    required: [
279        "system_resource_overuse_configuration.xml",
280        "third_party_resource_overuse_configuration.xml",
281    ],
282}
283
284prebuilt_etc {
285    name: "system_resource_overuse_configuration.xml",
286    src: "data/system_resource_overuse_configuration.xml",
287    sub_dir: "automotive/watchdog/",
288}
289
290prebuilt_etc {
291    name: "third_party_resource_overuse_configuration.xml",
292    src: "data/third_party_resource_overuse_configuration.xml",
293    sub_dir: "automotive/watchdog/",
294}
295