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 latest HealthInfo definition from headers of this shared
26        // library. Clients don't need to link to this.
27        "android.hardware.health@2.1",
28    ],
29    header_libs: ["libhealthd_headers"],
30    export_header_lib_headers: ["libhealthd_headers"],
31}
32
33cc_defaults {
34    name: "android.hardware.health@2.0-service_defaults",
35
36    cflags: [
37        "-Wall",
38        "-Werror",
39    ],
40
41    static_libs: [
42        "android.hardware.health@2.0-impl",
43        "android.hardware.health@1.0-convert",
44        "libhealthservice",
45        "libhealthstoragedefault",
46        "libbatterymonitor",
47    ],
48
49    shared_libs: [
50        "libbase",
51        "libcutils",
52        "libhidlbase",
53        "liblog",
54        "libutils",
55        "android.hardware.health@2.0",
56    ],
57}
58
59cc_binary {
60    name: "android.hardware.health@2.0-service",
61    defaults: ["android.hardware.health@2.0-service_defaults"],
62
63    vendor: true,
64    relative_install_path: "hw",
65    init_rc: ["android.hardware.health@2.0-service.rc"],
66    srcs: [
67        "HealthServiceDefault.cpp",
68    ],
69}
70
71cc_library_static {
72    name: "libhealthd_charger_nops",
73    recovery_available: true,
74
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: [
89        "libhealthloop",
90        "libhealth2impl",
91    ],
92
93    shared_libs: [
94        "android.hardware.health@2.1",
95        "libutils",
96    ],
97}
98
99sysprop_library {
100    name: "charger_sysprop",
101    recovery_available: true,
102    srcs: ["charger.sysprop"],
103    property_owner: "Platform",
104    api_packages: ["android.sysprop"],
105}
106
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: [
128        "android.hardware.health@1.0-convert",
129        "libcharger_sysprop",
130        "libhealthd_draw",
131        "libhealthloop",
132        "libhealth2impl",
133        "libminui",
134    ],
135
136    shared_libs: [
137        "android.hardware.health@2.1",
138        "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}
151
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}
224
225cc_test {
226    name: "libhealthd_charger_test",
227    defaults: ["charger_defaults"],
228    srcs: [
229        "AnimationParser_test.cpp",
230        "healthd_mode_charger_test.cpp"
231    ],
232    static_libs: [
233        "libgmock",
234    ],
235    test_suites: [
236        "general-tests",
237        "device-tests",
238    ],
239    data: [
240        ":libhealthd_charger_test_data",
241    ],
242    require_root: true,
243}
244
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}
268