blob: a090b7419363704ac14b6fa12b6d8f47d5fa7f22 [file] [log] [blame]
Bob Badourd69ad692021-02-16 19:02:14 -08001package {
2 default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
Steven Moreland1b13eea2017-07-10 16:05:51 -07005cc_library_headers {
6 name: "libhealthd_headers",
7 vendor_available: true,
Yifan Hong90fdc722018-07-10 13:02:18 -07008 recovery_available: true,
Steven Moreland1b13eea2017-07-10 16:05:51 -07009 export_include_dirs: ["include"],
10 header_libs: ["libbatteryservice_headers"],
11 export_header_lib_headers: ["libbatteryservice_headers"],
12}
Yifan Hongffff9aa2017-06-01 14:34:29 -070013
14cc_library_static {
15 name: "libbatterymonitor",
16 srcs: ["BatteryMonitor.cpp"],
Chih-Hung Hsieh96352662017-11-29 14:24:50 -080017 cflags: ["-Wall", "-Werror"],
Yifan Hongffff9aa2017-06-01 14:34:29 -070018 vendor_available: true,
Yifan Hong90fdc722018-07-10 13:02:18 -070019 recovery_available: true,
Yifan Hongffff9aa2017-06-01 14:34:29 -070020 export_include_dirs: ["include"],
21 shared_libs: [
22 "libutils",
23 "libbase",
Yifan Hong1d4368b2019-10-07 11:18:04 -070024
Yifan Hongb99d15c2022-03-01 12:12:34 -080025 // Need HealthInfo definition from headers of these shared
26 // libraries. Clients don't need to link to these.
Yifan Hong1d4368b2019-10-07 11:18:04 -070027 "android.hardware.health@2.1",
Yifan Hongb99d15c2022-03-01 12:12:34 -080028 "android.hardware.health-V1-ndk",
29 ],
30 whole_static_libs: [
31 // Need to translate HIDL to AIDL to support legacy APIs in
32 // BatteryMonitor.
33 "android.hardware.health-translate-ndk",
Yifan Hongffff9aa2017-06-01 14:34:29 -070034 ],
35 header_libs: ["libhealthd_headers"],
36 export_header_lib_headers: ["libhealthd_headers"],
37}
Yifan Hong2763df82017-09-19 17:57:50 -070038
Yifan Hong1cf853f2018-04-04 14:08:57 -070039cc_defaults {
40 name: "android.hardware.health@2.0-service_defaults",
Yifan Hong2763df82017-09-19 17:57:50 -070041
Chih-Hung Hsieh96352662017-11-29 14:24:50 -080042 cflags: [
Chih-Hung Hsieh96352662017-11-29 14:24:50 -080043 "-Wall",
44 "-Werror",
45 ],
Yifan Hong2763df82017-09-19 17:57:50 -070046
47 static_libs: [
48 "android.hardware.health@2.0-impl",
49 "android.hardware.health@1.0-convert",
Yifan Hongaffa24f2018-01-19 15:53:25 -080050 "libhealthservice",
Hridya Valsaraju89178e72018-01-10 16:14:28 -080051 "libhealthstoragedefault",
Yifan Hong2763df82017-09-19 17:57:50 -070052 "libbatterymonitor",
53 ],
54
55 shared_libs: [
56 "libbase",
57 "libcutils",
58 "libhidlbase",
Yifan Hong2763df82017-09-19 17:57:50 -070059 "liblog",
60 "libutils",
61 "android.hardware.health@2.0",
62 ],
63}
Yifan Hong12df1b92017-09-25 17:25:00 -070064
65cc_binary {
Yifan Hong1cf853f2018-04-04 14:08:57 -070066 name: "android.hardware.health@2.0-service",
67 defaults: ["android.hardware.health@2.0-service_defaults"],
Yifan Hong31150c12018-05-01 14:59:43 -070068
Yifan Hongef26fe42018-07-10 13:07:08 -070069 vendor: true,
70 relative_install_path: "hw",
71 init_rc: ["android.hardware.health@2.0-service.rc"],
72 srcs: [
73 "HealthServiceDefault.cpp",
74 ],
Yifan Hong12df1b92017-09-25 17:25:00 -070075}
Tao Bao5747e222018-09-11 10:46:35 -070076
77cc_library_static {
78 name: "libhealthd_charger_nops",
Yifan Hong7dcf7b02019-10-08 17:27:11 -070079 recovery_available: true,
Tao Bao5747e222018-09-11 10:46:35 -070080
81 srcs: [
82 "healthd_mode_charger_nops.cpp",
83 ],
84
85 cflags: [
86 "-Wall",
87 "-Werror",
88 ],
89
90 header_libs: [
91 "libhealthd_headers",
92 ],
93
94 static_libs: [
Yifan Hong7dcf7b02019-10-08 17:27:11 -070095 "libhealthloop",
96 "libhealth2impl",
Tao Bao5747e222018-09-11 10:46:35 -070097 ],
98
99 shared_libs: [
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700100 "android.hardware.health@2.1",
Tao Bao5747e222018-09-11 10:46:35 -0700101 "libutils",
102 ],
103}
Yifan Hong97eecdc2019-07-03 11:07:37 -0700104
105sysprop_library {
106 name: "charger_sysprop",
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700107 recovery_available: true,
Yifan Hong97eecdc2019-07-03 11:07:37 -0700108 srcs: ["charger.sysprop"],
109 property_owner: "Platform",
110 api_packages: ["android.sysprop"],
111}
Yifan Hongdbaa4772019-07-03 11:40:08 -0700112
113cc_library_static {
114 name: "libhealthd_draw",
Yifan Honge3ffd1b2021-10-20 22:18:16 -0700115 vendor_available: true,
Yifan Hongdbaa4772019-07-03 11:40:08 -0700116 export_include_dirs: ["."],
117 static_libs: [
118 "libcharger_sysprop",
119 "libminui",
120 ],
121 shared_libs: [
122 "libbase",
123 ],
124 header_libs: ["libbatteryservice_headers"],
125
126 srcs: ["healthd_draw.cpp"],
Yifan Honge3ffd1b2021-10-20 22:18:16 -0700127
128 target: {
129 vendor: {
130 exclude_static_libs: [
131 "libcharger_sysprop",
132 ],
133 },
134 },
Yifan Hongdbaa4772019-07-03 11:40:08 -0700135}
136
137cc_library_static {
Yifan Hongb5d70332021-10-20 17:15:32 -0700138 name: "libhealthd_charger_ui",
Yifan Honge3ffd1b2021-10-20 22:18:16 -0700139 vendor_available: true,
Yifan Hongb5d70332021-10-20 17:15:32 -0700140 export_include_dirs: [
141 "include",
142 "include_charger",
143 ],
Yifan Hongdbaa4772019-07-03 11:40:08 -0700144
145 static_libs: [
Yifan Hongb5d70332021-10-20 17:15:32 -0700146 "android.hardware.health-V1-ndk",
147 "android.hardware.health-translate-ndk",
Yifan Hongdbaa4772019-07-03 11:40:08 -0700148 "libcharger_sysprop",
Yifan Hongdbaa4772019-07-03 11:40:08 -0700149 "libhealthd_draw",
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700150 "libhealthloop",
Yifan Hongdbaa4772019-07-03 11:40:08 -0700151 "libminui",
152 ],
153
154 shared_libs: [
Yifan Hongdbaa4772019-07-03 11:40:08 -0700155 "libbase",
156 "libcutils",
157 "liblog",
158 "libpng",
159 "libsuspend",
160 "libutils",
161 ],
162
Yifan Hongb5d70332021-10-20 17:15:32 -0700163 header_libs: [
164 "libhealthd_headers",
165 ],
166
167 export_static_lib_headers: [
168 "android.hardware.health-V1-ndk",
169 ],
170
Yifan Hongdbaa4772019-07-03 11:40:08 -0700171 srcs: [
172 "healthd_mode_charger.cpp",
173 "AnimationParser.cpp",
174 ],
Yifan Honge3ffd1b2021-10-20 22:18:16 -0700175
176 target: {
177 vendor: {
178 exclude_static_libs: [
179 "libcharger_sysprop",
180 ],
181 },
182 },
Yifan Hongdbaa4772019-07-03 11:40:08 -0700183}
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700184
Yifan Hongb5d70332021-10-20 17:15:32 -0700185cc_library_static {
186 name: "libhealthd_charger",
187 export_include_dirs: [
188 "include",
189 "include_charger",
190 ],
191
192 static_libs: [
193 "android.hardware.health@1.0-convert",
Yifan Hong8e551342021-10-26 22:51:29 -0700194 "libcharger_sysprop",
Yifan Hongb5d70332021-10-20 17:15:32 -0700195 "libhealth2impl",
196 "libhealthd_charger_ui",
197 ],
198
199 shared_libs: [
200 "android.hardware.health@2.1",
201 "libbase",
202 "libcutils",
203 "liblog",
204 "libutils",
205 ],
206
207 srcs: [
208 "healthd_mode_charger_hidl.cpp",
209 ],
210}
211
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700212cc_defaults {
213 name: "charger_defaults",
Yifan Hongb5d70332021-10-20 17:15:32 -0700214 local_include_dirs: [
215 "include_charger",
216 ],
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700217
218 cflags: [
219 "-Wall",
220 "-Werror",
221 ],
222
223 shared_libs: [
224 // common
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700225 "libbase",
226 "libcutils",
227 "libhidlbase",
228 "liblog",
229 "libutils",
230
231 // system charger only
232 "libpng",
233 ],
234
235 static_libs: [
236 // common
237 "android.hardware.health@1.0-convert",
Yifan Hongb5d70332021-10-20 17:15:32 -0700238 "android.hardware.health-V1-ndk",
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700239 "libbatterymonitor",
240 "libcharger_sysprop",
241 "libhealthd_charger_nops",
242 "libhealthloop",
243 "libhealth2impl",
244
245 // system charger only
246 "libhealthd_draw",
247 "libhealthd_charger",
Yifan Hongb5d70332021-10-20 17:15:32 -0700248 "libhealthd_charger_ui",
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700249 "libminui",
250 "libsuspend",
251 ],
252}
253
254cc_binary {
255 name: "charger",
256 defaults: ["charger_defaults"],
257 recovery_available: true,
258 srcs: [
259 "charger.cpp",
260 "charger_utils.cpp",
261 ],
Yifan Hong57718582021-12-13 14:01:14 -0800262 shared_libs: [
263 "android.hardware.health@2.0",
264 "android.hardware.health@2.1",
265 ],
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700266
267 target: {
268 recovery: {
269 // No UI and libsuspend for recovery charger.
270 cflags: [
271 "-DCHARGER_FORCE_NO_UI=1",
272 ],
273 exclude_shared_libs: [
274 "libpng",
275 ],
276 exclude_static_libs: [
277 "libhealthd_draw",
278 "libhealthd_charger",
Yifan Hongb5d70332021-10-20 17:15:32 -0700279 "libhealthd_charger_ui",
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700280 "libminui",
281 "libsuspend",
282 ],
283 }
284 }
285}
286
287cc_test {
288 name: "charger_test",
289 defaults: ["charger_defaults"],
290 srcs: ["charger_test.cpp"],
Yifan Hong57718582021-12-13 14:01:14 -0800291 static_libs: [
292 "android.hardware.health@1.0",
293 "android.hardware.health@2.0",
294 "android.hardware.health@2.1",
295 ],
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700296}
Yifan Hong12d15752020-08-05 16:25:33 -0700297
298cc_test {
299 name: "libhealthd_charger_test",
Yifan Hongc2bed972020-08-07 16:27:49 -0700300 defaults: ["charger_defaults"],
301 srcs: [
302 "AnimationParser_test.cpp",
303 "healthd_mode_charger_test.cpp"
Yifan Hong12d15752020-08-05 16:25:33 -0700304 ],
305 static_libs: [
Yifan Hong57718582021-12-13 14:01:14 -0800306 "android.hardware.health@1.0",
307 "android.hardware.health@2.0",
308 "android.hardware.health@2.1",
Yifan Hongc2bed972020-08-07 16:27:49 -0700309 "libgmock",
Yifan Hong12d15752020-08-05 16:25:33 -0700310 ],
Yifan Hong186b4d92020-08-05 16:30:43 -0700311 test_suites: [
312 "general-tests",
313 "device-tests",
314 ],
Yifan Hongc2bed972020-08-07 16:27:49 -0700315 data: [
316 ":libhealthd_charger_test_data",
317 ],
318 require_root: true,
Yifan Hong12d15752020-08-05 16:25:33 -0700319}
Yifan Hong5109c8c2020-08-05 18:24:25 -0700320
321// /system/etc/res/images/charger/battery_fail.png
322prebuilt_etc {
323 name: "system_core_charger_res_images_battery_fail.png",
324 src: "images/battery_fail.png",
325 relative_install_path: "res/images/charger",
326 filename: "battery_fail.png",
327}
328
329// /system/etc/res/images/charger/battery_scale.png
330prebuilt_etc {
331 name: "system_core_charger_res_images_battery_scale.png",
332 src: "images/battery_scale.png",
333 relative_install_path: "res/images/charger",
334 filename: "battery_scale.png",
335}
336
337phony {
338 name: "charger_res_images",
339 required: [
340 "system_core_charger_res_images_battery_fail.png",
341 "system_core_charger_res_images_battery_scale.png",
342 ],
343}
Yifan Hongac748362021-10-26 17:20:25 -0700344
Tim Zimmermann24bb2722022-08-26 15:54:13 +0200345// /vendor/etc/res/images/default/charger/battery_fail.png
Yifan Hongac748362021-10-26 17:20:25 -0700346prebuilt_etc {
347 name: "system_core_charger_res_images_battery_fail.png_default_vendor",
348 src: "images/battery_fail.png",
Tim Zimmermann24bb2722022-08-26 15:54:13 +0200349 relative_install_path: "res/images/default/charger",
Yifan Hongac748362021-10-26 17:20:25 -0700350 vendor: true,
351 filename: "battery_fail.png",
352}
353
Tim Zimmermann24bb2722022-08-26 15:54:13 +0200354// /vendor/etc/res/images/default/charger/battery_scale.png
Yifan Hongac748362021-10-26 17:20:25 -0700355prebuilt_etc {
356 name: "system_core_charger_res_images_battery_scale.png_default_vendor",
357 src: "images/battery_scale.png",
Tim Zimmermann24bb2722022-08-26 15:54:13 +0200358 relative_install_path: "res/images/default/charger",
Yifan Hongac748362021-10-26 17:20:25 -0700359 vendor: true,
360 filename: "battery_scale.png",
361}
362
363phony {
364 name: "charger_res_images_vendor",
365 required: [
366 "system_core_charger_res_images_battery_fail.png_default_vendor",
367 "system_core_charger_res_images_battery_scale.png_default_vendor",
368 ],
369}