blob: 1abde5cb92d979a0a68b3022028c763bcc023f56 [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",
Parth Sane56a04712024-04-22 14:21:07 +0000445 "BackendUnifiedServiceManager.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000446 "IPCThreadState.cpp",
447 "IServiceManager.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000448 "IServiceManagerFFI.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000449 "ProcessState.cpp",
450 "Static.cpp",
451 ":libbinder_aidl",
452 ":libbinder_device_interface_sources",
453 ],
454 target: {
455 vendor: {
456 exclude_srcs: [
457 ":libbinder_device_interface_sources",
458 ],
459 },
460 host: {
461 srcs: [
462 "ServiceManagerHost.cpp",
463 ],
464 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900465 android: {
466 shared_libs: [
467 "libapexsupport",
468 "libvndksupport",
469 ],
470 },
471 recovery: {
472 exclude_shared_libs: [
473 "libapexsupport",
474 "libvndksupport",
475 ],
476 },
477 native_bridge: {
478 exclude_shared_libs: [
479 "libapexsupport",
480 "libvndksupport",
481 ],
482 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000483 },
484 cflags: [
485 "-DBINDER_WITH_KERNEL_IPC",
486 ],
487}
488
489cc_library {
490 name: "libbinder",
491 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000492 "libbinder_common_defaults",
493 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000494 "libbinder_kernel_defaults",
495 ],
496
497 version_script: "libbinder.map",
498
Andrei Homescuc485fa32023-02-22 19:45:26 +0000499 // for vndbinder
500 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000501 recovery_available: true,
502 double_loadable: true,
503 // TODO(b/153609531): remove when no longer needed.
504 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700505 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000506
507 // libbinder does not offer a stable wire protocol.
508 // if a second copy of it is installed, then it may break after security
509 // or dessert updates. Instead, apex users should use libbinder_ndk.
510 apex_available: [
511 "//apex_available:platform",
512 ],
513
514 srcs: [
515 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000516 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000517 "LazyServiceRegistrar.cpp",
518 "MemoryBase.cpp",
519 "MemoryDealer.cpp",
520 "MemoryHeapBase.cpp",
521 "ParcelableHolder.cpp",
522 "PersistableBundle.cpp",
523 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000524 target: {
525 android: {
526 // NOT static to keep the wire protocol unfrozen
527 static: {
528 enabled: false,
529 },
530 },
531 darwin: {
532 enabled: false,
533 },
534 recovery: {
535 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900536 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000537 ],
538 },
539 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800540
Yi Kong7cd72c52021-12-23 15:51:29 +0800541 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700542}
543
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700544cc_defaults {
545 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000546
547 cflags: [
548 "-DBINDER_ENABLE_LIBLOG_ASSERT",
549 "-DBINDER_DISABLE_NATIVE_HANDLE",
550 "-DBINDER_DISABLE_BLOB",
551 "-DBINDER_NO_LIBBASE",
552 ],
553
554 header_libs: [
555 "liblog_stub",
556 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700557}
558
559cc_defaults {
560 name: "libbinder_sdk_defaults",
561
562 cmake_snapshot_supported: true,
563
564 defaults: [
565 "libbinder_common_defaults",
566 "binder_sdk_defaults",
567 ],
568
569 shared_libs: [
570 "libutils_binder_sdk",
571 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000572
573 srcs: [
574 "OS_non_android_linux.cpp",
575 "OS_unix_base.cpp",
576 ],
577
578 visibility: [
579 ":__subpackages__",
580 ],
581
582 target: {
583 windows: {
584 enabled: false,
585 },
586 },
587}
588
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700589cc_library_host_shared {
590 name: "libbinder_sdk",
591 defaults: ["libbinder_sdk_defaults"],
592}
593
594cc_library_host_shared {
595 name: "libbinder_sdk_single_threaded",
596 defaults: ["libbinder_sdk_defaults"],
597 cflags: [
598 "-DBINDER_RPC_SINGLE_THREADED",
599 ],
600}
601
Steven Moreland52728212024-04-05 20:28:14 +0000602cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000603 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000604 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000605 defaults: [
606 "libbinder_common_defaults",
607 "libbinder_android_defaults",
608 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000609 visibility: [
610 ":__subpackages__",
611 ],
612}
613
Steven Moreland52728212024-04-05 20:28:14 +0000614cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000615 name: "libbinder_rpc_no_blob",
616 vendor_available: true,
617 defaults: [
618 "libbinder_common_defaults",
619 "libbinder_android_defaults",
620 "libbinder_kernel_defaults",
621 ],
622 cflags: [
623 "-DBINDER_DISABLE_BLOB",
624 ],
625 visibility: [
626 ":__subpackages__",
627 ],
628}
629
Steven Moreland52728212024-04-05 20:28:14 +0000630cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000631 name: "libbinder_rpc_no_native_handle",
632 vendor_available: true,
633 defaults: [
634 "libbinder_common_defaults",
635 "libbinder_android_defaults",
636 "libbinder_kernel_defaults",
637 ],
638 cflags: [
639 "-DBINDER_DISABLE_NATIVE_HANDLE",
640 ],
641 visibility: [
642 ":__subpackages__",
643 ],
644}
645
Steven Moreland52728212024-04-05 20:28:14 +0000646cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000647 name: "libbinder_rpc_single_threaded",
648 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000649 "libbinder_common_defaults",
650 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000651 "libbinder_kernel_defaults",
652 ],
653 cflags: [
654 "-DBINDER_RPC_SINGLE_THREADED",
655 ],
656 visibility: [
657 ":__subpackages__",
658 ],
659}
660
Steven Moreland52728212024-04-05 20:28:14 +0000661cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000662 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000663 defaults: [
664 "libbinder_common_defaults",
665 "libbinder_android_defaults",
666 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000667 cflags: [
668 "-DBINDER_RPC_SINGLE_THREADED",
669 ],
670 visibility: [
671 ":__subpackages__",
672 ],
673}
674
Yifan Honge8212f22021-06-28 15:49:08 -0700675cc_defaults {
676 name: "libbinder_tls_shared_deps",
677 shared_libs: [
678 "libbinder",
679 "libcrypto",
680 "liblog",
681 "libssl",
682 "libutils",
683 ],
684}
685
686cc_defaults {
687 name: "libbinder_tls_defaults",
688 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000689 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700690 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700691 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700692
693 header_libs: [
694 "libbinder_headers",
695 ],
696 export_header_lib_headers: [
697 "libbinder_headers",
698 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700699 export_shared_lib_headers: [
700 "libssl",
701 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700702 export_include_dirs: ["include_tls"],
703 static_libs: [
704 "libbase",
705 ],
706 srcs: [
707 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700708 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700709 ],
710}
711
712cc_library_shared {
713 name: "libbinder_tls",
714 defaults: ["libbinder_tls_defaults"],
715}
716
Andrei Homescud65666d2023-03-03 07:28:02 +0000717cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000718 name: "libbinder_trusty",
719 vendor: true,
720 srcs: [
721 "RpcTransportTipcAndroid.cpp",
722 "RpcTrusty.cpp",
723 ],
724
725 shared_libs: [
726 "libbinder",
727 "liblog",
728 "libtrusty",
729 "libutils",
730 ],
731 static_libs: [
732 "libbase",
733 ],
734 export_include_dirs: ["include_trusty"],
735
736 // Most of Android doesn't need this library and shouldn't use it,
737 // so we restrict its visibility to the Trusty-specific packages.
738 visibility: [
739 ":__subpackages__",
740 "//system/core/trusty:__subpackages__",
741 "//vendor:__subpackages__",
742 ],
743}
744
Yifan Hong92409752021-07-30 21:25:32 -0700745// For testing
746cc_library_static {
747 name: "libbinder_tls_static",
748 defaults: ["libbinder_tls_defaults"],
749 visibility: [
750 ":__subpackages__",
751 ],
752}
753
Colin Cross21c210e2017-11-14 13:05:37 -0800754// AIDL interface between libbinder and framework.jar
755filegroup {
756 name: "libbinder_aidl",
757 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000758 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700759 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700760 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700761 "aidl/android/os/IServiceManager.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000762 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800763 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700764 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800765}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700766
Samiul Islam4480b6f2021-08-26 11:41:49 +0100767aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000768 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100769 unstable: true,
770 local_include_dir: "aidl",
771 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000772 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000773 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100774 "aidl/android/content/pm/IStagedApexObserver.aidl",
775 "aidl/android/content/pm/ApexStagedEvent.aidl",
776 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000777 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900778 backend: {
779 rust: {
780 apex_available: [
781 "com.android.virt",
782 ],
783 enabled: true,
784 },
785 },
Steven Morelandf9514192021-03-26 01:34:55 +0000786}
787
Steven Moreland82c97cf2019-10-16 16:29:27 -0700788aidl_interface {
789 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900790 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700791 local_include_dir: "aidl",
792 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700793 vendor_available: true,
794 backend: {
795 java: {
796 enabled: false,
797 },
798 },
Steven Morelandae351c22023-02-13 22:01:00 +0000799 visibility: [
800 ":__subpackages__",
801 "//system/tools/aidl:__subpackages__",
802 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700803}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000804
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700805// TODO(b/184872979): remove once the Rust API is created.
806cc_library {
807 name: "libbinder_rpc_unstable",
808 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700809 shared_libs: [
810 "libbase",
811 "libbinder",
812 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000813 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700814 "libutils",
815 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900816 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700817
818 // enumerate stable entry points, for apex use
819 stubs: {
820 symbol_file: "libbinder_rpc_unstable.map.txt",
821 },
822
823 // This library is intentionally limited to these targets, and it will be removed later.
824 // Do not expand the visibility.
825 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000826 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000827 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000828 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Raphael Blisteinefc3f602023-02-16 16:12:05 +0000829 "//system/software_defined_vehicle:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900830 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700831 ],
832}
833
Steven Morelandea6bfab2021-04-01 00:10:31 +0000834// libbinder historically contained additional interfaces that provided specific
835// functionality in the platform but have nothing to do with binder itself. These
836// are moved out of libbinder in order to avoid the overhead of their vtables.
837// If you are working on or own one of these interfaces, the responsible things
838// to would be:
839// - give them a new home
840// - convert them to AIDL instead of having manually written parceling code
841
842cc_library {
843 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400844 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000845 srcs: [
846 "IBatteryStats.cpp",
847 ],
848 export_include_dirs: ["include_batterystats"],
849 shared_libs: [
850 "libbinder",
851 "libutils",
852 ],
853}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000854
855cc_library {
856 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400857 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000858 srcs: [
859 "IProcessInfoService.cpp",
860 "ProcessInfoService.cpp",
861 ],
862 export_include_dirs: ["include_processinfo"],
863 shared_libs: [
864 "libbinder",
865 "libutils",
866 "liblog",
867 ],
868}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000869
Steven Moreland8a2085c2021-04-05 22:01:48 +0000870cc_library {
871 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000872 srcs: [
873 "ActivityManager.cpp",
874 "IActivityManager.cpp",
875 "IUidObserver.cpp",
876 ":activity_manager_procstate_aidl",
877 ],
878 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000879 shared_libs: [
880 "libbinder",
881 "libutils",
882 "liblog",
883 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000884 aidl: {
885 export_aidl_headers: true,
886 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000887}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700888
889cc_binary {
890 name: "servicedispatcher",
891 host_supported: false,
892 srcs: [
893 "servicedispatcher.cpp",
894 ],
895 shared_libs: [
896 "libbase",
897 "libbinder",
898 "liblog",
899 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -0700900 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -0700901 ],
902}