blob: 28215d3fbb7a17fb522abc401d338ce5bd5decdb [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"],
Tomasz Wasilczyke2836312024-05-09 14:36:19 -070022 default_team: "trendy_team_virtualization",
Bob Badour3c538232021-02-12 21:26:48 -080023}
24
Vijay Venkatraman5583be72017-03-24 16:13:58 -070025cc_library_headers {
Steven Morelandb27aa332023-10-09 22:22:27 +000026 name: "libbinder_headers_base",
Vijay Venkatraman5583be72017-03-24 16:13:58 -070027 export_include_dirs: ["include"],
Jiyong Park172bd722017-06-21 12:14:18 +090028 vendor_available: true,
Yifan Hong70786532021-10-20 21:41:18 -070029 recovery_available: true,
Steven Moreland28723ae2019-04-01 18:52:30 -070030 host_supported: true,
Steven Morelandb27aa332023-10-09 22:22:27 +000031 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -070032 cmake_snapshot_supported: true,
Steven Morelandb27aa332023-10-09 22:22:27 +000033
34 header_libs: [
35 "libbinder_headers_platform_shared",
36 ],
37 export_header_lib_headers: [
38 "libbinder_headers_platform_shared",
39 ],
40 apex_available: [
41 "//apex_available:platform",
42 "com.android.media",
43 "com.android.media.swcodec",
44 ],
45 min_sdk_version: "29",
46 target: {
47 darwin: {
48 enabled: false,
49 },
50 },
51 visibility: [
52 ":__subpackages__",
53 ],
54}
55
56cc_library_headers {
57 name: "libbinder_headers",
58 vendor_available: true,
59 recovery_available: true,
60 host_supported: true,
Victor Khimenko38786ab2020-07-03 00:06:50 +020061 native_bridge_supported: true,
Steven Moreland28723ae2019-04-01 18:52:30 -070062
Jiyong Parkb7df6cb2017-04-13 21:19:48 -070063 header_libs: [
64 "libbase_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +000065 "libbinder_headers_base",
Jiyong Parkb7df6cb2017-04-13 21:19:48 -070066 "libcutils_headers",
67 "libutils_headers",
68 ],
69 export_header_lib_headers: [
70 "libbase_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +000071 "libbinder_headers_base",
Jiyong Parkb7df6cb2017-04-13 21:19:48 -070072 "libcutils_headers",
73 "libutils_headers",
74 ],
Jooyung Han5f6a89a2021-02-05 15:28:58 +090075 apex_available: [
76 "//apex_available:platform",
77 "com.android.media",
78 "com.android.media.swcodec",
79 ],
Jooyung Hana395c8d2020-04-16 18:48:32 +090080 min_sdk_version: "29",
Yifan Hongf856a982020-10-30 14:51:17 -070081 target: {
82 darwin: {
83 enabled: false,
84 },
85 },
Vijay Venkatraman5583be72017-03-24 16:13:58 -070086}
87
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -070088cc_cmake_snapshot {
89 name: "binder_sdk",
Tomasz Wasilczyk94c51ab2024-07-02 15:06:02 -070090 modules_host: [
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -070091 "libbinder_sdk",
92 "libbinder_sdk_single_threaded",
93 "libbinder_ndk_sdk",
Tomasz Wasilczyke2836312024-05-09 14:36:19 -070094 "googletest_cmake",
95
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -070096 "binderRpcTestNoKernel",
Tomasz Wasilczyke2836312024-05-09 14:36:19 -070097 "binderRpcTestSingleThreadedNoKernel",
98 "binderRpcWireProtocolTest",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -070099 ],
100 prebuilts: [
101 // to enable arm64 host support, build with musl - e.g. on aosp_cf_arm64_phone
102 "aidl",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700103 ],
104 include_sources: true,
105 cflags: [
106 "-DNDEBUG",
107 "-DBINDER_ENABLE_LIBLOG_ASSERT",
108 "-DBINDER_DISABLE_NATIVE_HANDLE",
109 "-DBINDER_DISABLE_BLOB",
110 "-DBINDER_NO_LIBBASE",
111 "-DBINDER_NO_KERNEL_IPC_TESTING",
112
113 // from Soong's global.go commonGlobalCflags and noOverrideGlobalCflags
114 "-Wno-c99-designator",
115 "-Wno-missing-field-initializers",
116
117 // warnings that only pop up on gcc
118 "-Wno-unknown-pragmas", // "pragma clang"
119 "-Wno-attributes", // attributes on compound-statements
120 "-Wno-psabi", // reminders about old ABI changes
121 ],
122 cflags_ignored: [
123 // gcc requires all header constexprs to be used in all dependent compilatinon units
124 "-Wunused-const-variable",
125 ],
126 library_mapping: [
127 {
128 android_name: "libssl",
129 mapped_name: "ssl",
130 package_pregenerated: "external/boringssl",
131 },
132 {
133 android_name: "libcrypto",
134 mapped_name: "crypto",
135 package_pregenerated: "external/boringssl",
136 },
137 {
138 android_name: "libgtest",
139 mapped_name: "GTest::gtest",
Tomasz Wasilczyke2836312024-05-09 14:36:19 -0700140 package_pregenerated: "external/googletest",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700141 },
142 {
143 android_name: "libgtest_main",
Tomasz Wasilczyke2836312024-05-09 14:36:19 -0700144 mapped_name: "GTest::gtest_main",
145 package_pregenerated: "external/googletest",
146 },
147 {
148 android_name: "googletest_cmake",
149 package_pregenerated: "external/googletest",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700150 },
151
152 // use libbinder_sdk and friends instead of full Android's libbinder
153 {
154 android_name: "libbinder_rpc_no_kernel",
155 mapped_name: "android::libbinder_sdk",
156 },
157 {
158 android_name: "libbinder_rpc_single_threaded_no_kernel",
159 mapped_name: "android::libbinder_sdk_single_threaded",
160 },
161 {
162 android_name: "libbinder_headers",
163 mapped_name: "android::libbinder_headers_base",
164 },
165 {
166 android_name: "libbinder",
167 mapped_name: "android::libbinder_sdk",
168 },
169 {
170 android_name: "libbinder_ndk",
171 mapped_name: "android::libbinder_ndk_sdk",
172 },
173 {
174 android_name: "liblog",
175 mapped_name: "android::liblog_stub",
176 },
177
178 // explicitly included by Binder tests, but not needed outside of Android
179 {
180 android_name: "libbase",
181 },
182 {
183 android_name: "libcutils",
184 },
185 {
186 android_name: "libutils",
187 },
188
189 // disable tests that don't work outside of Android yet
190 {
191 android_name: "binder_rpc_test_service",
192 },
193 {
194 android_name: "binder_rpc_test_service_single_threaded",
195 },
196
197 // trusty mocks are artificially triggered and not needed outside of Android build
198 {
199 android_name: "libbinder_on_trusty_mock",
200 },
201 {
202 android_name: "libbinder_ndk_on_trusty_mock",
203 },
204 {
205 android_name: "binderRpcTestService_on_trusty_mock",
206 },
207 {
208 android_name: "binderRpcTest_on_trusty_mock",
209 },
210 ],
211}
212
Steven Moreland28723ae2019-04-01 18:52:30 -0700213// These interfaces are android-specific implementation unrelated to binder
214// transport itself and should be moved to AIDL or in domain-specific libs.
215//
216// Currently, these are only on system android (not vendor, not host)
Steven Morelandea6bfab2021-04-01 00:10:31 +0000217// TODO(b/183654927) - move these into separate libraries
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400218
219filegroup {
220 name: "libbinder_device_interface_sources",
221 srcs: [
222 "IPermissionController.cpp",
223 "PermissionCache.cpp",
224 "PermissionController.cpp",
225 ],
226}
Steven Moreland28723ae2019-04-01 18:52:30 -0700227
Andrei Homescu12106de2022-04-27 04:42:21 +0000228cc_defaults {
Andrei Homescu875996f2022-08-24 04:25:11 +0000229 name: "libbinder_common_defaults",
Steven Moreland28723ae2019-04-01 18:52:30 -0700230 host_supported: true,
231
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700232 srcs: [
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700233 "Binder.cpp",
234 "BpBinder.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700235 "Debug.cpp",
Yifan Hong8c950422021-08-05 17:13:55 -0700236 "FdTrigger.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700237 "IInterface.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700238 "IResultReceiver.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700239 "Parcel.cpp",
Ryo Hashimotobf551892018-05-31 16:58:35 +0900240 "ParcelFileDescriptor.cpp",
Fabián Cañas356a0222023-01-13 16:32:53 -0500241 "RecordedTransaction.cpp",
Steven Morelandbdb53ab2021-05-05 17:57:41 +0000242 "RpcSession.cpp",
Steven Moreland5553ac42020-11-11 02:14:45 +0000243 "RpcServer.cpp",
244 "RpcState.cpp",
Steven Morelandb27aa332023-10-09 22:22:27 +0000245 "RpcTransportRaw.cpp",
Steven Morelanda86a3562019-08-01 23:28:34 +0000246 "Stability.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700247 "Status.cpp",
248 "TextOutput.cpp",
Steven Morelandf183fdd2020-10-27 00:12:12 +0000249 "Utils.cpp",
Tomasz Wasilczyk26db5e42023-11-02 11:45:11 -0700250 "file.cpp",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100251 ],
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700252
Andrei Homescu875996f2022-08-24 04:25:11 +0000253 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000254 "libbinder_headers_base",
Andrei Homescu875996f2022-08-24 04:25:11 +0000255 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700256 export_header_lib_headers: [
257 "libbinder_headers_base",
258 ],
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800259
260 cflags: [
261 "-Wextra",
262 "-Wextra-semi",
263 "-Werror",
264 "-Wzero-as-null-pointer-constant",
265 "-Wreorder-init-list",
266 "-Wunused-const-variable",
267 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
268 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frederick Maylef785b792024-06-28 20:04:29 +0000269 // Hide symbols by default and set the BUILDING_LIBBINDER macro so that
270 // the code knows to export them.
271 "-fvisibility=hidden",
272 "-DBUILDING_LIBBINDER",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800273 ],
Frederick Maylef785b792024-06-28 20:04:29 +0000274
275 target: {
276 vendor: {
277 // Trimming the exported symbols reveals a bug in vendor code, so
278 // disable it for the vendor variant for now. http://b/349657329
279 // TODO: Fix the issue and remove this override.
280 cflags: ["-fvisibility=default"],
281 },
282 },
Andrei Homescu875996f2022-08-24 04:25:11 +0000283}
284
285cc_defaults {
286 name: "libbinder_android_defaults",
287
288 // TODO(b/31559095): get headers from bionic on host
289 include_dirs: [
290 "bionic/libc/kernel/android/uapi/",
291 "bionic/libc/kernel/uapi/",
292 ],
293
294 srcs: [
Tomasz Wasilczyk0d9dec22023-10-06 20:28:49 +0000295 "OS_android.cpp",
296 "OS_unix_base.cpp",
Andrei Homescu875996f2022-08-24 04:25:11 +0000297 ],
298
Jiyong Park47f876b2018-04-17 13:56:46 +0900299 target: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700300 host: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700301 srcs: [
302 "UtilsHost.cpp",
303 ],
304 },
Yi Kong60560432024-03-12 12:47:44 +0900305 android: {
306 lto: {
Jeongik Cha91486ee2024-03-12 19:35:12 +0900307 thin: true,
Yi Kong60560432024-03-12 12:47:44 +0900308 },
309 },
Jiyong Park47f876b2018-04-17 13:56:46 +0900310 },
311
Todd Kennedy757186e2017-08-02 07:49:20 -0700312 aidl: {
313 export_aidl_headers: true,
314 },
315
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700316 product_variables: {
Yifan Hong84bedeb2021-04-21 21:37:17 -0700317 debuggable: {
Sahil Somani2522b072022-08-08 14:07:47 -0700318 cflags: [
319 "-DBINDER_RPC_DEV_SERVERS",
320 "-DBINDER_ENABLE_RECORDING",
321 ],
Yifan Hong84bedeb2021-04-21 21:37:17 -0700322 },
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700323 },
324
325 shared_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000326 "libcutils",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700327 "liblog",
Steven Morelandb27aa332023-10-09 22:22:27 +0000328 "libutils",
329 ],
330
331 static_libs: [
332 "libbase",
Steven Moreland62129012021-07-29 12:14:44 -0700333 ],
334
Jiyong Park42842052017-06-20 13:51:22 +0900335 header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900336 "jni_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +0000337 "libbinder_headers",
Jiyong Park42842052017-06-20 13:51:22 +0900338 ],
339
Jiyong Park42842052017-06-20 13:51:22 +0900340 export_header_lib_headers: [
341 "libbinder_headers",
Dan Stozad630e522016-12-01 15:16:31 -0800342 ],
343
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700344 sanitize: {
345 misc_undefined: ["integer"],
346 },
Jiyong Park25265082020-11-13 16:58:57 +0900347
348 tidy: true,
349 tidy_flags: [
350 // Only check our headers
351 "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
352 ],
Steven Moreland525dd902021-04-22 23:00:04 +0000353 tidy_checks: [
354 "-performance-no-int-to-ptr",
355 ],
Jiyong Park25265082020-11-13 16:58:57 +0900356 tidy_checks_as_errors: [
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800357 // Explicitly list the checks that should not occur in this module.
358 "abseil-*",
359 "android-*",
360 "bugprone-*",
Chih-Hung Hsieh41366b42022-06-09 23:12:22 -0700361 "-bugprone-branch-clone", // b/155034972
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800362 "cert-*",
363 "clang-analyzer-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800364 "google-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800365 "misc-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800366 "performance*",
Steven Moreland67f85902023-03-15 01:13:49 +0000367 "-performance-move-const-arg", // b/273486801
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800368 "portability*",
Jiyong Park25265082020-11-13 16:58:57 +0900369 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000370}
371
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000372cc_library_headers {
373 name: "trusty_mock_headers",
374 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000375 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000376
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000377 export_include_dirs: [
378 "trusty/include",
379 "trusty/include_mock",
380 ],
381
382 visibility: [
383 ":__subpackages__",
384 ],
385}
386
387cc_defaults {
388 name: "trusty_mock_defaults",
Andrei Homescu4d9420e2023-01-31 01:38:48 +0000389 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000390 vendor_available: true,
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000391
392 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000393 "libbinder_headers_base",
Tomasz Wasilczykc7c22ea2023-11-30 20:13:44 -0800394 "liblog_stub",
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000395 "trusty_mock_headers",
Andrei Homescu875996f2022-08-24 04:25:11 +0000396 ],
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000397 export_header_lib_headers: [
398 "libbinder_headers_base",
399 "liblog_stub",
400 "trusty_mock_headers",
401 ],
Andrei Homescu875996f2022-08-24 04:25:11 +0000402
Steven Morelandb27aa332023-10-09 22:22:27 +0000403 shared_libs: [
404 "libutils_binder_sdk",
405 ],
406
Andrei Homescu875996f2022-08-24 04:25:11 +0000407 cflags: [
408 "-DBINDER_RPC_SINGLE_THREADED",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800409 "-DBINDER_ENABLE_LIBLOG_ASSERT",
Tomasz Wasilczykbe685c02023-11-30 20:20:53 -0800410 "-DBINDER_DISABLE_NATIVE_HANDLE",
411 "-DBINDER_DISABLE_BLOB",
412 "-DBINDER_NO_LIBBASE",
Steven Morelandd5beffc2023-12-15 21:58:38 +0000413 // TODO: switch to "vendor: true" rather than copying this
Andrei Homescu875996f2022-08-24 04:25:11 +0000414 // Trusty libbinder uses vendor stability for its binders
Steven Morelandd5beffc2023-12-15 21:58:38 +0000415 "-D__ANDROID_VENDOR__",
Andrei Homescu875996f2022-08-24 04:25:11 +0000416 "-D__ANDROID_VNDK__",
417 "-U__ANDROID__",
418 "-D__TRUSTY__",
419 "-DTRUSTY_USERSPACE",
420 // Flags from the Trusty build system
421 "-Werror",
422 "-Wsign-compare",
423 "-Wno-unused-function",
424 "-Wno-unused-label",
425 "-fno-common",
426 "-fno-omit-frame-pointer",
427 "-fno-threadsafe-statics",
428 ],
429 rtti: false,
430
Andrei Homescu875996f2022-08-24 04:25:11 +0000431 visibility: [
432 ":__subpackages__",
433 ],
434}
435
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000436cc_library_shared {
437 name: "libbinder_on_trusty_mock",
438 defaults: [
439 "libbinder_common_defaults",
440 "trusty_mock_defaults",
441 ],
442
443 srcs: [
444 // Trusty-specific files
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000445 "trusty/OS.cpp",
446 "trusty/RpcServerTrusty.cpp",
447 "trusty/RpcTransportTipcTrusty.cpp",
448 "trusty/TrustyStatus.cpp",
449 "trusty/socket.cpp",
450 ],
451}
452
Parth Sanec452eee2024-07-04 13:31:21 +0000453soong_config_module_type {
454 name: "libbinder_client_cache_config",
455 module_type: "cc_defaults",
456 config_namespace: "libbinder",
457 bool_variables: ["release_libbinder_client_cache"],
458 properties: [
459 "cflags",
460 ],
461}
462
463libbinder_client_cache_config {
464 name: "libbinder_client_cache_flag",
465 soong_config_variables: {
466 release_libbinder_client_cache: {
467 cflags: ["-DLIBBINDER_CLIENT_CACHE"],
468 conditions_default: {
469 cflags: ["-DNO_LIBBINDER_CLIENT_CACHE"],
470 },
471 },
472 },
473}
474
Andrei Homescu12106de2022-04-27 04:42:21 +0000475cc_defaults {
476 name: "libbinder_kernel_defaults",
Parth Sanec452eee2024-07-04 13:31:21 +0000477 defaults: ["libbinder_client_cache_flag"],
Andrei Homescu12106de2022-04-27 04:42:21 +0000478 srcs: [
479 "BufferedTextOutput.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000480 "BackendUnifiedServiceManager.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000481 "IPCThreadState.cpp",
482 "IServiceManager.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000483 "IServiceManagerFFI.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000484 "ProcessState.cpp",
485 "Static.cpp",
486 ":libbinder_aidl",
487 ":libbinder_device_interface_sources",
488 ],
489 target: {
490 vendor: {
491 exclude_srcs: [
492 ":libbinder_device_interface_sources",
493 ],
494 },
495 host: {
496 srcs: [
497 "ServiceManagerHost.cpp",
498 ],
499 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900500 android: {
501 shared_libs: [
502 "libapexsupport",
503 "libvndksupport",
504 ],
505 },
506 recovery: {
507 exclude_shared_libs: [
508 "libapexsupport",
509 "libvndksupport",
510 ],
511 },
512 native_bridge: {
513 exclude_shared_libs: [
514 "libapexsupport",
515 "libvndksupport",
516 ],
517 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000518 },
519 cflags: [
520 "-DBINDER_WITH_KERNEL_IPC",
521 ],
522}
523
524cc_library {
525 name: "libbinder",
526 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000527 "libbinder_common_defaults",
528 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000529 "libbinder_kernel_defaults",
530 ],
531
532 version_script: "libbinder.map",
533
Andrei Homescuc485fa32023-02-22 19:45:26 +0000534 // for vndbinder
535 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000536 recovery_available: true,
537 double_loadable: true,
538 // TODO(b/153609531): remove when no longer needed.
539 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700540 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000541
542 // libbinder does not offer a stable wire protocol.
543 // if a second copy of it is installed, then it may break after security
544 // or dessert updates. Instead, apex users should use libbinder_ndk.
545 apex_available: [
546 "//apex_available:platform",
547 ],
548
549 srcs: [
550 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000551 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000552 "LazyServiceRegistrar.cpp",
553 "MemoryBase.cpp",
554 "MemoryDealer.cpp",
555 "MemoryHeapBase.cpp",
556 "ParcelableHolder.cpp",
557 "PersistableBundle.cpp",
558 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000559 target: {
560 android: {
561 // NOT static to keep the wire protocol unfrozen
562 static: {
563 enabled: false,
564 },
565 },
566 darwin: {
567 enabled: false,
568 },
569 recovery: {
570 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900571 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000572 ],
573 },
574 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800575
Yi Kong7cd72c52021-12-23 15:51:29 +0800576 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700577}
578
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700579cc_defaults {
580 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000581
582 cflags: [
583 "-DBINDER_ENABLE_LIBLOG_ASSERT",
584 "-DBINDER_DISABLE_NATIVE_HANDLE",
585 "-DBINDER_DISABLE_BLOB",
586 "-DBINDER_NO_LIBBASE",
587 ],
588
589 header_libs: [
590 "liblog_stub",
591 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700592}
593
594cc_defaults {
595 name: "libbinder_sdk_defaults",
596
597 cmake_snapshot_supported: true,
598
599 defaults: [
600 "libbinder_common_defaults",
601 "binder_sdk_defaults",
602 ],
603
604 shared_libs: [
605 "libutils_binder_sdk",
606 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000607
608 srcs: [
609 "OS_non_android_linux.cpp",
610 "OS_unix_base.cpp",
611 ],
612
613 visibility: [
614 ":__subpackages__",
615 ],
616
617 target: {
618 windows: {
619 enabled: false,
620 },
621 },
622}
623
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700624cc_library_host_shared {
625 name: "libbinder_sdk",
626 defaults: ["libbinder_sdk_defaults"],
627}
628
629cc_library_host_shared {
630 name: "libbinder_sdk_single_threaded",
631 defaults: ["libbinder_sdk_defaults"],
632 cflags: [
633 "-DBINDER_RPC_SINGLE_THREADED",
634 ],
635}
636
Steven Moreland52728212024-04-05 20:28:14 +0000637cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000638 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000639 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000640 defaults: [
641 "libbinder_common_defaults",
642 "libbinder_android_defaults",
643 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000644 visibility: [
645 ":__subpackages__",
646 ],
647}
648
Steven Moreland52728212024-04-05 20:28:14 +0000649cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000650 name: "libbinder_rpc_no_blob",
651 vendor_available: true,
652 defaults: [
653 "libbinder_common_defaults",
654 "libbinder_android_defaults",
655 "libbinder_kernel_defaults",
656 ],
657 cflags: [
658 "-DBINDER_DISABLE_BLOB",
659 ],
660 visibility: [
661 ":__subpackages__",
662 ],
663}
664
Steven Moreland52728212024-04-05 20:28:14 +0000665cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000666 name: "libbinder_rpc_no_native_handle",
667 vendor_available: true,
668 defaults: [
669 "libbinder_common_defaults",
670 "libbinder_android_defaults",
671 "libbinder_kernel_defaults",
672 ],
673 cflags: [
674 "-DBINDER_DISABLE_NATIVE_HANDLE",
675 ],
676 visibility: [
677 ":__subpackages__",
678 ],
679}
680
Steven Moreland52728212024-04-05 20:28:14 +0000681cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000682 name: "libbinder_rpc_single_threaded",
683 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000684 "libbinder_common_defaults",
685 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000686 "libbinder_kernel_defaults",
687 ],
688 cflags: [
689 "-DBINDER_RPC_SINGLE_THREADED",
690 ],
691 visibility: [
692 ":__subpackages__",
693 ],
694}
695
Steven Moreland52728212024-04-05 20:28:14 +0000696cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000697 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000698 defaults: [
699 "libbinder_common_defaults",
700 "libbinder_android_defaults",
701 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000702 cflags: [
703 "-DBINDER_RPC_SINGLE_THREADED",
704 ],
705 visibility: [
706 ":__subpackages__",
707 ],
708}
709
Yifan Honge8212f22021-06-28 15:49:08 -0700710cc_defaults {
711 name: "libbinder_tls_shared_deps",
712 shared_libs: [
713 "libbinder",
714 "libcrypto",
715 "liblog",
716 "libssl",
717 "libutils",
718 ],
719}
720
721cc_defaults {
722 name: "libbinder_tls_defaults",
723 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000724 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700725 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700726 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700727
728 header_libs: [
729 "libbinder_headers",
730 ],
731 export_header_lib_headers: [
732 "libbinder_headers",
733 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700734 export_shared_lib_headers: [
735 "libssl",
736 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700737 export_include_dirs: ["include_tls"],
738 static_libs: [
739 "libbase",
740 ],
741 srcs: [
742 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700743 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700744 ],
745}
746
747cc_library_shared {
748 name: "libbinder_tls",
749 defaults: ["libbinder_tls_defaults"],
750}
751
Andrei Homescud65666d2023-03-03 07:28:02 +0000752cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000753 name: "libbinder_trusty",
754 vendor: true,
755 srcs: [
756 "RpcTransportTipcAndroid.cpp",
757 "RpcTrusty.cpp",
758 ],
759
760 shared_libs: [
761 "libbinder",
762 "liblog",
763 "libtrusty",
764 "libutils",
765 ],
766 static_libs: [
767 "libbase",
768 ],
769 export_include_dirs: ["include_trusty"],
770
771 // Most of Android doesn't need this library and shouldn't use it,
772 // so we restrict its visibility to the Trusty-specific packages.
773 visibility: [
774 ":__subpackages__",
775 "//system/core/trusty:__subpackages__",
776 "//vendor:__subpackages__",
777 ],
778}
779
Yifan Hong92409752021-07-30 21:25:32 -0700780// For testing
781cc_library_static {
782 name: "libbinder_tls_static",
783 defaults: ["libbinder_tls_defaults"],
784 visibility: [
785 ":__subpackages__",
786 ],
787}
788
Colin Cross21c210e2017-11-14 13:05:37 -0800789// AIDL interface between libbinder and framework.jar
790filegroup {
791 name: "libbinder_aidl",
792 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000793 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700794 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700795 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700796 "aidl/android/os/IServiceManager.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000797 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800798 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700799 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800800}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700801
Samiul Islam4480b6f2021-08-26 11:41:49 +0100802aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000803 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100804 unstable: true,
805 local_include_dir: "aidl",
806 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000807 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000808 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100809 "aidl/android/content/pm/IStagedApexObserver.aidl",
810 "aidl/android/content/pm/ApexStagedEvent.aidl",
811 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000812 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900813 backend: {
814 rust: {
815 apex_available: [
816 "com.android.virt",
817 ],
818 enabled: true,
819 },
820 },
Steven Morelandf9514192021-03-26 01:34:55 +0000821}
822
Steven Moreland82c97cf2019-10-16 16:29:27 -0700823aidl_interface {
824 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900825 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700826 local_include_dir: "aidl",
827 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700828 vendor_available: true,
829 backend: {
830 java: {
831 enabled: false,
832 },
833 },
Steven Morelandae351c22023-02-13 22:01:00 +0000834 visibility: [
835 ":__subpackages__",
836 "//system/tools/aidl:__subpackages__",
837 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700838}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000839
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700840// TODO(b/184872979): remove once the Rust API is created.
841cc_library {
842 name: "libbinder_rpc_unstable",
843 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700844 shared_libs: [
845 "libbase",
846 "libbinder",
847 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000848 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700849 "libutils",
850 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900851 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700852
853 // enumerate stable entry points, for apex use
854 stubs: {
855 symbol_file: "libbinder_rpc_unstable.map.txt",
856 },
857
858 // This library is intentionally limited to these targets, and it will be removed later.
859 // Do not expand the visibility.
860 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000861 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000862 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000863 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Raphael Blisteinefc3f602023-02-16 16:12:05 +0000864 "//system/software_defined_vehicle:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900865 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700866 ],
867}
868
Steven Morelandea6bfab2021-04-01 00:10:31 +0000869// libbinder historically contained additional interfaces that provided specific
870// functionality in the platform but have nothing to do with binder itself. These
871// are moved out of libbinder in order to avoid the overhead of their vtables.
872// If you are working on or own one of these interfaces, the responsible things
873// to would be:
874// - give them a new home
875// - convert them to AIDL instead of having manually written parceling code
876
877cc_library {
878 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400879 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000880 srcs: [
881 "IBatteryStats.cpp",
882 ],
883 export_include_dirs: ["include_batterystats"],
884 shared_libs: [
885 "libbinder",
886 "libutils",
887 ],
888}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000889
890cc_library {
891 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400892 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000893 srcs: [
894 "IProcessInfoService.cpp",
895 "ProcessInfoService.cpp",
896 ],
897 export_include_dirs: ["include_processinfo"],
898 shared_libs: [
899 "libbinder",
900 "libutils",
901 "liblog",
902 ],
903}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000904
Steven Moreland8a2085c2021-04-05 22:01:48 +0000905cc_library {
906 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000907 srcs: [
908 "ActivityManager.cpp",
909 "IActivityManager.cpp",
910 "IUidObserver.cpp",
911 ":activity_manager_procstate_aidl",
912 ],
913 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000914 shared_libs: [
915 "libbinder",
916 "libutils",
917 "liblog",
918 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000919 aidl: {
920 export_aidl_headers: true,
921 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000922}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700923
924cc_binary {
925 name: "servicedispatcher",
926 host_supported: false,
927 srcs: [
928 "servicedispatcher.cpp",
929 ],
930 shared_libs: [
931 "libbase",
932 "libbinder",
933 "liblog",
934 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -0700935 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -0700936 ],
937}