blob: a13c67753a6eaead048c3f8b75b9b8ed3e92f238 [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 Honge32a8ea2021-10-20 21:54:20 -070026 recovery_available: true,
Yifan Hong830cdb12021-01-11 20:47:23 -080027 vendor: true,
28 shared_libs: [
29 "libbase",
30 "libbinder_ndk",
31 "libcutils",
32 "liblog",
33 "libutils",
34 "android.hardware.health-V1-ndk",
35
36 // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo.
37 "libhidlbase",
38 ],
39 static_libs: [
40 "libbatterymonitor",
41 "libhealthloop",
42
43 // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo.
44 "android.hardware.health-translate-ndk",
45 ],
46}
47
Yifan Honga8f55ca2021-10-20 23:05:45 -070048// Dependency to libhealthd_charger_ui. No UI in recovery.
49cc_defaults {
50 name: "libhealth_aidl_charger_defaults",
51 shared_libs: [
52 // common
53 "android.hardware.health-V1-ndk",
54 "libbase",
55 "libcutils",
56 "liblog",
57 "libutils",
58
59 // charger UI only
60 "libpng",
61 ],
62
63 static_libs: [
64 // common
65 "libbatterymonitor",
66 "libhealthloop",
67
68 // charger UI only
69 "libhealthd_draw",
70 "libhealthd_charger_ui",
71 "libminui",
72 "libsuspend",
73 ],
74
75 target: {
76 recovery: {
77 // No UI and libsuspend for recovery charger.
78 cflags: [
79 "-DCHARGER_FORCE_NO_UI=1",
80 ],
81 exclude_shared_libs: [
82 "libpng",
83 ],
84 exclude_static_libs: [
85 "libhealthd_draw",
86 "libhealthd_charger_ui",
87 "libminui",
88 "libsuspend",
89 ],
90 },
91 },
92}
93
Yifan Hong830cdb12021-01-11 20:47:23 -080094// AIDL version of libhealth2impl.
95// A helper library for health HAL implementation.
96// HAL implementations can link to this library and extend the Health class.
97cc_library_static {
98 name: "libhealth_aidl_impl",
99 defaults: [
100 "libhealth_aidl_common_defaults",
Yifan Honga8f55ca2021-10-20 23:05:45 -0700101 "libhealth_aidl_charger_defaults",
Yifan Hong830cdb12021-01-11 20:47:23 -0800102 ],
103 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
123// AIDL version of android.hardware.health@2.1-service.
124// Default binder service of the health HAL.
125cc_binary {
126 name: "android.hardware.health-service.example",
127 relative_install_path: "hw",
128 init_rc: ["android.hardware.health-service.example.rc"],
129 vintf_fragments: ["android.hardware.health-service.example.xml"],
130 defaults: [
131 "libhealth_aidl_common_defaults",
Yifan Honga8f55ca2021-10-20 23:05:45 -0700132 "libhealth_aidl_charger_defaults",
Yifan Hong830cdb12021-01-11 20:47:23 -0800133 ],
134 static_libs: [
135 "libhealth_aidl_impl",
136 ],
137 srcs: ["main.cpp"],
Yifan Honga8f55ca2021-10-20 23:05:45 -0700138 overrides: [
139 "charger",
140 ],
Yifan Hong830cdb12021-01-11 20:47:23 -0800141}