Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 1 | // Copyright (C) 2021 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Bob Badour | a88d5b1 | 2021-10-28 17:18:27 -0700 | [diff] [blame] | 15 | package { |
| 16 | // See: http://go/android-license-faq |
| 17 | // A large-scale-change added 'default_applicable_licenses' to import |
| 18 | // all of the 'license_kinds' from "hardware_interfaces_license" |
| 19 | // to get the below license kinds: |
| 20 | // SPDX-license-identifier-Apache-2.0 |
| 21 | default_applicable_licenses: ["hardware_interfaces_license"], |
| 22 | } |
| 23 | |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 24 | cc_defaults { |
| 25 | name: "libhealth_aidl_common_defaults", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 26 | shared_libs: [ |
| 27 | "libbase", |
| 28 | "libbinder_ndk", |
| 29 | "libcutils", |
| 30 | "liblog", |
| 31 | "libutils", |
Daniel Zheng | b1553a0 | 2024-10-30 11:26:59 -0700 | [diff] [blame] | 32 | "android.hardware.health-V4-ndk", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 33 | |
| 34 | // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo. |
| 35 | "libhidlbase", |
| 36 | ], |
| 37 | static_libs: [ |
| 38 | "libbatterymonitor", |
| 39 | "libhealthloop", |
| 40 | |
| 41 | // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo. |
| 42 | "android.hardware.health-translate-ndk", |
| 43 | ], |
| 44 | } |
| 45 | |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 46 | // Dependency to libhealthd_charger_ui. No UI in recovery. |
| 47 | cc_defaults { |
| 48 | name: "libhealth_aidl_charger_defaults", |
| 49 | shared_libs: [ |
| 50 | // common |
Daniel Zheng | b1553a0 | 2024-10-30 11:26:59 -0700 | [diff] [blame] | 51 | "android.hardware.health-V4-ndk", |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 52 | "libbase", |
| 53 | "libcutils", |
| 54 | "liblog", |
| 55 | "libutils", |
| 56 | |
| 57 | // charger UI only |
| 58 | "libpng", |
| 59 | ], |
| 60 | |
| 61 | static_libs: [ |
| 62 | // common |
| 63 | "libbatterymonitor", |
| 64 | "libhealthloop", |
| 65 | |
| 66 | // charger UI only |
| 67 | "libhealthd_draw", |
| 68 | "libhealthd_charger_ui", |
| 69 | "libminui", |
| 70 | "libsuspend", |
| 71 | ], |
| 72 | |
| 73 | target: { |
| 74 | recovery: { |
| 75 | // No UI and libsuspend for recovery charger. |
| 76 | cflags: [ |
| 77 | "-DCHARGER_FORCE_NO_UI=1", |
| 78 | ], |
| 79 | exclude_shared_libs: [ |
| 80 | "libpng", |
| 81 | ], |
| 82 | exclude_static_libs: [ |
| 83 | "libhealthd_draw", |
| 84 | "libhealthd_charger_ui", |
| 85 | "libminui", |
| 86 | "libsuspend", |
| 87 | ], |
| 88 | }, |
| 89 | }, |
| 90 | } |
| 91 | |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 92 | // AIDL version of libhealth2impl. |
| 93 | // A helper library for health HAL implementation. |
| 94 | // HAL implementations can link to this library and extend the Health class. |
| 95 | cc_library_static { |
| 96 | name: "libhealth_aidl_impl", |
| 97 | defaults: [ |
| 98 | "libhealth_aidl_common_defaults", |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 99 | "libhealth_aidl_charger_defaults", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 100 | ], |
Yifan Hong | 87ece16 | 2021-11-15 18:50:44 -0800 | [diff] [blame] | 101 | vendor: true, |
| 102 | recovery_available: true, |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 103 | export_include_dirs: ["include"], |
| 104 | export_static_lib_headers: [ |
| 105 | "libbatterymonitor", |
| 106 | ], |
| 107 | srcs: [ |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 108 | "ChargerUtils.cpp", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 109 | "health-convert.cpp", |
| 110 | "HalHealthLoop.cpp", |
| 111 | "Health.cpp", |
| 112 | "LinkedCallback.cpp", |
| 113 | ], |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 114 | target: { |
| 115 | recovery: { |
| 116 | exclude_srcs: [ |
| 117 | "ChargerUtils.cpp", |
| 118 | ], |
| 119 | }, |
| 120 | }, |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 121 | } |
| 122 | |
Yifan Hong | fab263c | 2022-01-05 00:02:27 -0800 | [diff] [blame] | 123 | // Users of libhealth_aidl_impl should use this defaults. |
| 124 | cc_defaults { |
| 125 | name: "libhealth_aidl_impl_user", |
| 126 | defaults: [ |
| 127 | "libhealth_aidl_common_defaults", |
| 128 | "libhealth_aidl_charger_defaults", |
| 129 | ], |
| 130 | } |
| 131 | |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 132 | // AIDL version of android.hardware.health@2.1-service. |
| 133 | // Default binder service of the health HAL. |
Yifan Hong | 87ece16 | 2021-11-15 18:50:44 -0800 | [diff] [blame] | 134 | cc_defaults { |
| 135 | name: "android.hardware.health-service.example-defaults", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 136 | relative_install_path: "hw", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 137 | vintf_fragments: ["android.hardware.health-service.example.xml"], |
| 138 | defaults: [ |
Yifan Hong | fab263c | 2022-01-05 00:02:27 -0800 | [diff] [blame] | 139 | "libhealth_aidl_impl_user", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 140 | ], |
| 141 | static_libs: [ |
| 142 | "libhealth_aidl_impl", |
| 143 | ], |
| 144 | srcs: ["main.cpp"], |
Yifan Hong | 87ece16 | 2021-11-15 18:50:44 -0800 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | cc_binary { |
| 148 | name: "android.hardware.health-service.example", |
| 149 | vendor: true, |
| 150 | defaults: ["android.hardware.health-service.example-defaults"], |
| 151 | init_rc: ["android.hardware.health-service.example.rc"], |
| 152 | overrides: ["charger"], |
| 153 | } |
| 154 | |
| 155 | cc_binary { |
| 156 | name: "android.hardware.health-service.example_recovery", |
| 157 | recovery: true, |
| 158 | defaults: ["android.hardware.health-service.example-defaults"], |
| 159 | init_rc: ["android.hardware.health-service.example_recovery.rc"], |
| 160 | overrides: ["charger.recovery"], |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 161 | } |
hamzeh | 34b4796 | 2022-05-10 12:10:06 -0700 | [diff] [blame] | 162 | |
| 163 | // AIDL Fuzz version of libhealth2impl. |
| 164 | cc_library_static { |
| 165 | name: "fuzz_libhealth_aidl_impl", |
| 166 | defaults: [ |
| 167 | "libhealth_aidl_common_defaults", |
| 168 | "libhealth_aidl_charger_defaults", |
| 169 | ], |
| 170 | recovery_available: true, |
| 171 | export_include_dirs: ["include"], |
| 172 | export_static_lib_headers: [ |
| 173 | "libbatterymonitor", |
| 174 | ], |
| 175 | srcs: [ |
| 176 | "ChargerUtils.cpp", |
| 177 | "health-convert.cpp", |
| 178 | "HalHealthLoop.cpp", |
| 179 | "Health.cpp", |
| 180 | "LinkedCallback.cpp", |
| 181 | ], |
| 182 | target: { |
| 183 | recovery: { |
| 184 | exclude_srcs: [ |
| 185 | "ChargerUtils.cpp", |
| 186 | ], |
| 187 | }, |
| 188 | }, |
| 189 | } |
| 190 | |
| 191 | cc_fuzz { |
| 192 | name: "android.hardware.health-service.aidl_fuzzer", |
| 193 | defaults: [ |
| 194 | "libhealth_aidl_impl_user", |
Pawan | 8e13f2a | 2022-08-19 20:54:21 +0000 | [diff] [blame] | 195 | "service_fuzzer_defaults", |
hamzeh | 34b4796 | 2022-05-10 12:10:06 -0700 | [diff] [blame] | 196 | ], |
| 197 | static_libs: [ |
Daniel Zheng | b1553a0 | 2024-10-30 11:26:59 -0700 | [diff] [blame] | 198 | "android.hardware.health-V4-ndk", |
hamzeh | 34b4796 | 2022-05-10 12:10:06 -0700 | [diff] [blame] | 199 | "libbase", |
hamzeh | 34b4796 | 2022-05-10 12:10:06 -0700 | [diff] [blame] | 200 | "liblog", |
hamzeh | 34b4796 | 2022-05-10 12:10:06 -0700 | [diff] [blame] | 201 | "fuzz_libhealth_aidl_impl", |
| 202 | ], |
hamzeh | 34b4796 | 2022-05-10 12:10:06 -0700 | [diff] [blame] | 203 | srcs: ["fuzzer.cpp"], |
| 204 | fuzz_config: { |
| 205 | cc: [ |
| 206 | "hamzeh@google.com", |
| 207 | ], |
| 208 | }, |
| 209 | } |