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