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 15package { 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 24cc_defaults { 25 name: "libhealth_aidl_common_defaults", 26 shared_libs: [ 27 "libbase", 28 "libbinder_ndk", 29 "libcutils", 30 "liblog", 31 "libutils", 32 "android.hardware.health-V3-ndk", 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 46// Dependency to libhealthd_charger_ui. No UI in recovery. 47cc_defaults { 48 name: "libhealth_aidl_charger_defaults", 49 shared_libs: [ 50 // common 51 "android.hardware.health-V3-ndk", 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 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. 95cc_library_static { 96 name: "libhealth_aidl_impl", 97 defaults: [ 98 "libhealth_aidl_common_defaults", 99 "libhealth_aidl_charger_defaults", 100 ], 101 vendor: true, 102 recovery_available: true, 103 export_include_dirs: ["include"], 104 export_static_lib_headers: [ 105 "libbatterymonitor", 106 ], 107 srcs: [ 108 "ChargerUtils.cpp", 109 "health-convert.cpp", 110 "HalHealthLoop.cpp", 111 "Health.cpp", 112 "LinkedCallback.cpp", 113 ], 114 target: { 115 recovery: { 116 exclude_srcs: [ 117 "ChargerUtils.cpp", 118 ], 119 }, 120 }, 121} 122 123// Users of libhealth_aidl_impl should use this defaults. 124cc_defaults { 125 name: "libhealth_aidl_impl_user", 126 defaults: [ 127 "libhealth_aidl_common_defaults", 128 "libhealth_aidl_charger_defaults", 129 ], 130} 131 132// AIDL version of android.hardware.health@2.1-service. 133// Default binder service of the health HAL. 134cc_defaults { 135 name: "android.hardware.health-service.example-defaults", 136 relative_install_path: "hw", 137 vintf_fragments: ["android.hardware.health-service.example.xml"], 138 defaults: [ 139 "libhealth_aidl_impl_user", 140 ], 141 static_libs: [ 142 "libhealth_aidl_impl", 143 ], 144 srcs: ["main.cpp"], 145} 146 147cc_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 155cc_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"], 161} 162 163// AIDL Fuzz version of libhealth2impl. 164cc_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 191cc_fuzz { 192 name: "android.hardware.health-service.aidl_fuzzer", 193 defaults: [ 194 "libhealth_aidl_impl_user", 195 "service_fuzzer_defaults", 196 ], 197 static_libs: [ 198 "android.hardware.health-V3-ndk", 199 "libbase", 200 "liblog", 201 "fuzz_libhealth_aidl_impl", 202 ], 203 srcs: ["fuzzer.cpp"], 204 fuzz_config: { 205 cc: [ 206 "hamzeh@google.com", 207 ], 208 }, 209} 210