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