blob: ec47f68b3f836026372ce1ca78f6322e3e9cf249 [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
25 // Need latest HealthInfo definition from headers of this shared
26 // library. Clients don't need to link to this.
27 "android.hardware.health@2.1",
Yifan Hongffff9aa2017-06-01 14:34:29 -070028 ],
29 header_libs: ["libhealthd_headers"],
30 export_header_lib_headers: ["libhealthd_headers"],
31}
Yifan Hong2763df82017-09-19 17:57:50 -070032
Yifan Hong1cf853f2018-04-04 14:08:57 -070033cc_defaults {
34 name: "android.hardware.health@2.0-service_defaults",
Yifan Hong2763df82017-09-19 17:57:50 -070035
Chih-Hung Hsieh96352662017-11-29 14:24:50 -080036 cflags: [
Chih-Hung Hsieh96352662017-11-29 14:24:50 -080037 "-Wall",
38 "-Werror",
39 ],
Yifan Hong2763df82017-09-19 17:57:50 -070040
41 static_libs: [
42 "android.hardware.health@2.0-impl",
43 "android.hardware.health@1.0-convert",
Yifan Hongaffa24f2018-01-19 15:53:25 -080044 "libhealthservice",
Hridya Valsaraju89178e72018-01-10 16:14:28 -080045 "libhealthstoragedefault",
Yifan Hong2763df82017-09-19 17:57:50 -070046 "libbatterymonitor",
47 ],
48
49 shared_libs: [
50 "libbase",
51 "libcutils",
52 "libhidlbase",
Yifan Hong2763df82017-09-19 17:57:50 -070053 "liblog",
54 "libutils",
55 "android.hardware.health@2.0",
56 ],
57}
Yifan Hong12df1b92017-09-25 17:25:00 -070058
59cc_binary {
Yifan Hong1cf853f2018-04-04 14:08:57 -070060 name: "android.hardware.health@2.0-service",
61 defaults: ["android.hardware.health@2.0-service_defaults"],
Yifan Hong31150c12018-05-01 14:59:43 -070062
Yifan Hongef26fe42018-07-10 13:07:08 -070063 vendor: true,
64 relative_install_path: "hw",
65 init_rc: ["android.hardware.health@2.0-service.rc"],
66 srcs: [
67 "HealthServiceDefault.cpp",
68 ],
Yifan Hong12df1b92017-09-25 17:25:00 -070069}
Tao Bao5747e222018-09-11 10:46:35 -070070
71cc_library_static {
72 name: "libhealthd_charger_nops",
Yifan Hong7dcf7b02019-10-08 17:27:11 -070073 recovery_available: true,
Tao Bao5747e222018-09-11 10:46:35 -070074
75 srcs: [
76 "healthd_mode_charger_nops.cpp",
77 ],
78
79 cflags: [
80 "-Wall",
81 "-Werror",
82 ],
83
84 header_libs: [
85 "libhealthd_headers",
86 ],
87
88 static_libs: [
Yifan Hong7dcf7b02019-10-08 17:27:11 -070089 "libhealthloop",
90 "libhealth2impl",
Tao Bao5747e222018-09-11 10:46:35 -070091 ],
92
93 shared_libs: [
Yifan Hong7dcf7b02019-10-08 17:27:11 -070094 "android.hardware.health@2.1",
Tao Bao5747e222018-09-11 10:46:35 -070095 "libutils",
96 ],
97}
Yifan Hong97eecdc2019-07-03 11:07:37 -070098
99sysprop_library {
100 name: "charger_sysprop",
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700101 recovery_available: true,
Yifan Hong97eecdc2019-07-03 11:07:37 -0700102 srcs: ["charger.sysprop"],
103 property_owner: "Platform",
104 api_packages: ["android.sysprop"],
105}
Yifan Hongdbaa4772019-07-03 11:40:08 -0700106
107cc_library_static {
108 name: "libhealthd_draw",
109 export_include_dirs: ["."],
110 static_libs: [
111 "libcharger_sysprop",
112 "libminui",
113 ],
114 shared_libs: [
115 "libbase",
116 ],
117 header_libs: ["libbatteryservice_headers"],
118
119 srcs: ["healthd_draw.cpp"],
120}
121
122cc_library_static {
123 name: "libhealthd_charger",
124 local_include_dirs: ["include"],
125 export_include_dirs: [".", "include"],
126
127 static_libs: [
Yifan Hongdbaa4772019-07-03 11:40:08 -0700128 "android.hardware.health@1.0-convert",
129 "libcharger_sysprop",
Yifan Hongdbaa4772019-07-03 11:40:08 -0700130 "libhealthd_draw",
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700131 "libhealthloop",
132 "libhealth2impl",
Yifan Hongdbaa4772019-07-03 11:40:08 -0700133 "libminui",
134 ],
135
136 shared_libs: [
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700137 "android.hardware.health@2.1",
Yifan Hongdbaa4772019-07-03 11:40:08 -0700138 "libbase",
139 "libcutils",
140 "liblog",
141 "libpng",
142 "libsuspend",
143 "libutils",
144 ],
145
146 srcs: [
147 "healthd_mode_charger.cpp",
148 "AnimationParser.cpp",
149 ],
150}
Yifan Hong7dcf7b02019-10-08 17:27:11 -0700151
152cc_defaults {
153 name: "charger_defaults",
154
155 cflags: [
156 "-Wall",
157 "-Werror",
158 ],
159
160 shared_libs: [
161 // common
162 "android.hardware.health@2.0",
163 "android.hardware.health@2.1",
164 "libbase",
165 "libcutils",
166 "libhidlbase",
167 "liblog",
168 "libutils",
169
170 // system charger only
171 "libpng",
172 ],
173
174 static_libs: [
175 // common
176 "android.hardware.health@1.0-convert",
177 "libbatterymonitor",
178 "libcharger_sysprop",
179 "libhealthd_charger_nops",
180 "libhealthloop",
181 "libhealth2impl",
182
183 // system charger only
184 "libhealthd_draw",
185 "libhealthd_charger",
186 "libminui",
187 "libsuspend",
188 ],
189}
190
191cc_binary {
192 name: "charger",
193 defaults: ["charger_defaults"],
194 recovery_available: true,
195 srcs: [
196 "charger.cpp",
197 "charger_utils.cpp",
198 ],
199
200 target: {
201 recovery: {
202 // No UI and libsuspend for recovery charger.
203 cflags: [
204 "-DCHARGER_FORCE_NO_UI=1",
205 ],
206 exclude_shared_libs: [
207 "libpng",
208 ],
209 exclude_static_libs: [
210 "libhealthd_draw",
211 "libhealthd_charger",
212 "libminui",
213 "libsuspend",
214 ],
215 }
216 }
217}
218
219cc_test {
220 name: "charger_test",
221 defaults: ["charger_defaults"],
222 srcs: ["charger_test.cpp"],
223}
Yifan Hong12d15752020-08-05 16:25:33 -0700224
225cc_test {
226 name: "libhealthd_charger_test",
Yifan Hongc2bed972020-08-07 16:27:49 -0700227 defaults: ["charger_defaults"],
228 srcs: [
229 "AnimationParser_test.cpp",
230 "healthd_mode_charger_test.cpp"
Yifan Hong12d15752020-08-05 16:25:33 -0700231 ],
232 static_libs: [
Yifan Hongc2bed972020-08-07 16:27:49 -0700233 "libgmock",
Yifan Hong12d15752020-08-05 16:25:33 -0700234 ],
Yifan Hong186b4d92020-08-05 16:30:43 -0700235 test_suites: [
236 "general-tests",
237 "device-tests",
238 ],
Yifan Hongc2bed972020-08-07 16:27:49 -0700239 data: [
240 ":libhealthd_charger_test_data",
241 ],
242 require_root: true,
Yifan Hong12d15752020-08-05 16:25:33 -0700243}
Yifan Hong5109c8c2020-08-05 18:24:25 -0700244
245// /system/etc/res/images/charger/battery_fail.png
246prebuilt_etc {
247 name: "system_core_charger_res_images_battery_fail.png",
248 src: "images/battery_fail.png",
249 relative_install_path: "res/images/charger",
250 filename: "battery_fail.png",
251}
252
253// /system/etc/res/images/charger/battery_scale.png
254prebuilt_etc {
255 name: "system_core_charger_res_images_battery_scale.png",
256 src: "images/battery_scale.png",
257 relative_install_path: "res/images/charger",
258 filename: "battery_scale.png",
259}
260
261phony {
262 name: "charger_res_images",
263 required: [
264 "system_core_charger_res_images_battery_fail.png",
265 "system_core_charger_res_images_battery_scale.png",
266 ],
267}