blob: c4cf61babaebb656218711a4ea792fcf393b5049 [file] [log] [blame]
Dan Willemsene05dc6d2016-07-25 17:13:45 -07001// Copyright (C) 2009 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 Badour3c538232021-02-12 21:26:48 -080015package {
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 "frameworks_native_license"
19 // to get the below license kinds:
20 // SPDX-license-identifier-Apache-2.0
21 default_applicable_licenses: ["frameworks_native_license"],
22}
23
Vijay Venkatraman5583be72017-03-24 16:13:58 -070024cc_library_headers {
25 name: "libbinder_headers",
26 export_include_dirs: ["include"],
Jiyong Park172bd722017-06-21 12:14:18 +090027 vendor_available: true,
Steven Moreland28723ae2019-04-01 18:52:30 -070028 host_supported: true,
Victor Khimenko38786ab2020-07-03 00:06:50 +020029 // TODO(b/153609531): remove when no longer needed.
30 native_bridge_supported: true,
Steven Moreland28723ae2019-04-01 18:52:30 -070031
Jiyong Parkb7df6cb2017-04-13 21:19:48 -070032 header_libs: [
33 "libbase_headers",
Jooyung Hancaede592021-02-04 10:18:37 +090034 "libbinder_headers_platform_shared",
Jiyong Parkb7df6cb2017-04-13 21:19:48 -070035 "libcutils_headers",
36 "libutils_headers",
37 ],
38 export_header_lib_headers: [
39 "libbase_headers",
Jooyung Hancaede592021-02-04 10:18:37 +090040 "libbinder_headers_platform_shared",
Jiyong Parkb7df6cb2017-04-13 21:19:48 -070041 "libcutils_headers",
42 "libutils_headers",
43 ],
Jooyung Han5f6a89a2021-02-05 15:28:58 +090044 apex_available: [
45 "//apex_available:platform",
46 "com.android.media",
47 "com.android.media.swcodec",
48 ],
Jooyung Hana395c8d2020-04-16 18:48:32 +090049 min_sdk_version: "29",
Yifan Hongf856a982020-10-30 14:51:17 -070050 target: {
51 darwin: {
52 enabled: false,
53 },
54 },
Vijay Venkatraman5583be72017-03-24 16:13:58 -070055}
56
Steven Moreland28723ae2019-04-01 18:52:30 -070057// These interfaces are android-specific implementation unrelated to binder
58// transport itself and should be moved to AIDL or in domain-specific libs.
59//
60// Currently, these are only on system android (not vendor, not host)
Steven Morelandea6bfab2021-04-01 00:10:31 +000061// TODO(b/183654927) - move these into separate libraries
Steven Moreland28723ae2019-04-01 18:52:30 -070062libbinder_device_interface_sources = [
63 "ActivityManager.cpp",
64 "AppOpsManager.cpp",
65 "IActivityManager.cpp",
66 "IAppOpsCallback.cpp",
67 "IAppOpsService.cpp",
Steven Moreland28723ae2019-04-01 18:52:30 -070068 "IMediaResourceMonitor.cpp",
69 "IPermissionController.cpp",
Steven Moreland28723ae2019-04-01 18:52:30 -070070 "IUidObserver.cpp",
71 "PermissionCache.cpp",
72 "PermissionController.cpp",
Steven Moreland28723ae2019-04-01 18:52:30 -070073 "IpPrefix.cpp",
Steven Moreland0caee582021-04-01 00:29:25 +000074 ":activity_manager_procstate_aidl",
Steven Moreland28723ae2019-04-01 18:52:30 -070075]
76
Steven Moreland899ab372019-09-24 15:16:21 -070077cc_library {
Dan Willemsene05dc6d2016-07-25 17:13:45 -070078 name: "libbinder",
79
Steven Moreland3aa76162017-04-13 21:19:48 -070080 // for vndbinder
81 vendor_available: true,
Justin Yunb367ff42017-08-02 17:02:05 +090082 vndk: {
83 enabled: true,
84 },
Jiyong Parkfe0a8242018-04-09 12:16:30 +090085 double_loadable: true,
Steven Moreland28723ae2019-04-01 18:52:30 -070086 host_supported: true,
Victor Khimenko38786ab2020-07-03 00:06:50 +020087 // TODO(b/153609531): remove when no longer needed.
88 native_bridge_supported: true,
Steven Moreland28723ae2019-04-01 18:52:30 -070089
90 // TODO(b/31559095): get headers from bionic on host
91 include_dirs: [
92 "bionic/libc/kernel/android/uapi/",
93 "bionic/libc/kernel/uapi/",
94 ],
Steven Moreland636d7d52019-08-26 10:42:38 -070095
96 // libbinder does not offer a stable wire protocol.
97 // if a second copy of it is installed, then it may break after security
98 // or dessert updates. Instead, apex users should use libbinder_ndk.
Jiyong Parkdd52ad32019-09-30 19:25:16 +090099 apex_available: [
100 "//apex_available:platform",
Steven Morelande09b0822020-08-26 18:06:13 +0000101 // TODO(b/166468760) remove these three
Jiyong Parkdd52ad32019-09-30 19:25:16 +0900102 "com.android.media.swcodec",
Paul Duffind8ee6df2020-04-03 21:11:36 +0100103 "test_com.android.media.swcodec",
Jiyong Parkdd52ad32019-09-30 19:25:16 +0900104 ],
Steven Moreland3aa76162017-04-13 21:19:48 -0700105
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700106 srcs: [
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700107 "Binder.cpp",
108 "BpBinder.cpp",
109 "BufferedTextOutput.cpp",
110 "Debug.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700111 "IInterface.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700112 "IMemory.cpp",
113 "IPCThreadState.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700114 "IResultReceiver.cpp",
115 "IServiceManager.cpp",
Dianne Hackborn1941a402016-08-29 12:30:43 -0700116 "IShellCallback.cpp",
Jon Spivack9f503a42019-10-22 16:49:19 -0700117 "LazyServiceRegistrar.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700118 "MemoryBase.cpp",
119 "MemoryDealer.cpp",
120 "MemoryHeapBase.cpp",
121 "Parcel.cpp",
Jeongik Cha8cb23452020-08-26 23:38:03 +0900122 "ParcelableHolder.cpp",
Ryo Hashimotobf551892018-05-31 16:58:35 +0900123 "ParcelFileDescriptor.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700124 "PersistableBundle.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700125 "ProcessState.cpp",
Steven Moreland5553ac42020-11-11 02:14:45 +0000126 "RpcAddress.cpp",
127 "RpcConnection.cpp",
128 "RpcServer.cpp",
129 "RpcState.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700130 "Static.cpp",
Steven Morelanda86a3562019-08-01 23:28:34 +0000131 "Stability.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700132 "Status.cpp",
133 "TextOutput.cpp",
Steven Morelandf183fdd2020-10-27 00:12:12 +0000134 "Utils.cpp",
Steven Morelandf9514192021-03-26 01:34:55 +0000135 ":packagemanager_aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800136 ":libbinder_aidl",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700137 ],
138
Jiyong Park47f876b2018-04-17 13:56:46 +0900139 target: {
Steven Moreland28723ae2019-04-01 18:52:30 -0700140 android: {
141 srcs: libbinder_device_interface_sources,
Steven Moreland899ab372019-09-24 15:16:21 -0700142
143 // NOT static to keep the wire protocol unfrozen
144 static: {
145 enabled: false,
146 },
Steven Moreland28723ae2019-04-01 18:52:30 -0700147 },
Jiyong Park47f876b2018-04-17 13:56:46 +0900148 vendor: {
Steven Moreland28723ae2019-04-01 18:52:30 -0700149 exclude_srcs: libbinder_device_interface_sources,
Jiyong Park47f876b2018-04-17 13:56:46 +0900150 },
Yifan Hongf856a982020-10-30 14:51:17 -0700151 darwin: {
152 enabled: false,
153 },
Jiyong Park47f876b2018-04-17 13:56:46 +0900154 },
155
Todd Kennedy757186e2017-08-02 07:49:20 -0700156 aidl: {
157 export_aidl_headers: true,
158 },
159
Steven Moreland2f2c4e02020-07-28 18:11:21 +0000160 // TODO(b/142684679): for com.android.media which is compiled
161 // as vendor and used as system code.
162 use_apex_name_macro: true,
163
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700164 cflags: [
165 "-Wall",
166 "-Wextra",
Jooyung Hanc91e3cb2020-11-25 06:38:17 +0900167 "-Wextra-semi",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700168 "-Werror",
Yi Kongc2376e42018-07-10 15:12:36 -0700169 "-Wzero-as-null-pointer-constant",
Steven Moreland74cf6132020-11-14 00:09:44 +0000170 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700171 ],
172 product_variables: {
173 binder32bit: {
174 cflags: ["-DBINDER_IPC_32BIT=1"],
175 },
176 },
177
178 shared_libs: [
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700179 "liblog",
180 "libcutils",
181 "libutils",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700182 ],
Jiyong Park42842052017-06-20 13:51:22 +0900183
184 header_libs: [
185 "libbinder_headers",
186 ],
187
Jiyong Park42842052017-06-20 13:51:22 +0900188 export_header_lib_headers: [
189 "libbinder_headers",
Dan Stozad630e522016-12-01 15:16:31 -0800190 ],
191
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700192 clang: true,
193 sanitize: {
194 misc_undefined: ["integer"],
195 },
Jooyung Hana395c8d2020-04-16 18:48:32 +0900196 min_sdk_version: "29",
Jiyong Park25265082020-11-13 16:58:57 +0900197
198 tidy: true,
199 tidy_flags: [
200 // Only check our headers
201 "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
202 ],
203 tidy_checks_as_errors: [
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800204 // Explicitly list the checks that should not occur in this module.
205 "abseil-*",
206 "android-*",
207 "bugprone-*",
208 "cert-*",
209 "clang-analyzer-*",
Jiyong Park7ad197b2020-12-16 10:14:10 +0900210 "-clang-analyzer-core.CallAndMessage",
211 "-clang-analyzer-core.uninitialized.Assign",
Jiyong Park21a7de52021-01-12 17:54:27 +0900212 "-clang-analyzer-unix.Malloc",
Jiyong Park7ad197b2020-12-16 10:14:10 +0900213 "-clang-analyzer-deadcode.DeadStores",
214 "-clang-analyzer-optin.cplusplus.UninitializedObject",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800215 "google-*",
216 "-google-readability-*",
217 "-google-runtime-references",
218 "misc-*",
Jiyong Park7ad197b2020-12-16 10:14:10 +0900219 "-misc-no-recursion",
220 "-misc-redundant-expression",
221 "-misc-unused-using-decls",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800222 "performance*",
Steven Moreland1e4e35e2021-03-11 00:46:01 +0000223 "-performance-no-int-to-ptr",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800224 "portability*",
Jiyong Park25265082020-11-13 16:58:57 +0900225 ],
Yi Kong054f2fa2021-03-05 01:50:23 +0800226
227 pgo: {
228 sampling: true,
229 profile_file: "libbinder/libbinder.profdata",
230 },
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700231}
232
Colin Cross21c210e2017-11-14 13:05:37 -0800233// AIDL interface between libbinder and framework.jar
234filegroup {
235 name: "libbinder_aidl",
236 srcs: [
Jon Spivack9f503a42019-10-22 16:49:19 -0700237 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700238 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700239 "aidl/android/os/IServiceManager.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000240 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800241 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700242 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800243}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700244
Steven Morelandf9514192021-03-26 01:34:55 +0000245filegroup {
246 name: "packagemanager_aidl",
247 srcs: [
248 "aidl/android/content/pm/IPackageChangeObserver.aidl",
249 "aidl/android/content/pm/IPackageManagerNative.aidl",
250 "aidl/android/content/pm/PackageChangeEvent.aidl",
251 ],
252 path: "aidl",
253}
254
Steven Moreland82c97cf2019-10-16 16:29:27 -0700255aidl_interface {
256 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900257 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700258 local_include_dir: "aidl",
259 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700260 vendor_available: true,
261 backend: {
262 java: {
263 enabled: false,
264 },
265 },
266}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000267
268// libbinder historically contained additional interfaces that provided specific
269// functionality in the platform but have nothing to do with binder itself. These
270// are moved out of libbinder in order to avoid the overhead of their vtables.
271// If you are working on or own one of these interfaces, the responsible things
272// to would be:
273// - give them a new home
274// - convert them to AIDL instead of having manually written parceling code
275
276cc_library {
277 name: "libbatterystats_aidl",
278 srcs: [
279 "IBatteryStats.cpp",
280 ],
281 export_include_dirs: ["include_batterystats"],
282 shared_libs: [
283 "libbinder",
284 "libutils",
285 ],
286}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000287
288cc_library {
289 name: "libprocessinfoservice_aidl",
290 srcs: [
291 "IProcessInfoService.cpp",
292 "ProcessInfoService.cpp",
293 ],
294 export_include_dirs: ["include_processinfo"],
295 shared_libs: [
296 "libbinder",
297 "libutils",
298 "liblog",
299 ],
300}