blob: 02c0fa6e315e0b1fbc0f75b8aa1c8c07064882c4 [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
Andrei Homescu12106de2022-04-27 04:42:21 +0000453cc_defaults {
454 name: "libbinder_kernel_defaults",
455 srcs: [
456 "BufferedTextOutput.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000457 "BackendUnifiedServiceManager.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000458 "IPCThreadState.cpp",
459 "IServiceManager.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000460 "IServiceManagerFFI.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000461 "ProcessState.cpp",
462 "Static.cpp",
463 ":libbinder_aidl",
464 ":libbinder_device_interface_sources",
465 ],
466 target: {
467 vendor: {
468 exclude_srcs: [
469 ":libbinder_device_interface_sources",
470 ],
471 },
472 host: {
473 srcs: [
474 "ServiceManagerHost.cpp",
475 ],
476 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900477 android: {
478 shared_libs: [
479 "libapexsupport",
480 "libvndksupport",
481 ],
482 },
483 recovery: {
484 exclude_shared_libs: [
485 "libapexsupport",
486 "libvndksupport",
487 ],
488 },
489 native_bridge: {
490 exclude_shared_libs: [
491 "libapexsupport",
492 "libvndksupport",
493 ],
494 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000495 },
496 cflags: [
497 "-DBINDER_WITH_KERNEL_IPC",
498 ],
499}
500
501cc_library {
502 name: "libbinder",
503 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000504 "libbinder_common_defaults",
505 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000506 "libbinder_kernel_defaults",
507 ],
508
509 version_script: "libbinder.map",
510
Andrei Homescuc485fa32023-02-22 19:45:26 +0000511 // for vndbinder
512 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000513 recovery_available: true,
514 double_loadable: true,
515 // TODO(b/153609531): remove when no longer needed.
516 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700517 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000518
519 // libbinder does not offer a stable wire protocol.
520 // if a second copy of it is installed, then it may break after security
521 // or dessert updates. Instead, apex users should use libbinder_ndk.
522 apex_available: [
523 "//apex_available:platform",
524 ],
525
526 srcs: [
527 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000528 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000529 "LazyServiceRegistrar.cpp",
530 "MemoryBase.cpp",
531 "MemoryDealer.cpp",
532 "MemoryHeapBase.cpp",
533 "ParcelableHolder.cpp",
534 "PersistableBundle.cpp",
535 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000536 target: {
537 android: {
538 // NOT static to keep the wire protocol unfrozen
539 static: {
540 enabled: false,
541 },
542 },
543 darwin: {
544 enabled: false,
545 },
546 recovery: {
547 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900548 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000549 ],
550 },
551 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800552
Yi Kong7cd72c52021-12-23 15:51:29 +0800553 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700554}
555
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700556cc_defaults {
557 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000558
559 cflags: [
560 "-DBINDER_ENABLE_LIBLOG_ASSERT",
561 "-DBINDER_DISABLE_NATIVE_HANDLE",
562 "-DBINDER_DISABLE_BLOB",
563 "-DBINDER_NO_LIBBASE",
564 ],
565
566 header_libs: [
567 "liblog_stub",
568 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700569}
570
571cc_defaults {
572 name: "libbinder_sdk_defaults",
573
574 cmake_snapshot_supported: true,
575
576 defaults: [
577 "libbinder_common_defaults",
578 "binder_sdk_defaults",
579 ],
580
581 shared_libs: [
582 "libutils_binder_sdk",
583 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000584
585 srcs: [
586 "OS_non_android_linux.cpp",
587 "OS_unix_base.cpp",
588 ],
589
590 visibility: [
591 ":__subpackages__",
592 ],
593
594 target: {
595 windows: {
596 enabled: false,
597 },
598 },
599}
600
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700601cc_library_host_shared {
602 name: "libbinder_sdk",
603 defaults: ["libbinder_sdk_defaults"],
604}
605
606cc_library_host_shared {
607 name: "libbinder_sdk_single_threaded",
608 defaults: ["libbinder_sdk_defaults"],
609 cflags: [
610 "-DBINDER_RPC_SINGLE_THREADED",
611 ],
612}
613
Steven Moreland52728212024-04-05 20:28:14 +0000614cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000615 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000616 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000617 defaults: [
618 "libbinder_common_defaults",
619 "libbinder_android_defaults",
620 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000621 visibility: [
622 ":__subpackages__",
623 ],
624}
625
Steven Moreland52728212024-04-05 20:28:14 +0000626cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000627 name: "libbinder_rpc_no_blob",
628 vendor_available: true,
629 defaults: [
630 "libbinder_common_defaults",
631 "libbinder_android_defaults",
632 "libbinder_kernel_defaults",
633 ],
634 cflags: [
635 "-DBINDER_DISABLE_BLOB",
636 ],
637 visibility: [
638 ":__subpackages__",
639 ],
640}
641
Steven Moreland52728212024-04-05 20:28:14 +0000642cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000643 name: "libbinder_rpc_no_native_handle",
644 vendor_available: true,
645 defaults: [
646 "libbinder_common_defaults",
647 "libbinder_android_defaults",
648 "libbinder_kernel_defaults",
649 ],
650 cflags: [
651 "-DBINDER_DISABLE_NATIVE_HANDLE",
652 ],
653 visibility: [
654 ":__subpackages__",
655 ],
656}
657
Steven Moreland52728212024-04-05 20:28:14 +0000658cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000659 name: "libbinder_rpc_single_threaded",
660 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000661 "libbinder_common_defaults",
662 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000663 "libbinder_kernel_defaults",
664 ],
665 cflags: [
666 "-DBINDER_RPC_SINGLE_THREADED",
667 ],
668 visibility: [
669 ":__subpackages__",
670 ],
671}
672
Steven Moreland52728212024-04-05 20:28:14 +0000673cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000674 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000675 defaults: [
676 "libbinder_common_defaults",
677 "libbinder_android_defaults",
678 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000679 cflags: [
680 "-DBINDER_RPC_SINGLE_THREADED",
681 ],
682 visibility: [
683 ":__subpackages__",
684 ],
685}
686
Yifan Honge8212f22021-06-28 15:49:08 -0700687cc_defaults {
688 name: "libbinder_tls_shared_deps",
689 shared_libs: [
690 "libbinder",
691 "libcrypto",
692 "liblog",
693 "libssl",
694 "libutils",
695 ],
696}
697
698cc_defaults {
699 name: "libbinder_tls_defaults",
700 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000701 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700702 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700703 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700704
705 header_libs: [
706 "libbinder_headers",
707 ],
708 export_header_lib_headers: [
709 "libbinder_headers",
710 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700711 export_shared_lib_headers: [
712 "libssl",
713 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700714 export_include_dirs: ["include_tls"],
715 static_libs: [
716 "libbase",
717 ],
718 srcs: [
719 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700720 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700721 ],
722}
723
724cc_library_shared {
725 name: "libbinder_tls",
726 defaults: ["libbinder_tls_defaults"],
727}
728
Andrei Homescud65666d2023-03-03 07:28:02 +0000729cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000730 name: "libbinder_trusty",
731 vendor: true,
732 srcs: [
733 "RpcTransportTipcAndroid.cpp",
734 "RpcTrusty.cpp",
735 ],
736
737 shared_libs: [
738 "libbinder",
739 "liblog",
740 "libtrusty",
741 "libutils",
742 ],
743 static_libs: [
744 "libbase",
745 ],
746 export_include_dirs: ["include_trusty"],
747
748 // Most of Android doesn't need this library and shouldn't use it,
749 // so we restrict its visibility to the Trusty-specific packages.
750 visibility: [
751 ":__subpackages__",
752 "//system/core/trusty:__subpackages__",
753 "//vendor:__subpackages__",
754 ],
755}
756
Yifan Hong92409752021-07-30 21:25:32 -0700757// For testing
758cc_library_static {
759 name: "libbinder_tls_static",
760 defaults: ["libbinder_tls_defaults"],
761 visibility: [
762 ":__subpackages__",
763 ],
764}
765
Colin Cross21c210e2017-11-14 13:05:37 -0800766// AIDL interface between libbinder and framework.jar
767filegroup {
768 name: "libbinder_aidl",
769 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000770 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700771 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700772 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700773 "aidl/android/os/IServiceManager.aidl",
Alice Wang8578f132024-05-03 09:01:56 +0000774 "aidl/android/os/Service.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000775 "aidl/android/os/ServiceDebugInfo.aidl",
Alice Wang8578f132024-05-03 09:01:56 +0000776 ":libbinder_accessor_aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800777 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700778 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800779}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700780
Alice Wang8578f132024-05-03 09:01:56 +0000781filegroup {
782 name: "libbinder_accessor_aidl",
783 srcs: [
784 "aidl/android/os/IAccessor.aidl",
785 ],
786 path: "aidl",
787}
788
789// TODO(b/353492849): Make this interface private to libbinder.
790aidl_interface {
791 name: "android.os.accessor",
792 srcs: [":libbinder_accessor_aidl"],
793 unstable: true,
794 backend: {
795 rust: {
796 enabled: true,
797 apex_available: [
798 "com.android.virt",
799 ],
800 },
801 },
802 visibility: [
803 ":__subpackages__",
804 "//system/tools/aidl:__subpackages__",
805 "//packages/modules/Virtualization:__subpackages__",
806 ],
807}
808
Samiul Islam4480b6f2021-08-26 11:41:49 +0100809aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000810 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100811 unstable: true,
812 local_include_dir: "aidl",
813 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000814 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000815 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100816 "aidl/android/content/pm/IStagedApexObserver.aidl",
817 "aidl/android/content/pm/ApexStagedEvent.aidl",
818 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000819 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900820 backend: {
821 rust: {
822 apex_available: [
823 "com.android.virt",
824 ],
825 enabled: true,
826 },
827 },
Steven Morelandf9514192021-03-26 01:34:55 +0000828}
829
Steven Moreland82c97cf2019-10-16 16:29:27 -0700830aidl_interface {
831 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900832 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700833 local_include_dir: "aidl",
834 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700835 vendor_available: true,
836 backend: {
837 java: {
838 enabled: false,
839 },
840 },
Steven Morelandae351c22023-02-13 22:01:00 +0000841 visibility: [
842 ":__subpackages__",
843 "//system/tools/aidl:__subpackages__",
844 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700845}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000846
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700847// TODO(b/184872979): remove once the Rust API is created.
848cc_library {
849 name: "libbinder_rpc_unstable",
850 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700851 shared_libs: [
852 "libbase",
853 "libbinder",
854 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000855 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700856 "libutils",
857 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900858 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700859
860 // enumerate stable entry points, for apex use
861 stubs: {
862 symbol_file: "libbinder_rpc_unstable.map.txt",
863 },
864
865 // This library is intentionally limited to these targets, and it will be removed later.
866 // Do not expand the visibility.
867 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000868 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000869 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000870 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Raphael Blisteinefc3f602023-02-16 16:12:05 +0000871 "//system/software_defined_vehicle:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900872 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700873 ],
874}
875
Steven Morelandea6bfab2021-04-01 00:10:31 +0000876// libbinder historically contained additional interfaces that provided specific
877// functionality in the platform but have nothing to do with binder itself. These
878// are moved out of libbinder in order to avoid the overhead of their vtables.
879// If you are working on or own one of these interfaces, the responsible things
880// to would be:
881// - give them a new home
882// - convert them to AIDL instead of having manually written parceling code
883
884cc_library {
885 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400886 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000887 srcs: [
888 "IBatteryStats.cpp",
889 ],
890 export_include_dirs: ["include_batterystats"],
891 shared_libs: [
892 "libbinder",
893 "libutils",
894 ],
895}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000896
897cc_library {
898 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400899 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000900 srcs: [
901 "IProcessInfoService.cpp",
902 "ProcessInfoService.cpp",
903 ],
904 export_include_dirs: ["include_processinfo"],
905 shared_libs: [
906 "libbinder",
907 "libutils",
908 "liblog",
909 ],
910}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000911
Steven Moreland8a2085c2021-04-05 22:01:48 +0000912cc_library {
913 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000914 srcs: [
915 "ActivityManager.cpp",
916 "IActivityManager.cpp",
917 "IUidObserver.cpp",
918 ":activity_manager_procstate_aidl",
919 ],
920 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000921 shared_libs: [
922 "libbinder",
923 "libutils",
924 "liblog",
925 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000926 aidl: {
927 export_aidl_headers: true,
928 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000929}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700930
931cc_binary {
932 name: "servicedispatcher",
933 host_supported: false,
934 srcs: [
935 "servicedispatcher.cpp",
936 ],
937 shared_libs: [
938 "libbase",
939 "libbinder",
940 "liblog",
941 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -0700942 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -0700943 ],
944}