1// Copyright (C) 2018 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_team: "trendy_team_android_kernel",
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20cc_defaults {
21    name: "system_suspend_defaults",
22    defaults: [
23        "aconfig_lib_cc_static_link.defaults",
24    ],
25    shared_libs: [
26        "libbase",
27        "libbinder",
28        "libbinder_ndk",
29        "libcutils",
30        "libhidlbase",
31        "liblog",
32        "libutils",
33        "server_configurable_flags",
34    ],
35    static_libs: [
36        "suspend_service_flags_c_lib",
37    ],
38    cflags: [
39        "-Wall",
40        "-Werror",
41        "-Wthread-safety",
42    ],
43}
44
45cc_defaults {
46    name: "system_suspend_stats_defaults",
47    cflags: [
48        "-Wall",
49        "-Werror",
50    ],
51}
52
53cc_defaults {
54    name: "android.system.suspend-service_defaults",
55    defaults: [
56        "system_suspend_defaults",
57        "system_suspend_stats_defaults",
58    ],
59    shared_libs: [
60        "android.system.suspend-V1-ndk",
61    ],
62    static_libs: [
63        "android.system.suspend.control-V1-cpp",
64        "android.system.suspend.control.internal-cpp",
65        "[email protected]",
66        "libSuspendProperties",
67    ],
68    srcs: [
69        "SuspendControlService.cpp",
70        "SystemSuspend.cpp",
71        "SystemSuspendHidl.cpp",
72        "SystemSuspendAidl.cpp",
73        "WakeLockEntryList.cpp",
74        "WakeupList.cpp",
75    ],
76}
77
78vintf_fragment {
79    name: "android.system.suspend-service.xml",
80    src: "android.system.suspend-service.xml",
81}
82
83cc_binary {
84    name: "android.system.suspend-service",
85    relative_install_path: "hw",
86    defaults: [
87        "android.system.suspend-service_defaults",
88    ],
89    init_rc: ["android.system.suspend-service.rc"],
90    vintf_fragment_modules: ["android.system.suspend-service.xml"],
91    srcs: [
92        "main.cpp",
93    ],
94}
95
96// Unit tests for ISystemSuspend implementation.
97// Do *NOT* use for compliance with *TS.
98cc_test {
99    name: "SystemSuspendV1_0UnitTest",
100    defaults: [
101        "system_suspend_defaults",
102        "system_suspend_stats_defaults",
103    ],
104    static_libs: [
105        "android.system.suspend-V1-ndk",
106        "android.system.suspend.control-V1-cpp",
107        "android.system.suspend.control.internal-cpp",
108        "libgmock",
109    ],
110    tidy_timeout_srcs: [
111        "SystemSuspendUnitTest.cpp",
112    ],
113    srcs: [
114        "SuspendControlService.cpp",
115        "SystemSuspend.cpp",
116        "SystemSuspendAidl.cpp",
117        "SystemSuspendUnitTest.cpp",
118        "WakeLockEntryList.cpp",
119        "WakeupList.cpp",
120    ],
121    test_suites: ["device-tests"],
122    require_root: true,
123}
124
125cc_test {
126    name: "SystemSuspendV1_0AidlTest",
127    srcs: [
128        "SystemSuspendAidlTest.cpp",
129    ],
130    shared_libs: [
131        "libbinder",
132        "libutils",
133    ],
134    static_libs: [
135        "android.system.suspend.control-V1-cpp",
136    ],
137    test_suites: [
138        "device-tests",
139        "vts",
140    ],
141    require_root: true,
142}
143
144sh_test {
145    name: "SuspendSepolicyTests",
146    src: "SuspendSepolicyTests.sh",
147    test_suites: [
148        "device-tests",
149        "vts",
150    ],
151    test_config: "suspend-sepolicy-tests.xml",
152}
153
154cc_benchmark {
155    name: "SystemSuspendBenchmark",
156    defaults: [
157        "system_suspend_defaults",
158    ],
159    shared_libs: [
160        "android.system.suspend.control-V1-cpp",
161        "android.system.suspend.control.internal-cpp",
162        "android.system.suspend-V1-ndk",
163    ],
164    srcs: [
165        "SystemSuspendBenchmark.cpp",
166    ],
167}
168
169sysprop_library {
170    name: "SuspendProperties",
171    srcs: ["SuspendProperties.sysprop"],
172    property_owner: "Platform",
173}
174
175cc_defaults {
176    name: "suspend_fuzzer_defaults",
177    defaults: [
178        "service_fuzzer_defaults",
179        "fuzzer_disable_leaks",
180        "android.system.suspend-service_defaults",
181    ],
182    static_libs: [
183        "liblog",
184    ],
185    fuzz_config: {
186        cc: [
187            "[email protected]",
188        ],
189        triage_assignee: "[email protected]",
190    },
191    include_dirs: ["system/hardware/interfaces/suspend/1.0/default/"],
192    cflags: [
193        "-DFUZZ_MODE_SUSPEND_SERVICE=1",
194    ],
195}
196
197cc_fuzz {
198    name: "suspend_service_fuzzer",
199    defaults: [
200        "suspend_fuzzer_defaults",
201    ],
202    srcs: [
203        "fuzzers/SuspendServiceFuzzer.cpp",
204    ],
205}
206
207cc_fuzz {
208    name: "suspend_service_internal_fuzzer",
209    defaults: [
210        "suspend_fuzzer_defaults",
211    ],
212    srcs: [
213        "fuzzers/SuspendServiceInternalFuzzer.cpp",
214    ],
215}
216
217aconfig_declarations {
218    name: "suspend_service_flags",
219    package: "suspend_service.flags",
220    container: "system",
221    srcs: ["flags.aconfig"],
222}
223
224cc_aconfig_library {
225    name: "suspend_service_flags_c_lib",
226    aconfig_declarations: "suspend_service_flags",
227}
228