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