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