blob: f31f8d3993bd364b19dfdac3b442158ed246b674 [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",
90 modules: [
91 "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",
103 "libc++",
104 ],
105 include_sources: true,
106 cflags: [
107 "-DNDEBUG",
108 "-DBINDER_ENABLE_LIBLOG_ASSERT",
109 "-DBINDER_DISABLE_NATIVE_HANDLE",
110 "-DBINDER_DISABLE_BLOB",
111 "-DBINDER_NO_LIBBASE",
112 "-DBINDER_NO_KERNEL_IPC_TESTING",
113
114 // from Soong's global.go commonGlobalCflags and noOverrideGlobalCflags
115 "-Wno-c99-designator",
116 "-Wno-missing-field-initializers",
117
118 // warnings that only pop up on gcc
119 "-Wno-unknown-pragmas", // "pragma clang"
120 "-Wno-attributes", // attributes on compound-statements
121 "-Wno-psabi", // reminders about old ABI changes
122 ],
123 cflags_ignored: [
124 // gcc requires all header constexprs to be used in all dependent compilatinon units
125 "-Wunused-const-variable",
126 ],
127 library_mapping: [
128 {
129 android_name: "libssl",
130 mapped_name: "ssl",
131 package_pregenerated: "external/boringssl",
132 },
133 {
134 android_name: "libcrypto",
135 mapped_name: "crypto",
136 package_pregenerated: "external/boringssl",
137 },
138 {
139 android_name: "libgtest",
140 mapped_name: "GTest::gtest",
Tomasz Wasilczyke2836312024-05-09 14:36:19 -0700141 package_pregenerated: "external/googletest",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700142 },
143 {
144 android_name: "libgtest_main",
Tomasz Wasilczyke2836312024-05-09 14:36:19 -0700145 mapped_name: "GTest::gtest_main",
146 package_pregenerated: "external/googletest",
147 },
148 {
149 android_name: "googletest_cmake",
150 package_pregenerated: "external/googletest",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700151 },
152
153 // use libbinder_sdk and friends instead of full Android's libbinder
154 {
155 android_name: "libbinder_rpc_no_kernel",
156 mapped_name: "android::libbinder_sdk",
157 },
158 {
159 android_name: "libbinder_rpc_single_threaded_no_kernel",
160 mapped_name: "android::libbinder_sdk_single_threaded",
161 },
162 {
163 android_name: "libbinder_headers",
164 mapped_name: "android::libbinder_headers_base",
165 },
166 {
167 android_name: "libbinder",
168 mapped_name: "android::libbinder_sdk",
169 },
170 {
171 android_name: "libbinder_ndk",
172 mapped_name: "android::libbinder_ndk_sdk",
173 },
174 {
175 android_name: "liblog",
176 mapped_name: "android::liblog_stub",
177 },
178
179 // explicitly included by Binder tests, but not needed outside of Android
180 {
181 android_name: "libbase",
182 },
183 {
184 android_name: "libcutils",
185 },
186 {
187 android_name: "libutils",
188 },
189
190 // disable tests that don't work outside of Android yet
191 {
192 android_name: "binder_rpc_test_service",
193 },
194 {
195 android_name: "binder_rpc_test_service_single_threaded",
196 },
197
198 // trusty mocks are artificially triggered and not needed outside of Android build
199 {
200 android_name: "libbinder_on_trusty_mock",
201 },
202 {
203 android_name: "libbinder_ndk_on_trusty_mock",
204 },
205 {
206 android_name: "binderRpcTestService_on_trusty_mock",
207 },
208 {
209 android_name: "binderRpcTest_on_trusty_mock",
210 },
211 ],
212}
213
Steven Moreland28723ae2019-04-01 18:52:30 -0700214// These interfaces are android-specific implementation unrelated to binder
215// transport itself and should be moved to AIDL or in domain-specific libs.
216//
217// Currently, these are only on system android (not vendor, not host)
Steven Morelandea6bfab2021-04-01 00:10:31 +0000218// TODO(b/183654927) - move these into separate libraries
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400219
220filegroup {
221 name: "libbinder_device_interface_sources",
222 srcs: [
223 "IPermissionController.cpp",
224 "PermissionCache.cpp",
225 "PermissionController.cpp",
226 ],
227}
Steven Moreland28723ae2019-04-01 18:52:30 -0700228
Andrei Homescu12106de2022-04-27 04:42:21 +0000229cc_defaults {
Andrei Homescu875996f2022-08-24 04:25:11 +0000230 name: "libbinder_common_defaults",
Steven Moreland28723ae2019-04-01 18:52:30 -0700231 host_supported: true,
232
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700233 srcs: [
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700234 "Binder.cpp",
235 "BpBinder.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700236 "Debug.cpp",
Yifan Hong8c950422021-08-05 17:13:55 -0700237 "FdTrigger.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700238 "IInterface.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700239 "IResultReceiver.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700240 "Parcel.cpp",
Ryo Hashimotobf551892018-05-31 16:58:35 +0900241 "ParcelFileDescriptor.cpp",
Fabián Cañas356a0222023-01-13 16:32:53 -0500242 "RecordedTransaction.cpp",
Steven Morelandbdb53ab2021-05-05 17:57:41 +0000243 "RpcSession.cpp",
Steven Moreland5553ac42020-11-11 02:14:45 +0000244 "RpcServer.cpp",
245 "RpcState.cpp",
Steven Morelandb27aa332023-10-09 22:22:27 +0000246 "RpcTransportRaw.cpp",
Steven Morelanda86a3562019-08-01 23:28:34 +0000247 "Stability.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700248 "Status.cpp",
249 "TextOutput.cpp",
Steven Morelandf183fdd2020-10-27 00:12:12 +0000250 "Utils.cpp",
Tomasz Wasilczyk26db5e42023-11-02 11:45:11 -0700251 "file.cpp",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100252 ],
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700253
Andrei Homescu875996f2022-08-24 04:25:11 +0000254 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000255 "libbinder_headers_base",
Andrei Homescu875996f2022-08-24 04:25:11 +0000256 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700257 export_header_lib_headers: [
258 "libbinder_headers_base",
259 ],
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800260
261 cflags: [
262 "-Wextra",
263 "-Wextra-semi",
264 "-Werror",
265 "-Wzero-as-null-pointer-constant",
266 "-Wreorder-init-list",
267 "-Wunused-const-variable",
268 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
269 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
270 ],
Andrei Homescu875996f2022-08-24 04:25:11 +0000271}
272
273cc_defaults {
274 name: "libbinder_android_defaults",
275
276 // TODO(b/31559095): get headers from bionic on host
277 include_dirs: [
278 "bionic/libc/kernel/android/uapi/",
279 "bionic/libc/kernel/uapi/",
280 ],
281
282 srcs: [
Tomasz Wasilczyk0d9dec22023-10-06 20:28:49 +0000283 "OS_android.cpp",
284 "OS_unix_base.cpp",
Andrei Homescu875996f2022-08-24 04:25:11 +0000285 ],
286
Jiyong Park47f876b2018-04-17 13:56:46 +0900287 target: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700288 host: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700289 srcs: [
290 "UtilsHost.cpp",
291 ],
292 },
Yi Kong60560432024-03-12 12:47:44 +0900293 android: {
294 lto: {
Jeongik Cha91486ee2024-03-12 19:35:12 +0900295 thin: true,
Yi Kong60560432024-03-12 12:47:44 +0900296 },
297 },
Jiyong Park47f876b2018-04-17 13:56:46 +0900298 },
299
Todd Kennedy757186e2017-08-02 07:49:20 -0700300 aidl: {
301 export_aidl_headers: true,
302 },
303
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700304 product_variables: {
Yifan Hong84bedeb2021-04-21 21:37:17 -0700305 debuggable: {
Sahil Somani2522b072022-08-08 14:07:47 -0700306 cflags: [
307 "-DBINDER_RPC_DEV_SERVERS",
308 "-DBINDER_ENABLE_RECORDING",
309 ],
Yifan Hong84bedeb2021-04-21 21:37:17 -0700310 },
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700311 },
312
313 shared_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000314 "libcutils",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700315 "liblog",
Steven Morelandb27aa332023-10-09 22:22:27 +0000316 "libutils",
317 ],
318
319 static_libs: [
320 "libbase",
Steven Moreland62129012021-07-29 12:14:44 -0700321 ],
322
Jiyong Park42842052017-06-20 13:51:22 +0900323 header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900324 "jni_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +0000325 "libbinder_headers",
Jiyong Park42842052017-06-20 13:51:22 +0900326 ],
327
Jiyong Park42842052017-06-20 13:51:22 +0900328 export_header_lib_headers: [
329 "libbinder_headers",
Dan Stozad630e522016-12-01 15:16:31 -0800330 ],
331
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700332 sanitize: {
333 misc_undefined: ["integer"],
334 },
Jiyong Park25265082020-11-13 16:58:57 +0900335
336 tidy: true,
337 tidy_flags: [
338 // Only check our headers
339 "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
340 ],
Steven Moreland525dd902021-04-22 23:00:04 +0000341 tidy_checks: [
342 "-performance-no-int-to-ptr",
343 ],
Jiyong Park25265082020-11-13 16:58:57 +0900344 tidy_checks_as_errors: [
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800345 // Explicitly list the checks that should not occur in this module.
346 "abseil-*",
347 "android-*",
348 "bugprone-*",
Chih-Hung Hsieh41366b42022-06-09 23:12:22 -0700349 "-bugprone-branch-clone", // b/155034972
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800350 "cert-*",
351 "clang-analyzer-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800352 "google-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800353 "misc-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800354 "performance*",
Steven Moreland67f85902023-03-15 01:13:49 +0000355 "-performance-move-const-arg", // b/273486801
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800356 "portability*",
Jiyong Park25265082020-11-13 16:58:57 +0900357 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000358}
359
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000360cc_library_headers {
361 name: "trusty_mock_headers",
362 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000363 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000364
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000365 export_include_dirs: [
366 "trusty/include",
367 "trusty/include_mock",
368 ],
369
370 visibility: [
371 ":__subpackages__",
372 ],
373}
374
375cc_defaults {
376 name: "trusty_mock_defaults",
Andrei Homescu4d9420e2023-01-31 01:38:48 +0000377 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000378 vendor_available: true,
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000379
380 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000381 "libbinder_headers_base",
Tomasz Wasilczykc7c22ea2023-11-30 20:13:44 -0800382 "liblog_stub",
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000383 "trusty_mock_headers",
Andrei Homescu875996f2022-08-24 04:25:11 +0000384 ],
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000385 export_header_lib_headers: [
386 "libbinder_headers_base",
387 "liblog_stub",
388 "trusty_mock_headers",
389 ],
Andrei Homescu875996f2022-08-24 04:25:11 +0000390
Steven Morelandb27aa332023-10-09 22:22:27 +0000391 shared_libs: [
392 "libutils_binder_sdk",
393 ],
394
Andrei Homescu875996f2022-08-24 04:25:11 +0000395 cflags: [
396 "-DBINDER_RPC_SINGLE_THREADED",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800397 "-DBINDER_ENABLE_LIBLOG_ASSERT",
Tomasz Wasilczykbe685c02023-11-30 20:20:53 -0800398 "-DBINDER_DISABLE_NATIVE_HANDLE",
399 "-DBINDER_DISABLE_BLOB",
400 "-DBINDER_NO_LIBBASE",
Steven Morelandd5beffc2023-12-15 21:58:38 +0000401 // TODO: switch to "vendor: true" rather than copying this
Andrei Homescu875996f2022-08-24 04:25:11 +0000402 // Trusty libbinder uses vendor stability for its binders
Steven Morelandd5beffc2023-12-15 21:58:38 +0000403 "-D__ANDROID_VENDOR__",
Andrei Homescu875996f2022-08-24 04:25:11 +0000404 "-D__ANDROID_VNDK__",
405 "-U__ANDROID__",
406 "-D__TRUSTY__",
407 "-DTRUSTY_USERSPACE",
408 // Flags from the Trusty build system
409 "-Werror",
410 "-Wsign-compare",
411 "-Wno-unused-function",
412 "-Wno-unused-label",
413 "-fno-common",
414 "-fno-omit-frame-pointer",
415 "-fno-threadsafe-statics",
416 ],
417 rtti: false,
418
Andrei Homescu875996f2022-08-24 04:25:11 +0000419 visibility: [
420 ":__subpackages__",
421 ],
422}
423
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000424cc_library_shared {
425 name: "libbinder_on_trusty_mock",
426 defaults: [
427 "libbinder_common_defaults",
428 "trusty_mock_defaults",
429 ],
430
431 srcs: [
432 // Trusty-specific files
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000433 "trusty/OS.cpp",
434 "trusty/RpcServerTrusty.cpp",
435 "trusty/RpcTransportTipcTrusty.cpp",
436 "trusty/TrustyStatus.cpp",
437 "trusty/socket.cpp",
438 ],
439}
440
Andrei Homescu12106de2022-04-27 04:42:21 +0000441cc_defaults {
442 name: "libbinder_kernel_defaults",
443 srcs: [
444 "BufferedTextOutput.cpp",
445 "IPCThreadState.cpp",
446 "IServiceManager.cpp",
447 "ProcessState.cpp",
448 "Static.cpp",
449 ":libbinder_aidl",
450 ":libbinder_device_interface_sources",
451 ],
452 target: {
453 vendor: {
454 exclude_srcs: [
455 ":libbinder_device_interface_sources",
456 ],
457 },
458 host: {
459 srcs: [
460 "ServiceManagerHost.cpp",
461 ],
462 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900463 android: {
464 shared_libs: [
465 "libapexsupport",
466 "libvndksupport",
467 ],
468 },
469 recovery: {
470 exclude_shared_libs: [
471 "libapexsupport",
472 "libvndksupport",
473 ],
474 },
475 native_bridge: {
476 exclude_shared_libs: [
477 "libapexsupport",
478 "libvndksupport",
479 ],
480 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000481 },
482 cflags: [
483 "-DBINDER_WITH_KERNEL_IPC",
484 ],
485}
486
487cc_library {
488 name: "libbinder",
489 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000490 "libbinder_common_defaults",
491 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000492 "libbinder_kernel_defaults",
493 ],
494
495 version_script: "libbinder.map",
496
Andrei Homescuc485fa32023-02-22 19:45:26 +0000497 // for vndbinder
498 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000499 recovery_available: true,
500 double_loadable: true,
501 // TODO(b/153609531): remove when no longer needed.
502 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700503 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000504
505 // libbinder does not offer a stable wire protocol.
506 // if a second copy of it is installed, then it may break after security
507 // or dessert updates. Instead, apex users should use libbinder_ndk.
508 apex_available: [
509 "//apex_available:platform",
510 ],
511
512 srcs: [
513 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000514 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000515 "LazyServiceRegistrar.cpp",
516 "MemoryBase.cpp",
517 "MemoryDealer.cpp",
518 "MemoryHeapBase.cpp",
519 "ParcelableHolder.cpp",
520 "PersistableBundle.cpp",
521 ],
522
523 target: {
524 android: {
525 // NOT static to keep the wire protocol unfrozen
526 static: {
527 enabled: false,
528 },
529 },
530 darwin: {
531 enabled: false,
532 },
533 recovery: {
534 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900535 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000536 ],
537 },
538 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800539
Yi Kong7cd72c52021-12-23 15:51:29 +0800540 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700541}
542
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700543cc_defaults {
544 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000545
546 cflags: [
547 "-DBINDER_ENABLE_LIBLOG_ASSERT",
548 "-DBINDER_DISABLE_NATIVE_HANDLE",
549 "-DBINDER_DISABLE_BLOB",
550 "-DBINDER_NO_LIBBASE",
551 ],
552
553 header_libs: [
554 "liblog_stub",
555 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700556}
557
558cc_defaults {
559 name: "libbinder_sdk_defaults",
560
561 cmake_snapshot_supported: true,
562
563 defaults: [
564 "libbinder_common_defaults",
565 "binder_sdk_defaults",
566 ],
567
568 shared_libs: [
569 "libutils_binder_sdk",
570 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000571
572 srcs: [
573 "OS_non_android_linux.cpp",
574 "OS_unix_base.cpp",
575 ],
576
577 visibility: [
578 ":__subpackages__",
579 ],
580
581 target: {
582 windows: {
583 enabled: false,
584 },
585 },
586}
587
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700588cc_library_host_shared {
589 name: "libbinder_sdk",
590 defaults: ["libbinder_sdk_defaults"],
591}
592
593cc_library_host_shared {
594 name: "libbinder_sdk_single_threaded",
595 defaults: ["libbinder_sdk_defaults"],
596 cflags: [
597 "-DBINDER_RPC_SINGLE_THREADED",
598 ],
599}
600
Steven Moreland52728212024-04-05 20:28:14 +0000601cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000602 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000603 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000604 defaults: [
605 "libbinder_common_defaults",
606 "libbinder_android_defaults",
607 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000608 visibility: [
609 ":__subpackages__",
610 ],
611}
612
Steven Moreland52728212024-04-05 20:28:14 +0000613cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000614 name: "libbinder_rpc_no_blob",
615 vendor_available: true,
616 defaults: [
617 "libbinder_common_defaults",
618 "libbinder_android_defaults",
619 "libbinder_kernel_defaults",
620 ],
621 cflags: [
622 "-DBINDER_DISABLE_BLOB",
623 ],
624 visibility: [
625 ":__subpackages__",
626 ],
627}
628
Steven Moreland52728212024-04-05 20:28:14 +0000629cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000630 name: "libbinder_rpc_no_native_handle",
631 vendor_available: true,
632 defaults: [
633 "libbinder_common_defaults",
634 "libbinder_android_defaults",
635 "libbinder_kernel_defaults",
636 ],
637 cflags: [
638 "-DBINDER_DISABLE_NATIVE_HANDLE",
639 ],
640 visibility: [
641 ":__subpackages__",
642 ],
643}
644
Steven Moreland52728212024-04-05 20:28:14 +0000645cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000646 name: "libbinder_rpc_single_threaded",
647 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000648 "libbinder_common_defaults",
649 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000650 "libbinder_kernel_defaults",
651 ],
652 cflags: [
653 "-DBINDER_RPC_SINGLE_THREADED",
654 ],
655 visibility: [
656 ":__subpackages__",
657 ],
658}
659
Steven Moreland52728212024-04-05 20:28:14 +0000660cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000661 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000662 defaults: [
663 "libbinder_common_defaults",
664 "libbinder_android_defaults",
665 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000666 cflags: [
667 "-DBINDER_RPC_SINGLE_THREADED",
668 ],
669 visibility: [
670 ":__subpackages__",
671 ],
672}
673
Yifan Honge8212f22021-06-28 15:49:08 -0700674cc_defaults {
675 name: "libbinder_tls_shared_deps",
676 shared_libs: [
677 "libbinder",
678 "libcrypto",
679 "liblog",
680 "libssl",
681 "libutils",
682 ],
683}
684
685cc_defaults {
686 name: "libbinder_tls_defaults",
687 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000688 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700689 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700690 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700691
692 header_libs: [
693 "libbinder_headers",
694 ],
695 export_header_lib_headers: [
696 "libbinder_headers",
697 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700698 export_shared_lib_headers: [
699 "libssl",
700 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700701 export_include_dirs: ["include_tls"],
702 static_libs: [
703 "libbase",
704 ],
705 srcs: [
706 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700707 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700708 ],
709}
710
711cc_library_shared {
712 name: "libbinder_tls",
713 defaults: ["libbinder_tls_defaults"],
714}
715
Andrei Homescud65666d2023-03-03 07:28:02 +0000716cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000717 name: "libbinder_trusty",
718 vendor: true,
719 srcs: [
720 "RpcTransportTipcAndroid.cpp",
721 "RpcTrusty.cpp",
722 ],
723
724 shared_libs: [
725 "libbinder",
726 "liblog",
727 "libtrusty",
728 "libutils",
729 ],
730 static_libs: [
731 "libbase",
732 ],
733 export_include_dirs: ["include_trusty"],
734
735 // Most of Android doesn't need this library and shouldn't use it,
736 // so we restrict its visibility to the Trusty-specific packages.
737 visibility: [
738 ":__subpackages__",
739 "//system/core/trusty:__subpackages__",
740 "//vendor:__subpackages__",
741 ],
742}
743
Yifan Hong92409752021-07-30 21:25:32 -0700744// For testing
745cc_library_static {
746 name: "libbinder_tls_static",
747 defaults: ["libbinder_tls_defaults"],
748 visibility: [
749 ":__subpackages__",
750 ],
751}
752
Colin Cross21c210e2017-11-14 13:05:37 -0800753// AIDL interface between libbinder and framework.jar
754filegroup {
755 name: "libbinder_aidl",
756 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000757 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700758 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700759 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700760 "aidl/android/os/IServiceManager.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000761 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800762 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700763 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800764}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700765
Samiul Islam4480b6f2021-08-26 11:41:49 +0100766aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000767 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100768 unstable: true,
769 local_include_dir: "aidl",
770 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000771 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000772 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100773 "aidl/android/content/pm/IStagedApexObserver.aidl",
774 "aidl/android/content/pm/ApexStagedEvent.aidl",
775 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000776 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900777 backend: {
778 rust: {
779 apex_available: [
780 "com.android.virt",
781 ],
782 enabled: true,
783 },
784 },
Steven Morelandf9514192021-03-26 01:34:55 +0000785}
786
Steven Moreland82c97cf2019-10-16 16:29:27 -0700787aidl_interface {
788 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900789 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700790 local_include_dir: "aidl",
791 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700792 vendor_available: true,
793 backend: {
794 java: {
795 enabled: false,
796 },
797 },
Steven Morelandae351c22023-02-13 22:01:00 +0000798 visibility: [
799 ":__subpackages__",
800 "//system/tools/aidl:__subpackages__",
801 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700802}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000803
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700804// TODO(b/184872979): remove once the Rust API is created.
805cc_library {
806 name: "libbinder_rpc_unstable",
807 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700808 shared_libs: [
809 "libbase",
810 "libbinder",
811 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000812 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700813 "libutils",
814 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900815 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700816
817 // enumerate stable entry points, for apex use
818 stubs: {
819 symbol_file: "libbinder_rpc_unstable.map.txt",
820 },
821
822 // This library is intentionally limited to these targets, and it will be removed later.
823 // Do not expand the visibility.
824 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000825 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000826 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000827 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Raphael Blisteinefc3f602023-02-16 16:12:05 +0000828 "//system/software_defined_vehicle:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900829 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700830 ],
831}
832
Steven Morelandea6bfab2021-04-01 00:10:31 +0000833// libbinder historically contained additional interfaces that provided specific
834// functionality in the platform but have nothing to do with binder itself. These
835// are moved out of libbinder in order to avoid the overhead of their vtables.
836// If you are working on or own one of these interfaces, the responsible things
837// to would be:
838// - give them a new home
839// - convert them to AIDL instead of having manually written parceling code
840
841cc_library {
842 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400843 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000844 srcs: [
845 "IBatteryStats.cpp",
846 ],
847 export_include_dirs: ["include_batterystats"],
848 shared_libs: [
849 "libbinder",
850 "libutils",
851 ],
852}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000853
854cc_library {
855 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400856 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000857 srcs: [
858 "IProcessInfoService.cpp",
859 "ProcessInfoService.cpp",
860 ],
861 export_include_dirs: ["include_processinfo"],
862 shared_libs: [
863 "libbinder",
864 "libutils",
865 "liblog",
866 ],
867}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000868
Steven Moreland8a2085c2021-04-05 22:01:48 +0000869cc_library {
870 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000871 srcs: [
872 "ActivityManager.cpp",
873 "IActivityManager.cpp",
874 "IUidObserver.cpp",
875 ":activity_manager_procstate_aidl",
876 ],
877 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000878 shared_libs: [
879 "libbinder",
880 "libutils",
881 "liblog",
882 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000883 aidl: {
884 export_aidl_headers: true,
885 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000886}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700887
888cc_binary {
889 name: "servicedispatcher",
890 host_supported: false,
891 srcs: [
892 "servicedispatcher.cpp",
893 ],
894 shared_libs: [
895 "libbase",
896 "libbinder",
897 "liblog",
898 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -0700899 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -0700900 ],
901}