blob: cc5d0a05b007d8e7f331c66e701b4c201877838c [file] [log] [blame]
Yifan Hong830cdb12021-01-11 20:47:23 -08001// 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 Badoura88d5b12021-10-28 17:18:27 -070015package {
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 Hong830cdb12021-01-11 20:47:23 -080024cc_defaults {
25 name: "libhealth_aidl_common_defaults",
Yifan Hong830cdb12021-01-11 20:47:23 -080026 shared_libs: [
27 "libbase",
28 "libbinder_ndk",
29 "libcutils",
30 "liblog",
31 "libutils",
Daniel Zhengb1553a02024-10-30 11:26:59 -070032 "android.hardware.health-V4-ndk",
Yifan Hong830cdb12021-01-11 20:47:23 -080033
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 Honga8f55ca2021-10-20 23:05:45 -070046// Dependency to libhealthd_charger_ui. No UI in recovery.
47cc_defaults {
48 name: "libhealth_aidl_charger_defaults",
49 shared_libs: [
50 // common
Daniel Zhengb1553a02024-10-30 11:26:59 -070051 "android.hardware.health-V4-ndk",
Yifan Honga8f55ca2021-10-20 23:05:45 -070052 "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 Hong830cdb12021-01-11 20:47:23 -080092// 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",
Yifan Honga8f55ca2021-10-20 23:05:45 -070099 "libhealth_aidl_charger_defaults",
Yifan Hong830cdb12021-01-11 20:47:23 -0800100 ],
Yifan Hong87ece162021-11-15 18:50:44 -0800101 vendor: true,
102 recovery_available: true,
Yifan Hong830cdb12021-01-11 20:47:23 -0800103 export_include_dirs: ["include"],
104 export_static_lib_headers: [
105 "libbatterymonitor",
106 ],
107 srcs: [
Yifan Honga8f55ca2021-10-20 23:05:45 -0700108 "ChargerUtils.cpp",
Yifan Hong830cdb12021-01-11 20:47:23 -0800109 "health-convert.cpp",
110 "HalHealthLoop.cpp",
111 "Health.cpp",
112 "LinkedCallback.cpp",
113 ],
Yifan Honga8f55ca2021-10-20 23:05:45 -0700114 target: {
115 recovery: {
116 exclude_srcs: [
117 "ChargerUtils.cpp",
118 ],
119 },
120 },
Yifan Hong830cdb12021-01-11 20:47:23 -0800121}
122
Yifan Hongfab263c2022-01-05 00:02:27 -0800123// 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
Yifan Hong830cdb12021-01-11 20:47:23 -0800132// AIDL version of android.hardware.health@2.1-service.
133// Default binder service of the health HAL.
Yifan Hong87ece162021-11-15 18:50:44 -0800134cc_defaults {
135 name: "android.hardware.health-service.example-defaults",
Yifan Hong830cdb12021-01-11 20:47:23 -0800136 relative_install_path: "hw",
Yifan Hong830cdb12021-01-11 20:47:23 -0800137 vintf_fragments: ["android.hardware.health-service.example.xml"],
138 defaults: [
Yifan Hongfab263c2022-01-05 00:02:27 -0800139 "libhealth_aidl_impl_user",
Yifan Hong830cdb12021-01-11 20:47:23 -0800140 ],
141 static_libs: [
142 "libhealth_aidl_impl",
143 ],
144 srcs: ["main.cpp"],
Yifan Hong87ece162021-11-15 18:50:44 -0800145}
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"],
Yifan Hong830cdb12021-01-11 20:47:23 -0800161}
hamzeh34b47962022-05-10 12:10:06 -0700162
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",
Pawan8e13f2a2022-08-19 20:54:21 +0000195 "service_fuzzer_defaults",
hamzeh34b47962022-05-10 12:10:06 -0700196 ],
197 static_libs: [
Daniel Zhengb1553a02024-10-30 11:26:59 -0700198 "android.hardware.health-V4-ndk",
hamzeh34b47962022-05-10 12:10:06 -0700199 "libbase",
hamzeh34b47962022-05-10 12:10:06 -0700200 "liblog",
hamzeh34b47962022-05-10 12:10:06 -0700201 "fuzz_libhealth_aidl_impl",
202 ],
hamzeh34b47962022-05-10 12:10:06 -0700203 srcs: ["fuzzer.cpp"],
204 fuzz_config: {
205 cc: [
206 "hamzeh@google.com",
207 ],
208 },
209}