• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5cc_library_headers {
6    name: "libhealthd_headers",
7    vendor_available: true,
8    recovery_available: true,
9    export_include_dirs: ["include"],
10    header_libs: ["libbatteryservice_headers"],
11    export_header_lib_headers: ["libbatteryservice_headers"],
12}
13
14cc_library_static {
15    name: "libbatterymonitor",
16    srcs: ["BatteryMonitor.cpp"],
17    cflags: ["-Wall", "-Werror"],
18    vendor_available: true,
19    recovery_available: true,
20    export_include_dirs: ["include"],
21    shared_libs: [
22        "libutils",
23        "libbase",
24
25        // Need HealthInfo definition from headers of these shared
26        // libraries. Clients don't need to link to these.
27        "android.hardware.health@2.1",
28        "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",
34    ],
35    header_libs: ["libhealthd_headers"],
36    export_header_lib_headers: ["libhealthd_headers"],
37}
38
39cc_defaults {
40    name: "android.hardware.health@2.0-service_defaults",
41
42    cflags: [
43        "-Wall",
44        "-Werror",
45    ],
46
47    static_libs: [
48        "android.hardware.health@2.0-impl",
49        "android.hardware.health@1.0-convert",
50        "libhealthservice",
51        "libhealthstoragedefault",
52        "libbatterymonitor",
53    ],
54
55    shared_libs: [
56        "libbase",
57        "libcutils",
58        "libhidlbase",
59        "liblog",
60        "libutils",
61        "android.hardware.health@2.0",
62    ],
63}
64
65cc_binary {
66    name: "android.hardware.health@2.0-service",
67    defaults: ["android.hardware.health@2.0-service_defaults"],
68
69    vendor: true,
70    relative_install_path: "hw",
71    init_rc: ["android.hardware.health@2.0-service.rc"],
72    srcs: [
73        "HealthServiceDefault.cpp",
74    ],
75}
76
77cc_library_static {
78    name: "libhealthd_charger_nops",
79    recovery_available: true,
80
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: [
95        "libhealthloop",
96        "libhealth2impl",
97    ],
98
99    shared_libs: [
100        "android.hardware.health@2.1",
101        "libutils",
102    ],
103}
104
105sysprop_library {
106    name: "charger_sysprop",
107    recovery_available: true,
108    srcs: ["charger.sysprop"],
109    property_owner: "Platform",
110    api_packages: ["android.sysprop"],
111}
112
113cc_library_static {
114    name: "libhealthd_draw",
115    vendor_available: true,
116    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"],
127
128    target: {
129        vendor: {
130            exclude_static_libs: [
131                "libcharger_sysprop",
132            ],
133        },
134    },
135}
136
137cc_library_static {
138    name: "libhealthd_charger_ui",
139    vendor_available: true,
140    export_include_dirs: [
141        "include",
142        "include_charger",
143    ],
144
145    static_libs: [
146        "android.hardware.health-V1-ndk",
147        "android.hardware.health-translate-ndk",
148        "libcharger_sysprop",
149        "libhealthd_draw",
150        "libhealthloop",
151        "libminui",
152    ],
153
154    shared_libs: [
155        "libbase",
156        "libcutils",
157        "liblog",
158        "libpng",
159        "libsuspend",
160        "libutils",
161    ],
162
163    header_libs: [
164        "libhealthd_headers",
165    ],
166
167    export_static_lib_headers: [
168        "android.hardware.health-V1-ndk",
169    ],
170
171    srcs: [
172        "healthd_mode_charger.cpp",
173        "AnimationParser.cpp",
174    ],
175
176    target: {
177        vendor: {
178            exclude_static_libs: [
179                "libcharger_sysprop",
180            ],
181        },
182    },
183}
184
185cc_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",
194        "libcharger_sysprop",
195        "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
212cc_defaults {
213    name: "charger_defaults",
214    local_include_dirs: [
215        "include_charger",
216    ],
217
218    cflags: [
219        "-Wall",
220        "-Werror",
221    ],
222
223    shared_libs: [
224        // common
225        "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",
238        "android.hardware.health-V1-ndk",
239        "libbatterymonitor",
240        "libcharger_sysprop",
241        "libhealthd_charger_nops",
242        "libhealthloop",
243        "libhealth2impl",
244
245        // system charger only
246        "libhealthd_draw",
247        "libhealthd_charger",
248        "libhealthd_charger_ui",
249        "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    ],
262    shared_libs: [
263        "android.hardware.health@2.0",
264        "android.hardware.health@2.1",
265    ],
266
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",
279                "libhealthd_charger_ui",
280                "libminui",
281                "libsuspend",
282            ],
283        }
284    }
285}
286
287cc_test {
288    name: "charger_test",
289    defaults: ["charger_defaults"],
290    srcs: ["charger_test.cpp"],
291    static_libs: [
292        "android.hardware.health@1.0",
293        "android.hardware.health@2.0",
294        "android.hardware.health@2.1",
295    ],
296}
297
298cc_test {
299    name: "libhealthd_charger_test",
300    defaults: ["charger_defaults"],
301    srcs: [
302        "AnimationParser_test.cpp",
303        "healthd_mode_charger_test.cpp"
304    ],
305    static_libs: [
306        "android.hardware.health@1.0",
307        "android.hardware.health@2.0",
308        "android.hardware.health@2.1",
309        "libgmock",
310    ],
311    test_suites: [
312        "general-tests",
313        "device-tests",
314    ],
315    data: [
316        ":libhealthd_charger_test_data",
317    ],
318    require_root: true,
319}
320
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}
344
345// /vendor/etc/res/images/charger/battery_fail.png
346prebuilt_etc {
347    name: "system_core_charger_res_images_battery_fail.png_default_vendor",
348    src: "images/battery_fail.png",
349    relative_install_path: "res/images/charger/default",
350    vendor: true,
351    filename: "battery_fail.png",
352}
353
354// /vendor/etc/res/images/charger/battery_scale.png
355prebuilt_etc {
356    name: "system_core_charger_res_images_battery_scale.png_default_vendor",
357    src: "images/battery_scale.png",
358    relative_install_path: "res/images/charger/default",
359    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}
370