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