blob: cb1d1143bc1e60a72675f494a2c8783737a7669e [file] [log] [blame]
Dan Willemsene05dc6d2016-07-25 17:13:45 -07001// Copyright (C) 2009 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Bob Badour3c538232021-02-12 21:26:48 -080015package {
16 // See: http://go/android-license-faq
17 // A large-scale-change added 'default_applicable_licenses' to import
18 // all of the 'license_kinds' from "frameworks_native_license"
19 // to get the below license kinds:
20 // SPDX-license-identifier-Apache-2.0
21 default_applicable_licenses: ["frameworks_native_license"],
22}
23
Vijay Venkatraman5583be72017-03-24 16:13:58 -070024cc_library_headers {
Steven Morelandb27aa332023-10-09 22:22:27 +000025 name: "libbinder_headers_base",
Vijay Venkatraman5583be72017-03-24 16:13:58 -070026 export_include_dirs: ["include"],
Jiyong Park172bd722017-06-21 12:14:18 +090027 vendor_available: true,
Yifan Hong70786532021-10-20 21:41:18 -070028 recovery_available: true,
Steven Moreland28723ae2019-04-01 18:52:30 -070029 host_supported: true,
Steven Morelandb27aa332023-10-09 22:22:27 +000030 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -070031 cmake_snapshot_supported: true,
Steven Morelandb27aa332023-10-09 22:22:27 +000032
33 header_libs: [
34 "libbinder_headers_platform_shared",
35 ],
36 export_header_lib_headers: [
37 "libbinder_headers_platform_shared",
38 ],
39 apex_available: [
40 "//apex_available:platform",
41 "com.android.media",
42 "com.android.media.swcodec",
43 ],
44 min_sdk_version: "29",
45 target: {
46 darwin: {
47 enabled: false,
48 },
49 },
50 visibility: [
51 ":__subpackages__",
52 ],
53}
54
55cc_library_headers {
56 name: "libbinder_headers",
57 vendor_available: true,
58 recovery_available: true,
59 host_supported: true,
Victor Khimenko38786ab2020-07-03 00:06:50 +020060 native_bridge_supported: true,
Steven Moreland28723ae2019-04-01 18:52:30 -070061
Jiyong Parkb7df6cb2017-04-13 21:19:48 -070062 header_libs: [
63 "libbase_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +000064 "libbinder_headers_base",
Jiyong Parkb7df6cb2017-04-13 21:19:48 -070065 "libcutils_headers",
66 "libutils_headers",
67 ],
68 export_header_lib_headers: [
69 "libbase_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +000070 "libbinder_headers_base",
Jiyong Parkb7df6cb2017-04-13 21:19:48 -070071 "libcutils_headers",
72 "libutils_headers",
73 ],
Jooyung Han5f6a89a2021-02-05 15:28:58 +090074 apex_available: [
75 "//apex_available:platform",
76 "com.android.media",
77 "com.android.media.swcodec",
78 ],
Jooyung Hana395c8d2020-04-16 18:48:32 +090079 min_sdk_version: "29",
Yifan Hongf856a982020-10-30 14:51:17 -070080 target: {
81 darwin: {
82 enabled: false,
83 },
84 },
Vijay Venkatraman5583be72017-03-24 16:13:58 -070085}
86
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -070087cc_cmake_snapshot {
88 name: "binder_sdk",
89 modules: [
90 "libbinder_sdk",
91 "libbinder_sdk_single_threaded",
92 "libbinder_ndk_sdk",
93 "binderRpcTestNoKernel",
94 ],
95 prebuilts: [
96 // to enable arm64 host support, build with musl - e.g. on aosp_cf_arm64_phone
97 "aidl",
98 "libc++",
99 ],
100 include_sources: true,
101 cflags: [
102 "-DNDEBUG",
103 "-DBINDER_ENABLE_LIBLOG_ASSERT",
104 "-DBINDER_DISABLE_NATIVE_HANDLE",
105 "-DBINDER_DISABLE_BLOB",
106 "-DBINDER_NO_LIBBASE",
107 "-DBINDER_NO_KERNEL_IPC_TESTING",
108
109 // from Soong's global.go commonGlobalCflags and noOverrideGlobalCflags
110 "-Wno-c99-designator",
111 "-Wno-missing-field-initializers",
112
113 // warnings that only pop up on gcc
114 "-Wno-unknown-pragmas", // "pragma clang"
115 "-Wno-attributes", // attributes on compound-statements
116 "-Wno-psabi", // reminders about old ABI changes
117 ],
118 cflags_ignored: [
119 // gcc requires all header constexprs to be used in all dependent compilatinon units
120 "-Wunused-const-variable",
121 ],
122 library_mapping: [
123 {
124 android_name: "libssl",
125 mapped_name: "ssl",
126 package_pregenerated: "external/boringssl",
127 },
128 {
129 android_name: "libcrypto",
130 mapped_name: "crypto",
131 package_pregenerated: "external/boringssl",
132 },
133 {
134 android_name: "libgtest",
135 mapped_name: "GTest::gtest",
136 package_system: "GTest",
137 },
138 {
139 android_name: "libgtest_main",
140 mapped_name: "GTest::gtest",
141 package_system: "GTest",
142 },
143
144 // use libbinder_sdk and friends instead of full Android's libbinder
145 {
146 android_name: "libbinder_rpc_no_kernel",
147 mapped_name: "android::libbinder_sdk",
148 },
149 {
150 android_name: "libbinder_rpc_single_threaded_no_kernel",
151 mapped_name: "android::libbinder_sdk_single_threaded",
152 },
153 {
154 android_name: "libbinder_headers",
155 mapped_name: "android::libbinder_headers_base",
156 },
157 {
158 android_name: "libbinder",
159 mapped_name: "android::libbinder_sdk",
160 },
161 {
162 android_name: "libbinder_ndk",
163 mapped_name: "android::libbinder_ndk_sdk",
164 },
165 {
166 android_name: "liblog",
167 mapped_name: "android::liblog_stub",
168 },
169
170 // explicitly included by Binder tests, but not needed outside of Android
171 {
172 android_name: "libbase",
173 },
174 {
175 android_name: "libcutils",
176 },
177 {
178 android_name: "libutils",
179 },
180
181 // disable tests that don't work outside of Android yet
182 {
183 android_name: "binder_rpc_test_service",
184 },
185 {
186 android_name: "binder_rpc_test_service_single_threaded",
187 },
188
189 // trusty mocks are artificially triggered and not needed outside of Android build
190 {
191 android_name: "libbinder_on_trusty_mock",
192 },
193 {
194 android_name: "libbinder_ndk_on_trusty_mock",
195 },
196 {
197 android_name: "binderRpcTestService_on_trusty_mock",
198 },
199 {
200 android_name: "binderRpcTest_on_trusty_mock",
201 },
202 ],
203}
204
Steven Moreland28723ae2019-04-01 18:52:30 -0700205// These interfaces are android-specific implementation unrelated to binder
206// transport itself and should be moved to AIDL or in domain-specific libs.
207//
208// Currently, these are only on system android (not vendor, not host)
Steven Morelandea6bfab2021-04-01 00:10:31 +0000209// TODO(b/183654927) - move these into separate libraries
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400210
211filegroup {
212 name: "libbinder_device_interface_sources",
213 srcs: [
214 "IPermissionController.cpp",
215 "PermissionCache.cpp",
216 "PermissionController.cpp",
217 ],
218}
Steven Moreland28723ae2019-04-01 18:52:30 -0700219
Andrei Homescu12106de2022-04-27 04:42:21 +0000220cc_defaults {
Andrei Homescu875996f2022-08-24 04:25:11 +0000221 name: "libbinder_common_defaults",
Steven Moreland28723ae2019-04-01 18:52:30 -0700222 host_supported: true,
223
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700224 srcs: [
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700225 "Binder.cpp",
226 "BpBinder.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700227 "Debug.cpp",
Yifan Hong8c950422021-08-05 17:13:55 -0700228 "FdTrigger.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700229 "IInterface.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700230 "IResultReceiver.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700231 "Parcel.cpp",
Ryo Hashimotobf551892018-05-31 16:58:35 +0900232 "ParcelFileDescriptor.cpp",
Fabián Cañas356a0222023-01-13 16:32:53 -0500233 "RecordedTransaction.cpp",
Steven Morelandbdb53ab2021-05-05 17:57:41 +0000234 "RpcSession.cpp",
Steven Moreland5553ac42020-11-11 02:14:45 +0000235 "RpcServer.cpp",
236 "RpcState.cpp",
Steven Morelandb27aa332023-10-09 22:22:27 +0000237 "RpcTransportRaw.cpp",
Steven Morelanda86a3562019-08-01 23:28:34 +0000238 "Stability.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700239 "Status.cpp",
240 "TextOutput.cpp",
Steven Morelandf183fdd2020-10-27 00:12:12 +0000241 "Utils.cpp",
Tomasz Wasilczyk26db5e42023-11-02 11:45:11 -0700242 "file.cpp",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100243 ],
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700244
Andrei Homescu875996f2022-08-24 04:25:11 +0000245 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000246 "libbinder_headers_base",
Andrei Homescu875996f2022-08-24 04:25:11 +0000247 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700248 export_header_lib_headers: [
249 "libbinder_headers_base",
250 ],
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800251
252 cflags: [
253 "-Wextra",
254 "-Wextra-semi",
255 "-Werror",
256 "-Wzero-as-null-pointer-constant",
257 "-Wreorder-init-list",
258 "-Wunused-const-variable",
259 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
260 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
261 ],
Andrei Homescu875996f2022-08-24 04:25:11 +0000262}
263
264cc_defaults {
265 name: "libbinder_android_defaults",
266
267 // TODO(b/31559095): get headers from bionic on host
268 include_dirs: [
269 "bionic/libc/kernel/android/uapi/",
270 "bionic/libc/kernel/uapi/",
271 ],
272
273 srcs: [
Tomasz Wasilczyk0d9dec22023-10-06 20:28:49 +0000274 "OS_android.cpp",
275 "OS_unix_base.cpp",
Andrei Homescu875996f2022-08-24 04:25:11 +0000276 ],
277
Jiyong Park47f876b2018-04-17 13:56:46 +0900278 target: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700279 host: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700280 srcs: [
281 "UtilsHost.cpp",
282 ],
283 },
Yi Kong60560432024-03-12 12:47:44 +0900284 android: {
285 lto: {
Jeongik Cha91486ee2024-03-12 19:35:12 +0900286 thin: true,
Yi Kong60560432024-03-12 12:47:44 +0900287 },
288 },
Jiyong Park47f876b2018-04-17 13:56:46 +0900289 },
290
Todd Kennedy757186e2017-08-02 07:49:20 -0700291 aidl: {
292 export_aidl_headers: true,
293 },
294
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700295 product_variables: {
Yifan Hong84bedeb2021-04-21 21:37:17 -0700296 debuggable: {
Sahil Somani2522b072022-08-08 14:07:47 -0700297 cflags: [
298 "-DBINDER_RPC_DEV_SERVERS",
299 "-DBINDER_ENABLE_RECORDING",
300 ],
Yifan Hong84bedeb2021-04-21 21:37:17 -0700301 },
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700302 },
303
304 shared_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000305 "libcutils",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700306 "liblog",
Steven Morelandb27aa332023-10-09 22:22:27 +0000307 "libutils",
308 ],
309
310 static_libs: [
311 "libbase",
Steven Moreland62129012021-07-29 12:14:44 -0700312 ],
313
Jiyong Park42842052017-06-20 13:51:22 +0900314 header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900315 "jni_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +0000316 "libbinder_headers",
Jiyong Park42842052017-06-20 13:51:22 +0900317 ],
318
Jiyong Park42842052017-06-20 13:51:22 +0900319 export_header_lib_headers: [
320 "libbinder_headers",
Dan Stozad630e522016-12-01 15:16:31 -0800321 ],
322
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700323 sanitize: {
324 misc_undefined: ["integer"],
325 },
Jiyong Park25265082020-11-13 16:58:57 +0900326
327 tidy: true,
328 tidy_flags: [
329 // Only check our headers
330 "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
331 ],
Steven Moreland525dd902021-04-22 23:00:04 +0000332 tidy_checks: [
333 "-performance-no-int-to-ptr",
334 ],
Jiyong Park25265082020-11-13 16:58:57 +0900335 tidy_checks_as_errors: [
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800336 // Explicitly list the checks that should not occur in this module.
337 "abseil-*",
338 "android-*",
339 "bugprone-*",
Chih-Hung Hsieh41366b42022-06-09 23:12:22 -0700340 "-bugprone-branch-clone", // b/155034972
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800341 "cert-*",
342 "clang-analyzer-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800343 "google-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800344 "misc-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800345 "performance*",
Steven Moreland67f85902023-03-15 01:13:49 +0000346 "-performance-move-const-arg", // b/273486801
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800347 "portability*",
Jiyong Park25265082020-11-13 16:58:57 +0900348 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000349}
350
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000351cc_library_headers {
352 name: "trusty_mock_headers",
353 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000354 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000355
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000356 export_include_dirs: [
357 "trusty/include",
358 "trusty/include_mock",
359 ],
360
361 visibility: [
362 ":__subpackages__",
363 ],
364}
365
366cc_defaults {
367 name: "trusty_mock_defaults",
Andrei Homescu4d9420e2023-01-31 01:38:48 +0000368 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000369 vendor_available: true,
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000370
371 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000372 "libbinder_headers_base",
Tomasz Wasilczykc7c22ea2023-11-30 20:13:44 -0800373 "liblog_stub",
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000374 "trusty_mock_headers",
Andrei Homescu875996f2022-08-24 04:25:11 +0000375 ],
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000376 export_header_lib_headers: [
377 "libbinder_headers_base",
378 "liblog_stub",
379 "trusty_mock_headers",
380 ],
Andrei Homescu875996f2022-08-24 04:25:11 +0000381
Steven Morelandb27aa332023-10-09 22:22:27 +0000382 shared_libs: [
383 "libutils_binder_sdk",
384 ],
385
Andrei Homescu875996f2022-08-24 04:25:11 +0000386 cflags: [
387 "-DBINDER_RPC_SINGLE_THREADED",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800388 "-DBINDER_ENABLE_LIBLOG_ASSERT",
Tomasz Wasilczykbe685c02023-11-30 20:20:53 -0800389 "-DBINDER_DISABLE_NATIVE_HANDLE",
390 "-DBINDER_DISABLE_BLOB",
391 "-DBINDER_NO_LIBBASE",
Steven Morelandd5beffc2023-12-15 21:58:38 +0000392 // TODO: switch to "vendor: true" rather than copying this
Andrei Homescu875996f2022-08-24 04:25:11 +0000393 // Trusty libbinder uses vendor stability for its binders
Steven Morelandd5beffc2023-12-15 21:58:38 +0000394 "-D__ANDROID_VENDOR__",
Andrei Homescu875996f2022-08-24 04:25:11 +0000395 "-D__ANDROID_VNDK__",
396 "-U__ANDROID__",
397 "-D__TRUSTY__",
398 "-DTRUSTY_USERSPACE",
399 // Flags from the Trusty build system
400 "-Werror",
401 "-Wsign-compare",
402 "-Wno-unused-function",
403 "-Wno-unused-label",
404 "-fno-common",
405 "-fno-omit-frame-pointer",
406 "-fno-threadsafe-statics",
407 ],
408 rtti: false,
409
Andrei Homescu875996f2022-08-24 04:25:11 +0000410 visibility: [
411 ":__subpackages__",
412 ],
413}
414
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000415cc_library_shared {
416 name: "libbinder_on_trusty_mock",
417 defaults: [
418 "libbinder_common_defaults",
419 "trusty_mock_defaults",
420 ],
421
422 srcs: [
423 // Trusty-specific files
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000424 "trusty/OS.cpp",
425 "trusty/RpcServerTrusty.cpp",
426 "trusty/RpcTransportTipcTrusty.cpp",
427 "trusty/TrustyStatus.cpp",
428 "trusty/socket.cpp",
429 ],
430}
431
Andrei Homescu12106de2022-04-27 04:42:21 +0000432cc_defaults {
433 name: "libbinder_kernel_defaults",
434 srcs: [
435 "BufferedTextOutput.cpp",
436 "IPCThreadState.cpp",
437 "IServiceManager.cpp",
438 "ProcessState.cpp",
439 "Static.cpp",
440 ":libbinder_aidl",
441 ":libbinder_device_interface_sources",
442 ],
443 target: {
444 vendor: {
445 exclude_srcs: [
446 ":libbinder_device_interface_sources",
447 ],
448 },
449 host: {
450 srcs: [
451 "ServiceManagerHost.cpp",
452 ],
453 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900454 android: {
455 shared_libs: [
456 "libapexsupport",
457 "libvndksupport",
458 ],
459 },
460 recovery: {
461 exclude_shared_libs: [
462 "libapexsupport",
463 "libvndksupport",
464 ],
465 },
466 native_bridge: {
467 exclude_shared_libs: [
468 "libapexsupport",
469 "libvndksupport",
470 ],
471 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000472 },
473 cflags: [
474 "-DBINDER_WITH_KERNEL_IPC",
475 ],
476}
477
478cc_library {
479 name: "libbinder",
480 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000481 "libbinder_common_defaults",
482 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000483 "libbinder_kernel_defaults",
484 ],
485
486 version_script: "libbinder.map",
487
Andrei Homescuc485fa32023-02-22 19:45:26 +0000488 // for vndbinder
489 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000490 recovery_available: true,
491 double_loadable: true,
492 // TODO(b/153609531): remove when no longer needed.
493 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700494 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000495
496 // libbinder does not offer a stable wire protocol.
497 // if a second copy of it is installed, then it may break after security
498 // or dessert updates. Instead, apex users should use libbinder_ndk.
499 apex_available: [
500 "//apex_available:platform",
501 ],
502
503 srcs: [
504 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000505 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000506 "LazyServiceRegistrar.cpp",
507 "MemoryBase.cpp",
508 "MemoryDealer.cpp",
509 "MemoryHeapBase.cpp",
510 "ParcelableHolder.cpp",
511 "PersistableBundle.cpp",
512 ],
513
514 target: {
515 android: {
516 // NOT static to keep the wire protocol unfrozen
517 static: {
518 enabled: false,
519 },
520 },
521 darwin: {
522 enabled: false,
523 },
524 recovery: {
525 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900526 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000527 ],
528 },
529 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800530
Yi Kong7cd72c52021-12-23 15:51:29 +0800531 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700532}
533
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700534cc_defaults {
535 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000536
537 cflags: [
538 "-DBINDER_ENABLE_LIBLOG_ASSERT",
539 "-DBINDER_DISABLE_NATIVE_HANDLE",
540 "-DBINDER_DISABLE_BLOB",
541 "-DBINDER_NO_LIBBASE",
542 ],
543
544 header_libs: [
545 "liblog_stub",
546 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700547}
548
549cc_defaults {
550 name: "libbinder_sdk_defaults",
551
552 cmake_snapshot_supported: true,
553
554 defaults: [
555 "libbinder_common_defaults",
556 "binder_sdk_defaults",
557 ],
558
559 shared_libs: [
560 "libutils_binder_sdk",
561 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000562
563 srcs: [
564 "OS_non_android_linux.cpp",
565 "OS_unix_base.cpp",
566 ],
567
568 visibility: [
569 ":__subpackages__",
570 ],
571
572 target: {
573 windows: {
574 enabled: false,
575 },
576 },
577}
578
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700579cc_library_host_shared {
580 name: "libbinder_sdk",
581 defaults: ["libbinder_sdk_defaults"],
582}
583
584cc_library_host_shared {
585 name: "libbinder_sdk_single_threaded",
586 defaults: ["libbinder_sdk_defaults"],
587 cflags: [
588 "-DBINDER_RPC_SINGLE_THREADED",
589 ],
590}
591
Steven Moreland52728212024-04-05 20:28:14 +0000592cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000593 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000594 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000595 defaults: [
596 "libbinder_common_defaults",
597 "libbinder_android_defaults",
598 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000599 visibility: [
600 ":__subpackages__",
601 ],
602}
603
Steven Moreland52728212024-04-05 20:28:14 +0000604cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000605 name: "libbinder_rpc_no_blob",
606 vendor_available: true,
607 defaults: [
608 "libbinder_common_defaults",
609 "libbinder_android_defaults",
610 "libbinder_kernel_defaults",
611 ],
612 cflags: [
613 "-DBINDER_DISABLE_BLOB",
614 ],
615 visibility: [
616 ":__subpackages__",
617 ],
618}
619
Steven Moreland52728212024-04-05 20:28:14 +0000620cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000621 name: "libbinder_rpc_no_native_handle",
622 vendor_available: true,
623 defaults: [
624 "libbinder_common_defaults",
625 "libbinder_android_defaults",
626 "libbinder_kernel_defaults",
627 ],
628 cflags: [
629 "-DBINDER_DISABLE_NATIVE_HANDLE",
630 ],
631 visibility: [
632 ":__subpackages__",
633 ],
634}
635
Steven Moreland52728212024-04-05 20:28:14 +0000636cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000637 name: "libbinder_rpc_single_threaded",
638 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000639 "libbinder_common_defaults",
640 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000641 "libbinder_kernel_defaults",
642 ],
643 cflags: [
644 "-DBINDER_RPC_SINGLE_THREADED",
645 ],
646 visibility: [
647 ":__subpackages__",
648 ],
649}
650
Steven Moreland52728212024-04-05 20:28:14 +0000651cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000652 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000653 defaults: [
654 "libbinder_common_defaults",
655 "libbinder_android_defaults",
656 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000657 cflags: [
658 "-DBINDER_RPC_SINGLE_THREADED",
659 ],
660 visibility: [
661 ":__subpackages__",
662 ],
663}
664
Yifan Honge8212f22021-06-28 15:49:08 -0700665cc_defaults {
666 name: "libbinder_tls_shared_deps",
667 shared_libs: [
668 "libbinder",
669 "libcrypto",
670 "liblog",
671 "libssl",
672 "libutils",
673 ],
674}
675
676cc_defaults {
677 name: "libbinder_tls_defaults",
678 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000679 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700680 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700681 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700682
683 header_libs: [
684 "libbinder_headers",
685 ],
686 export_header_lib_headers: [
687 "libbinder_headers",
688 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700689 export_shared_lib_headers: [
690 "libssl",
691 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700692 export_include_dirs: ["include_tls"],
693 static_libs: [
694 "libbase",
695 ],
696 srcs: [
697 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700698 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700699 ],
700}
701
702cc_library_shared {
703 name: "libbinder_tls",
704 defaults: ["libbinder_tls_defaults"],
705}
706
Andrei Homescud65666d2023-03-03 07:28:02 +0000707cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000708 name: "libbinder_trusty",
709 vendor: true,
710 srcs: [
711 "RpcTransportTipcAndroid.cpp",
712 "RpcTrusty.cpp",
713 ],
714
715 shared_libs: [
716 "libbinder",
717 "liblog",
718 "libtrusty",
719 "libutils",
720 ],
721 static_libs: [
722 "libbase",
723 ],
724 export_include_dirs: ["include_trusty"],
725
726 // Most of Android doesn't need this library and shouldn't use it,
727 // so we restrict its visibility to the Trusty-specific packages.
728 visibility: [
729 ":__subpackages__",
730 "//system/core/trusty:__subpackages__",
731 "//vendor:__subpackages__",
732 ],
733}
734
Yifan Hong92409752021-07-30 21:25:32 -0700735// For testing
736cc_library_static {
737 name: "libbinder_tls_static",
738 defaults: ["libbinder_tls_defaults"],
739 visibility: [
740 ":__subpackages__",
741 ],
742}
743
Colin Cross21c210e2017-11-14 13:05:37 -0800744// AIDL interface between libbinder and framework.jar
745filegroup {
746 name: "libbinder_aidl",
747 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000748 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700749 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700750 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700751 "aidl/android/os/IServiceManager.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000752 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800753 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700754 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800755}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700756
Samiul Islam4480b6f2021-08-26 11:41:49 +0100757aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000758 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100759 unstable: true,
760 local_include_dir: "aidl",
761 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000762 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000763 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100764 "aidl/android/content/pm/IStagedApexObserver.aidl",
765 "aidl/android/content/pm/ApexStagedEvent.aidl",
766 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000767 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900768 backend: {
769 rust: {
770 apex_available: [
771 "com.android.virt",
772 ],
773 enabled: true,
774 },
775 },
Steven Morelandf9514192021-03-26 01:34:55 +0000776}
777
Steven Moreland82c97cf2019-10-16 16:29:27 -0700778aidl_interface {
779 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900780 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700781 local_include_dir: "aidl",
782 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700783 vendor_available: true,
784 backend: {
785 java: {
786 enabled: false,
787 },
788 },
Steven Morelandae351c22023-02-13 22:01:00 +0000789 visibility: [
790 ":__subpackages__",
791 "//system/tools/aidl:__subpackages__",
792 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700793}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000794
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700795// TODO(b/184872979): remove once the Rust API is created.
796cc_library {
797 name: "libbinder_rpc_unstable",
798 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700799 shared_libs: [
800 "libbase",
801 "libbinder",
802 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000803 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700804 "libutils",
805 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900806 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700807
808 // enumerate stable entry points, for apex use
809 stubs: {
810 symbol_file: "libbinder_rpc_unstable.map.txt",
811 },
812
813 // This library is intentionally limited to these targets, and it will be removed later.
814 // Do not expand the visibility.
815 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000816 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000817 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000818 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Raphael Blisteinefc3f602023-02-16 16:12:05 +0000819 "//system/software_defined_vehicle:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900820 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700821 ],
822}
823
Steven Morelandea6bfab2021-04-01 00:10:31 +0000824// libbinder historically contained additional interfaces that provided specific
825// functionality in the platform but have nothing to do with binder itself. These
826// are moved out of libbinder in order to avoid the overhead of their vtables.
827// If you are working on or own one of these interfaces, the responsible things
828// to would be:
829// - give them a new home
830// - convert them to AIDL instead of having manually written parceling code
831
832cc_library {
833 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400834 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000835 srcs: [
836 "IBatteryStats.cpp",
837 ],
838 export_include_dirs: ["include_batterystats"],
839 shared_libs: [
840 "libbinder",
841 "libutils",
842 ],
843}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000844
845cc_library {
846 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400847 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000848 srcs: [
849 "IProcessInfoService.cpp",
850 "ProcessInfoService.cpp",
851 ],
852 export_include_dirs: ["include_processinfo"],
853 shared_libs: [
854 "libbinder",
855 "libutils",
856 "liblog",
857 ],
858}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000859
Steven Moreland8a2085c2021-04-05 22:01:48 +0000860cc_library {
861 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000862 srcs: [
863 "ActivityManager.cpp",
864 "IActivityManager.cpp",
865 "IUidObserver.cpp",
866 ":activity_manager_procstate_aidl",
867 ],
868 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000869 shared_libs: [
870 "libbinder",
871 "libutils",
872 "liblog",
873 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000874 aidl: {
875 export_aidl_headers: true,
876 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000877}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700878
879cc_binary {
880 name: "servicedispatcher",
881 host_supported: false,
882 srcs: [
883 "servicedispatcher.cpp",
884 ],
885 shared_libs: [
886 "libbase",
887 "libbinder",
888 "liblog",
889 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -0700890 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -0700891 ],
Tomasz Wasilczyk26db5e42023-11-02 11:45:11 -0700892 static_libs: [
893 "libc++fs",
894 ],
Yifan Hongdbf58d42021-06-03 19:21:11 -0700895}