Bob Badour | d69ad69 | 2021-02-16 19:02:14 -0800 | [diff] [blame] | 1 | package { |
| 2 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 3 | } |
| 4 | |
Jack Wu | f83e5a6 | 2023-01-10 14:50:52 +0800 | [diff] [blame^] | 5 | cc_defaults { |
| 6 | name: "libbatterymonitor_defaults", |
Yifan Hong | ffff9aa | 2017-06-01 14:34:29 -0700 | [diff] [blame] | 7 | srcs: ["BatteryMonitor.cpp"], |
Chih-Hung Hsieh | 9635266 | 2017-11-29 14:24:50 -0800 | [diff] [blame] | 8 | cflags: ["-Wall", "-Werror"], |
Yifan Hong | ffff9aa | 2017-06-01 14:34:29 -0700 | [diff] [blame] | 9 | vendor_available: true, |
Yifan Hong | 90fdc72 | 2018-07-10 13:02:18 -0700 | [diff] [blame] | 10 | recovery_available: true, |
Yifan Hong | ffff9aa | 2017-06-01 14:34:29 -0700 | [diff] [blame] | 11 | export_include_dirs: ["include"], |
| 12 | shared_libs: [ |
| 13 | "libutils", |
| 14 | "libbase", |
Yifan Hong | 1d4368b | 2019-10-07 11:18:04 -0700 | [diff] [blame] | 15 | |
Yifan Hong | b99d15c | 2022-03-01 12:12:34 -0800 | [diff] [blame] | 16 | // Need HealthInfo definition from headers of these shared |
| 17 | // libraries. Clients don't need to link to these. |
Yifan Hong | 1d4368b | 2019-10-07 11:18:04 -0700 | [diff] [blame] | 18 | "android.hardware.health@2.1", |
Jack Wu | f83e5a6 | 2023-01-10 14:50:52 +0800 | [diff] [blame^] | 19 | ], |
| 20 | header_libs: ["libhealthd_headers"], |
| 21 | export_header_lib_headers: ["libhealthd_headers"], |
| 22 | } |
| 23 | |
| 24 | cc_defaults { |
| 25 | name: "libhealthd_charger_ui_defaults", |
| 26 | vendor_available: true, |
| 27 | export_include_dirs: [ |
| 28 | "include", |
| 29 | "include_charger", |
| 30 | ], |
| 31 | |
| 32 | static_libs: [ |
| 33 | "libcharger_sysprop", |
| 34 | "libhealthd_draw", |
| 35 | "libhealthloop", |
| 36 | "libminui", |
| 37 | ], |
| 38 | |
| 39 | shared_libs: [ |
| 40 | "libbase", |
| 41 | "libcutils", |
| 42 | "liblog", |
| 43 | "libpng", |
| 44 | "libsuspend", |
| 45 | "libutils", |
| 46 | ], |
| 47 | |
| 48 | header_libs: [ |
| 49 | "libhealthd_headers", |
| 50 | ], |
| 51 | |
| 52 | srcs: [ |
| 53 | "healthd_mode_charger.cpp", |
| 54 | "AnimationParser.cpp", |
| 55 | ], |
| 56 | |
| 57 | target: { |
| 58 | vendor: { |
| 59 | exclude_static_libs: [ |
| 60 | "libcharger_sysprop", |
| 61 | ], |
| 62 | }, |
| 63 | }, |
| 64 | } |
| 65 | |
| 66 | cc_library_headers { |
| 67 | name: "libhealthd_headers", |
| 68 | vendor_available: true, |
| 69 | recovery_available: true, |
| 70 | export_include_dirs: ["include"], |
| 71 | header_libs: ["libbatteryservice_headers"], |
| 72 | export_header_lib_headers: ["libbatteryservice_headers"], |
| 73 | } |
| 74 | |
| 75 | cc_library_static { |
| 76 | name: "libbatterymonitor", |
| 77 | defaults: ["libbatterymonitor_defaults"], |
| 78 | static_libs: [ |
Yifan Hong | b99d15c | 2022-03-01 12:12:34 -0800 | [diff] [blame] | 79 | "android.hardware.health-V1-ndk", |
| 80 | ], |
| 81 | whole_static_libs: [ |
| 82 | // Need to translate HIDL to AIDL to support legacy APIs in |
| 83 | // BatteryMonitor. |
| 84 | "android.hardware.health-translate-ndk", |
Yifan Hong | ffff9aa | 2017-06-01 14:34:29 -0700 | [diff] [blame] | 85 | ], |
Jack Wu | f83e5a6 | 2023-01-10 14:50:52 +0800 | [diff] [blame^] | 86 | } |
| 87 | |
| 88 | // TODO(b/251425963): remove when android.hardware.health is upgraded to V2. |
| 89 | cc_library_static { |
| 90 | name: "libbatterymonitor-V1", |
| 91 | defaults: ["libbatterymonitor_defaults"], |
| 92 | static_libs: [ |
| 93 | "android.hardware.health-V1-ndk", |
| 94 | ], |
| 95 | whole_static_libs: [ |
| 96 | // Need to translate HIDL to AIDL to support legacy APIs in |
| 97 | // BatteryMonitor. |
| 98 | "android.hardware.health-translate-V1-ndk", |
| 99 | ], |
Yifan Hong | ffff9aa | 2017-06-01 14:34:29 -0700 | [diff] [blame] | 100 | } |
Yifan Hong | 2763df8 | 2017-09-19 17:57:50 -0700 | [diff] [blame] | 101 | |
Yifan Hong | 1cf853f | 2018-04-04 14:08:57 -0700 | [diff] [blame] | 102 | cc_defaults { |
| 103 | name: "android.hardware.health@2.0-service_defaults", |
Yifan Hong | 2763df8 | 2017-09-19 17:57:50 -0700 | [diff] [blame] | 104 | |
Chih-Hung Hsieh | 9635266 | 2017-11-29 14:24:50 -0800 | [diff] [blame] | 105 | cflags: [ |
Chih-Hung Hsieh | 9635266 | 2017-11-29 14:24:50 -0800 | [diff] [blame] | 106 | "-Wall", |
| 107 | "-Werror", |
| 108 | ], |
Yifan Hong | 2763df8 | 2017-09-19 17:57:50 -0700 | [diff] [blame] | 109 | |
| 110 | static_libs: [ |
| 111 | "android.hardware.health@2.0-impl", |
| 112 | "android.hardware.health@1.0-convert", |
Yifan Hong | affa24f | 2018-01-19 15:53:25 -0800 | [diff] [blame] | 113 | "libhealthservice", |
Hridya Valsaraju | 89178e7 | 2018-01-10 16:14:28 -0800 | [diff] [blame] | 114 | "libhealthstoragedefault", |
Yifan Hong | 2763df8 | 2017-09-19 17:57:50 -0700 | [diff] [blame] | 115 | "libbatterymonitor", |
| 116 | ], |
| 117 | |
| 118 | shared_libs: [ |
| 119 | "libbase", |
| 120 | "libcutils", |
| 121 | "libhidlbase", |
Yifan Hong | 2763df8 | 2017-09-19 17:57:50 -0700 | [diff] [blame] | 122 | "liblog", |
| 123 | "libutils", |
| 124 | "android.hardware.health@2.0", |
| 125 | ], |
| 126 | } |
Yifan Hong | 12df1b9 | 2017-09-25 17:25:00 -0700 | [diff] [blame] | 127 | |
| 128 | cc_binary { |
Yifan Hong | 1cf853f | 2018-04-04 14:08:57 -0700 | [diff] [blame] | 129 | name: "android.hardware.health@2.0-service", |
| 130 | defaults: ["android.hardware.health@2.0-service_defaults"], |
Yifan Hong | 31150c1 | 2018-05-01 14:59:43 -0700 | [diff] [blame] | 131 | |
Yifan Hong | ef26fe4 | 2018-07-10 13:07:08 -0700 | [diff] [blame] | 132 | vendor: true, |
| 133 | relative_install_path: "hw", |
| 134 | init_rc: ["android.hardware.health@2.0-service.rc"], |
| 135 | srcs: [ |
| 136 | "HealthServiceDefault.cpp", |
| 137 | ], |
Yifan Hong | 12df1b9 | 2017-09-25 17:25:00 -0700 | [diff] [blame] | 138 | } |
Tao Bao | 5747e22 | 2018-09-11 10:46:35 -0700 | [diff] [blame] | 139 | |
| 140 | cc_library_static { |
| 141 | name: "libhealthd_charger_nops", |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 142 | recovery_available: true, |
Tao Bao | 5747e22 | 2018-09-11 10:46:35 -0700 | [diff] [blame] | 143 | |
| 144 | srcs: [ |
| 145 | "healthd_mode_charger_nops.cpp", |
| 146 | ], |
| 147 | |
| 148 | cflags: [ |
| 149 | "-Wall", |
| 150 | "-Werror", |
| 151 | ], |
| 152 | |
| 153 | header_libs: [ |
| 154 | "libhealthd_headers", |
| 155 | ], |
| 156 | |
| 157 | static_libs: [ |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 158 | "libhealthloop", |
| 159 | "libhealth2impl", |
Tao Bao | 5747e22 | 2018-09-11 10:46:35 -0700 | [diff] [blame] | 160 | ], |
| 161 | |
| 162 | shared_libs: [ |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 163 | "android.hardware.health@2.1", |
Tao Bao | 5747e22 | 2018-09-11 10:46:35 -0700 | [diff] [blame] | 164 | "libutils", |
| 165 | ], |
| 166 | } |
Yifan Hong | 97eecdc | 2019-07-03 11:07:37 -0700 | [diff] [blame] | 167 | |
| 168 | sysprop_library { |
| 169 | name: "charger_sysprop", |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 170 | recovery_available: true, |
Yifan Hong | 97eecdc | 2019-07-03 11:07:37 -0700 | [diff] [blame] | 171 | srcs: ["charger.sysprop"], |
| 172 | property_owner: "Platform", |
| 173 | api_packages: ["android.sysprop"], |
| 174 | } |
Yifan Hong | dbaa477 | 2019-07-03 11:40:08 -0700 | [diff] [blame] | 175 | |
| 176 | cc_library_static { |
| 177 | name: "libhealthd_draw", |
Yifan Hong | e3ffd1b | 2021-10-20 22:18:16 -0700 | [diff] [blame] | 178 | vendor_available: true, |
Yifan Hong | dbaa477 | 2019-07-03 11:40:08 -0700 | [diff] [blame] | 179 | export_include_dirs: ["."], |
| 180 | static_libs: [ |
| 181 | "libcharger_sysprop", |
| 182 | "libminui", |
| 183 | ], |
| 184 | shared_libs: [ |
| 185 | "libbase", |
| 186 | ], |
| 187 | header_libs: ["libbatteryservice_headers"], |
| 188 | |
| 189 | srcs: ["healthd_draw.cpp"], |
Yifan Hong | e3ffd1b | 2021-10-20 22:18:16 -0700 | [diff] [blame] | 190 | |
| 191 | target: { |
| 192 | vendor: { |
| 193 | exclude_static_libs: [ |
| 194 | "libcharger_sysprop", |
| 195 | ], |
| 196 | }, |
| 197 | }, |
Yifan Hong | dbaa477 | 2019-07-03 11:40:08 -0700 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | cc_library_static { |
Yifan Hong | b5d7033 | 2021-10-20 17:15:32 -0700 | [diff] [blame] | 201 | name: "libhealthd_charger_ui", |
Jack Wu | f83e5a6 | 2023-01-10 14:50:52 +0800 | [diff] [blame^] | 202 | defaults: ["libhealthd_charger_ui_defaults"], |
Yifan Hong | dbaa477 | 2019-07-03 11:40:08 -0700 | [diff] [blame] | 203 | |
| 204 | static_libs: [ |
Yifan Hong | b5d7033 | 2021-10-20 17:15:32 -0700 | [diff] [blame] | 205 | "android.hardware.health-V1-ndk", |
| 206 | "android.hardware.health-translate-ndk", |
Yifan Hong | b5d7033 | 2021-10-20 17:15:32 -0700 | [diff] [blame] | 207 | ], |
| 208 | |
| 209 | export_static_lib_headers: [ |
| 210 | "android.hardware.health-V1-ndk", |
| 211 | ], |
Jack Wu | f83e5a6 | 2023-01-10 14:50:52 +0800 | [diff] [blame^] | 212 | } |
Yifan Hong | b5d7033 | 2021-10-20 17:15:32 -0700 | [diff] [blame] | 213 | |
Jack Wu | f83e5a6 | 2023-01-10 14:50:52 +0800 | [diff] [blame^] | 214 | // TODO(b/251425963): remove when android.hardware.health is upgraded to V2. |
| 215 | cc_library_static { |
| 216 | name: "libhealthd_charger_ui-V1", |
| 217 | defaults: ["libhealthd_charger_ui_defaults"], |
| 218 | |
| 219 | static_libs: [ |
| 220 | "android.hardware.health-V1-ndk", |
| 221 | "android.hardware.health-translate-V1-ndk", |
Yifan Hong | dbaa477 | 2019-07-03 11:40:08 -0700 | [diff] [blame] | 222 | ], |
Yifan Hong | e3ffd1b | 2021-10-20 22:18:16 -0700 | [diff] [blame] | 223 | |
Jack Wu | f83e5a6 | 2023-01-10 14:50:52 +0800 | [diff] [blame^] | 224 | export_static_lib_headers: [ |
| 225 | "android.hardware.health-V1-ndk", |
| 226 | ], |
Yifan Hong | dbaa477 | 2019-07-03 11:40:08 -0700 | [diff] [blame] | 227 | } |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 228 | |
Yifan Hong | b5d7033 | 2021-10-20 17:15:32 -0700 | [diff] [blame] | 229 | cc_library_static { |
| 230 | name: "libhealthd_charger", |
| 231 | export_include_dirs: [ |
| 232 | "include", |
| 233 | "include_charger", |
| 234 | ], |
| 235 | |
| 236 | static_libs: [ |
| 237 | "android.hardware.health@1.0-convert", |
Yifan Hong | 8e55134 | 2021-10-26 22:51:29 -0700 | [diff] [blame] | 238 | "libcharger_sysprop", |
Yifan Hong | b5d7033 | 2021-10-20 17:15:32 -0700 | [diff] [blame] | 239 | "libhealth2impl", |
| 240 | "libhealthd_charger_ui", |
| 241 | ], |
| 242 | |
| 243 | shared_libs: [ |
| 244 | "android.hardware.health@2.1", |
| 245 | "libbase", |
| 246 | "libcutils", |
| 247 | "liblog", |
| 248 | "libutils", |
| 249 | ], |
| 250 | |
| 251 | srcs: [ |
| 252 | "healthd_mode_charger_hidl.cpp", |
| 253 | ], |
| 254 | } |
| 255 | |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 256 | cc_defaults { |
| 257 | name: "charger_defaults", |
Yifan Hong | b5d7033 | 2021-10-20 17:15:32 -0700 | [diff] [blame] | 258 | local_include_dirs: [ |
| 259 | "include_charger", |
| 260 | ], |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 261 | |
| 262 | cflags: [ |
| 263 | "-Wall", |
| 264 | "-Werror", |
| 265 | ], |
| 266 | |
| 267 | shared_libs: [ |
| 268 | // common |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 269 | "libbase", |
| 270 | "libcutils", |
| 271 | "libhidlbase", |
| 272 | "liblog", |
| 273 | "libutils", |
| 274 | |
| 275 | // system charger only |
| 276 | "libpng", |
| 277 | ], |
| 278 | |
| 279 | static_libs: [ |
| 280 | // common |
| 281 | "android.hardware.health@1.0-convert", |
Yifan Hong | b5d7033 | 2021-10-20 17:15:32 -0700 | [diff] [blame] | 282 | "android.hardware.health-V1-ndk", |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 283 | "libbatterymonitor", |
| 284 | "libcharger_sysprop", |
| 285 | "libhealthd_charger_nops", |
| 286 | "libhealthloop", |
| 287 | "libhealth2impl", |
| 288 | |
| 289 | // system charger only |
| 290 | "libhealthd_draw", |
| 291 | "libhealthd_charger", |
Yifan Hong | b5d7033 | 2021-10-20 17:15:32 -0700 | [diff] [blame] | 292 | "libhealthd_charger_ui", |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 293 | "libminui", |
| 294 | "libsuspend", |
| 295 | ], |
| 296 | } |
| 297 | |
| 298 | cc_binary { |
| 299 | name: "charger", |
| 300 | defaults: ["charger_defaults"], |
| 301 | recovery_available: true, |
| 302 | srcs: [ |
| 303 | "charger.cpp", |
| 304 | "charger_utils.cpp", |
| 305 | ], |
Yifan Hong | 5771858 | 2021-12-13 14:01:14 -0800 | [diff] [blame] | 306 | shared_libs: [ |
| 307 | "android.hardware.health@2.0", |
| 308 | "android.hardware.health@2.1", |
| 309 | ], |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 310 | |
| 311 | target: { |
| 312 | recovery: { |
| 313 | // No UI and libsuspend for recovery charger. |
| 314 | cflags: [ |
| 315 | "-DCHARGER_FORCE_NO_UI=1", |
| 316 | ], |
| 317 | exclude_shared_libs: [ |
| 318 | "libpng", |
| 319 | ], |
| 320 | exclude_static_libs: [ |
| 321 | "libhealthd_draw", |
| 322 | "libhealthd_charger", |
Yifan Hong | b5d7033 | 2021-10-20 17:15:32 -0700 | [diff] [blame] | 323 | "libhealthd_charger_ui", |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 324 | "libminui", |
| 325 | "libsuspend", |
| 326 | ], |
| 327 | } |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | cc_test { |
| 332 | name: "charger_test", |
| 333 | defaults: ["charger_defaults"], |
| 334 | srcs: ["charger_test.cpp"], |
Yifan Hong | 5771858 | 2021-12-13 14:01:14 -0800 | [diff] [blame] | 335 | static_libs: [ |
| 336 | "android.hardware.health@1.0", |
| 337 | "android.hardware.health@2.0", |
| 338 | "android.hardware.health@2.1", |
| 339 | ], |
Yifan Hong | 7dcf7b0 | 2019-10-08 17:27:11 -0700 | [diff] [blame] | 340 | } |
Yifan Hong | 12d1575 | 2020-08-05 16:25:33 -0700 | [diff] [blame] | 341 | |
| 342 | cc_test { |
| 343 | name: "libhealthd_charger_test", |
Yifan Hong | c2bed97 | 2020-08-07 16:27:49 -0700 | [diff] [blame] | 344 | defaults: ["charger_defaults"], |
| 345 | srcs: [ |
| 346 | "AnimationParser_test.cpp", |
| 347 | "healthd_mode_charger_test.cpp" |
Yifan Hong | 12d1575 | 2020-08-05 16:25:33 -0700 | [diff] [blame] | 348 | ], |
| 349 | static_libs: [ |
Yifan Hong | 5771858 | 2021-12-13 14:01:14 -0800 | [diff] [blame] | 350 | "android.hardware.health@1.0", |
| 351 | "android.hardware.health@2.0", |
| 352 | "android.hardware.health@2.1", |
Yifan Hong | c2bed97 | 2020-08-07 16:27:49 -0700 | [diff] [blame] | 353 | "libgmock", |
Yifan Hong | 12d1575 | 2020-08-05 16:25:33 -0700 | [diff] [blame] | 354 | ], |
Yifan Hong | 186b4d9 | 2020-08-05 16:30:43 -0700 | [diff] [blame] | 355 | test_suites: [ |
| 356 | "general-tests", |
| 357 | "device-tests", |
| 358 | ], |
Yifan Hong | c2bed97 | 2020-08-07 16:27:49 -0700 | [diff] [blame] | 359 | data: [ |
| 360 | ":libhealthd_charger_test_data", |
| 361 | ], |
| 362 | require_root: true, |
Yifan Hong | 12d1575 | 2020-08-05 16:25:33 -0700 | [diff] [blame] | 363 | } |
Yifan Hong | 5109c8c | 2020-08-05 18:24:25 -0700 | [diff] [blame] | 364 | |
| 365 | // /system/etc/res/images/charger/battery_fail.png |
| 366 | prebuilt_etc { |
| 367 | name: "system_core_charger_res_images_battery_fail.png", |
| 368 | src: "images/battery_fail.png", |
| 369 | relative_install_path: "res/images/charger", |
| 370 | filename: "battery_fail.png", |
| 371 | } |
| 372 | |
| 373 | // /system/etc/res/images/charger/battery_scale.png |
| 374 | prebuilt_etc { |
| 375 | name: "system_core_charger_res_images_battery_scale.png", |
| 376 | src: "images/battery_scale.png", |
| 377 | relative_install_path: "res/images/charger", |
| 378 | filename: "battery_scale.png", |
| 379 | } |
| 380 | |
| 381 | phony { |
| 382 | name: "charger_res_images", |
| 383 | required: [ |
| 384 | "system_core_charger_res_images_battery_fail.png", |
| 385 | "system_core_charger_res_images_battery_scale.png", |
| 386 | ], |
| 387 | } |
Yifan Hong | ac74836 | 2021-10-26 17:20:25 -0700 | [diff] [blame] | 388 | |
Tim Zimmermann | c4c2a07 | 2022-08-26 15:54:13 +0200 | [diff] [blame] | 389 | // /vendor/etc/res/images/default/charger/battery_fail.png |
Yifan Hong | ac74836 | 2021-10-26 17:20:25 -0700 | [diff] [blame] | 390 | prebuilt_etc { |
| 391 | name: "system_core_charger_res_images_battery_fail.png_default_vendor", |
| 392 | src: "images/battery_fail.png", |
Tim Zimmermann | c4c2a07 | 2022-08-26 15:54:13 +0200 | [diff] [blame] | 393 | relative_install_path: "res/images/default/charger", |
Yifan Hong | ac74836 | 2021-10-26 17:20:25 -0700 | [diff] [blame] | 394 | vendor: true, |
| 395 | filename: "battery_fail.png", |
| 396 | } |
| 397 | |
Tim Zimmermann | c4c2a07 | 2022-08-26 15:54:13 +0200 | [diff] [blame] | 398 | // /vendor/etc/res/images/default/charger/battery_scale.png |
Yifan Hong | ac74836 | 2021-10-26 17:20:25 -0700 | [diff] [blame] | 399 | prebuilt_etc { |
| 400 | name: "system_core_charger_res_images_battery_scale.png_default_vendor", |
| 401 | src: "images/battery_scale.png", |
Tim Zimmermann | c4c2a07 | 2022-08-26 15:54:13 +0200 | [diff] [blame] | 402 | relative_install_path: "res/images/default/charger", |
Yifan Hong | ac74836 | 2021-10-26 17:20:25 -0700 | [diff] [blame] | 403 | vendor: true, |
| 404 | filename: "battery_scale.png", |
| 405 | } |
| 406 | |
| 407 | phony { |
| 408 | name: "charger_res_images_vendor", |
| 409 | required: [ |
| 410 | "system_core_charger_res_images_battery_fail.png_default_vendor", |
| 411 | "system_core_charger_res_images_battery_scale.png_default_vendor", |
| 412 | ], |
| 413 | } |