blob: 80720b00857905fb97cf6ab6984b24d5671445d3 [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",
Frederick Maylef785b792024-06-28 20:04:29 +0000270 // Hide symbols by default and set the BUILDING_LIBBINDER macro so that
271 // the code knows to export them.
272 "-fvisibility=hidden",
273 "-DBUILDING_LIBBINDER",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800274 ],
Frederick Maylef785b792024-06-28 20:04:29 +0000275
276 target: {
277 vendor: {
278 // Trimming the exported symbols reveals a bug in vendor code, so
279 // disable it for the vendor variant for now. http://b/349657329
280 // TODO: Fix the issue and remove this override.
281 cflags: ["-fvisibility=default"],
282 },
283 },
Andrei Homescu875996f2022-08-24 04:25:11 +0000284}
285
286cc_defaults {
287 name: "libbinder_android_defaults",
288
289 // TODO(b/31559095): get headers from bionic on host
290 include_dirs: [
291 "bionic/libc/kernel/android/uapi/",
292 "bionic/libc/kernel/uapi/",
293 ],
294
295 srcs: [
Tomasz Wasilczyk0d9dec22023-10-06 20:28:49 +0000296 "OS_android.cpp",
297 "OS_unix_base.cpp",
Andrei Homescu875996f2022-08-24 04:25:11 +0000298 ],
299
Jiyong Park47f876b2018-04-17 13:56:46 +0900300 target: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700301 host: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700302 srcs: [
303 "UtilsHost.cpp",
304 ],
305 },
Yi Kong60560432024-03-12 12:47:44 +0900306 android: {
307 lto: {
Jeongik Cha91486ee2024-03-12 19:35:12 +0900308 thin: true,
Yi Kong60560432024-03-12 12:47:44 +0900309 },
310 },
Jiyong Park47f876b2018-04-17 13:56:46 +0900311 },
312
Todd Kennedy757186e2017-08-02 07:49:20 -0700313 aidl: {
314 export_aidl_headers: true,
315 },
316
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700317 product_variables: {
Yifan Hong84bedeb2021-04-21 21:37:17 -0700318 debuggable: {
Sahil Somani2522b072022-08-08 14:07:47 -0700319 cflags: [
320 "-DBINDER_RPC_DEV_SERVERS",
321 "-DBINDER_ENABLE_RECORDING",
322 ],
Yifan Hong84bedeb2021-04-21 21:37:17 -0700323 },
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700324 },
325
326 shared_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000327 "libcutils",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700328 "liblog",
Steven Morelandb27aa332023-10-09 22:22:27 +0000329 "libutils",
330 ],
331
332 static_libs: [
333 "libbase",
Steven Moreland62129012021-07-29 12:14:44 -0700334 ],
335
Jiyong Park42842052017-06-20 13:51:22 +0900336 header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900337 "jni_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +0000338 "libbinder_headers",
Jiyong Park42842052017-06-20 13:51:22 +0900339 ],
340
Jiyong Park42842052017-06-20 13:51:22 +0900341 export_header_lib_headers: [
342 "libbinder_headers",
Dan Stozad630e522016-12-01 15:16:31 -0800343 ],
344
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700345 sanitize: {
346 misc_undefined: ["integer"],
347 },
Jiyong Park25265082020-11-13 16:58:57 +0900348
349 tidy: true,
350 tidy_flags: [
351 // Only check our headers
352 "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
353 ],
Steven Moreland525dd902021-04-22 23:00:04 +0000354 tidy_checks: [
355 "-performance-no-int-to-ptr",
356 ],
Jiyong Park25265082020-11-13 16:58:57 +0900357 tidy_checks_as_errors: [
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800358 // Explicitly list the checks that should not occur in this module.
359 "abseil-*",
360 "android-*",
361 "bugprone-*",
Chih-Hung Hsieh41366b42022-06-09 23:12:22 -0700362 "-bugprone-branch-clone", // b/155034972
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800363 "cert-*",
364 "clang-analyzer-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800365 "google-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800366 "misc-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800367 "performance*",
Steven Moreland67f85902023-03-15 01:13:49 +0000368 "-performance-move-const-arg", // b/273486801
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800369 "portability*",
Jiyong Park25265082020-11-13 16:58:57 +0900370 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000371}
372
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000373cc_library_headers {
374 name: "trusty_mock_headers",
375 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000376 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000377
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000378 export_include_dirs: [
379 "trusty/include",
380 "trusty/include_mock",
381 ],
382
383 visibility: [
384 ":__subpackages__",
385 ],
386}
387
388cc_defaults {
389 name: "trusty_mock_defaults",
Andrei Homescu4d9420e2023-01-31 01:38:48 +0000390 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000391 vendor_available: true,
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000392
393 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000394 "libbinder_headers_base",
Tomasz Wasilczykc7c22ea2023-11-30 20:13:44 -0800395 "liblog_stub",
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000396 "trusty_mock_headers",
Andrei Homescu875996f2022-08-24 04:25:11 +0000397 ],
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000398 export_header_lib_headers: [
399 "libbinder_headers_base",
400 "liblog_stub",
401 "trusty_mock_headers",
402 ],
Andrei Homescu875996f2022-08-24 04:25:11 +0000403
Steven Morelandb27aa332023-10-09 22:22:27 +0000404 shared_libs: [
405 "libutils_binder_sdk",
406 ],
407
Andrei Homescu875996f2022-08-24 04:25:11 +0000408 cflags: [
409 "-DBINDER_RPC_SINGLE_THREADED",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800410 "-DBINDER_ENABLE_LIBLOG_ASSERT",
Tomasz Wasilczykbe685c02023-11-30 20:20:53 -0800411 "-DBINDER_DISABLE_NATIVE_HANDLE",
412 "-DBINDER_DISABLE_BLOB",
413 "-DBINDER_NO_LIBBASE",
Steven Morelandd5beffc2023-12-15 21:58:38 +0000414 // TODO: switch to "vendor: true" rather than copying this
Andrei Homescu875996f2022-08-24 04:25:11 +0000415 // Trusty libbinder uses vendor stability for its binders
Steven Morelandd5beffc2023-12-15 21:58:38 +0000416 "-D__ANDROID_VENDOR__",
Andrei Homescu875996f2022-08-24 04:25:11 +0000417 "-D__ANDROID_VNDK__",
418 "-U__ANDROID__",
419 "-D__TRUSTY__",
420 "-DTRUSTY_USERSPACE",
421 // Flags from the Trusty build system
422 "-Werror",
423 "-Wsign-compare",
424 "-Wno-unused-function",
425 "-Wno-unused-label",
426 "-fno-common",
427 "-fno-omit-frame-pointer",
428 "-fno-threadsafe-statics",
429 ],
430 rtti: false,
431
Andrei Homescu875996f2022-08-24 04:25:11 +0000432 visibility: [
433 ":__subpackages__",
434 ],
435}
436
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000437cc_library_shared {
438 name: "libbinder_on_trusty_mock",
439 defaults: [
440 "libbinder_common_defaults",
441 "trusty_mock_defaults",
442 ],
443
444 srcs: [
445 // Trusty-specific files
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000446 "trusty/OS.cpp",
447 "trusty/RpcServerTrusty.cpp",
448 "trusty/RpcTransportTipcTrusty.cpp",
449 "trusty/TrustyStatus.cpp",
450 "trusty/socket.cpp",
451 ],
452}
453
Andrei Homescu12106de2022-04-27 04:42:21 +0000454cc_defaults {
455 name: "libbinder_kernel_defaults",
456 srcs: [
457 "BufferedTextOutput.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000458 "BackendUnifiedServiceManager.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000459 "IPCThreadState.cpp",
460 "IServiceManager.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000461 "IServiceManagerFFI.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000462 "ProcessState.cpp",
463 "Static.cpp",
464 ":libbinder_aidl",
465 ":libbinder_device_interface_sources",
466 ],
467 target: {
468 vendor: {
469 exclude_srcs: [
470 ":libbinder_device_interface_sources",
471 ],
472 },
473 host: {
474 srcs: [
475 "ServiceManagerHost.cpp",
476 ],
477 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900478 android: {
479 shared_libs: [
480 "libapexsupport",
481 "libvndksupport",
482 ],
483 },
484 recovery: {
485 exclude_shared_libs: [
486 "libapexsupport",
487 "libvndksupport",
488 ],
489 },
490 native_bridge: {
491 exclude_shared_libs: [
492 "libapexsupport",
493 "libvndksupport",
494 ],
495 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000496 },
497 cflags: [
498 "-DBINDER_WITH_KERNEL_IPC",
499 ],
500}
501
502cc_library {
503 name: "libbinder",
504 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000505 "libbinder_common_defaults",
506 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000507 "libbinder_kernel_defaults",
508 ],
509
510 version_script: "libbinder.map",
511
Andrei Homescuc485fa32023-02-22 19:45:26 +0000512 // for vndbinder
513 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000514 recovery_available: true,
515 double_loadable: true,
516 // TODO(b/153609531): remove when no longer needed.
517 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700518 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000519
520 // libbinder does not offer a stable wire protocol.
521 // if a second copy of it is installed, then it may break after security
522 // or dessert updates. Instead, apex users should use libbinder_ndk.
523 apex_available: [
524 "//apex_available:platform",
525 ],
526
527 srcs: [
528 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000529 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000530 "LazyServiceRegistrar.cpp",
531 "MemoryBase.cpp",
532 "MemoryDealer.cpp",
533 "MemoryHeapBase.cpp",
534 "ParcelableHolder.cpp",
535 "PersistableBundle.cpp",
536 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000537 target: {
538 android: {
539 // NOT static to keep the wire protocol unfrozen
540 static: {
541 enabled: false,
542 },
543 },
544 darwin: {
545 enabled: false,
546 },
547 recovery: {
548 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900549 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000550 ],
551 },
552 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800553
Yi Kong7cd72c52021-12-23 15:51:29 +0800554 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700555}
556
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700557cc_defaults {
558 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000559
560 cflags: [
561 "-DBINDER_ENABLE_LIBLOG_ASSERT",
562 "-DBINDER_DISABLE_NATIVE_HANDLE",
563 "-DBINDER_DISABLE_BLOB",
564 "-DBINDER_NO_LIBBASE",
565 ],
566
567 header_libs: [
568 "liblog_stub",
569 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700570}
571
572cc_defaults {
573 name: "libbinder_sdk_defaults",
574
575 cmake_snapshot_supported: true,
576
577 defaults: [
578 "libbinder_common_defaults",
579 "binder_sdk_defaults",
580 ],
581
582 shared_libs: [
583 "libutils_binder_sdk",
584 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000585
586 srcs: [
587 "OS_non_android_linux.cpp",
588 "OS_unix_base.cpp",
589 ],
590
591 visibility: [
592 ":__subpackages__",
593 ],
594
595 target: {
596 windows: {
597 enabled: false,
598 },
599 },
600}
601
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700602cc_library_host_shared {
603 name: "libbinder_sdk",
604 defaults: ["libbinder_sdk_defaults"],
605}
606
607cc_library_host_shared {
608 name: "libbinder_sdk_single_threaded",
609 defaults: ["libbinder_sdk_defaults"],
610 cflags: [
611 "-DBINDER_RPC_SINGLE_THREADED",
612 ],
613}
614
Steven Moreland52728212024-04-05 20:28:14 +0000615cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000616 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000617 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000618 defaults: [
619 "libbinder_common_defaults",
620 "libbinder_android_defaults",
621 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000622 visibility: [
623 ":__subpackages__",
624 ],
625}
626
Steven Moreland52728212024-04-05 20:28:14 +0000627cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000628 name: "libbinder_rpc_no_blob",
629 vendor_available: true,
630 defaults: [
631 "libbinder_common_defaults",
632 "libbinder_android_defaults",
633 "libbinder_kernel_defaults",
634 ],
635 cflags: [
636 "-DBINDER_DISABLE_BLOB",
637 ],
638 visibility: [
639 ":__subpackages__",
640 ],
641}
642
Steven Moreland52728212024-04-05 20:28:14 +0000643cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000644 name: "libbinder_rpc_no_native_handle",
645 vendor_available: true,
646 defaults: [
647 "libbinder_common_defaults",
648 "libbinder_android_defaults",
649 "libbinder_kernel_defaults",
650 ],
651 cflags: [
652 "-DBINDER_DISABLE_NATIVE_HANDLE",
653 ],
654 visibility: [
655 ":__subpackages__",
656 ],
657}
658
Steven Moreland52728212024-04-05 20:28:14 +0000659cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000660 name: "libbinder_rpc_single_threaded",
661 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000662 "libbinder_common_defaults",
663 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000664 "libbinder_kernel_defaults",
665 ],
666 cflags: [
667 "-DBINDER_RPC_SINGLE_THREADED",
668 ],
669 visibility: [
670 ":__subpackages__",
671 ],
672}
673
Steven Moreland52728212024-04-05 20:28:14 +0000674cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000675 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000676 defaults: [
677 "libbinder_common_defaults",
678 "libbinder_android_defaults",
679 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000680 cflags: [
681 "-DBINDER_RPC_SINGLE_THREADED",
682 ],
683 visibility: [
684 ":__subpackages__",
685 ],
686}
687
Yifan Honge8212f22021-06-28 15:49:08 -0700688cc_defaults {
689 name: "libbinder_tls_shared_deps",
690 shared_libs: [
691 "libbinder",
692 "libcrypto",
693 "liblog",
694 "libssl",
695 "libutils",
696 ],
697}
698
699cc_defaults {
700 name: "libbinder_tls_defaults",
701 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000702 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700703 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700704 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700705
706 header_libs: [
707 "libbinder_headers",
708 ],
709 export_header_lib_headers: [
710 "libbinder_headers",
711 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700712 export_shared_lib_headers: [
713 "libssl",
714 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700715 export_include_dirs: ["include_tls"],
716 static_libs: [
717 "libbase",
718 ],
719 srcs: [
720 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700721 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700722 ],
723}
724
725cc_library_shared {
726 name: "libbinder_tls",
727 defaults: ["libbinder_tls_defaults"],
728}
729
Andrei Homescud65666d2023-03-03 07:28:02 +0000730cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000731 name: "libbinder_trusty",
732 vendor: true,
733 srcs: [
734 "RpcTransportTipcAndroid.cpp",
735 "RpcTrusty.cpp",
736 ],
737
738 shared_libs: [
739 "libbinder",
740 "liblog",
741 "libtrusty",
742 "libutils",
743 ],
744 static_libs: [
745 "libbase",
746 ],
747 export_include_dirs: ["include_trusty"],
748
749 // Most of Android doesn't need this library and shouldn't use it,
750 // so we restrict its visibility to the Trusty-specific packages.
751 visibility: [
752 ":__subpackages__",
753 "//system/core/trusty:__subpackages__",
754 "//vendor:__subpackages__",
755 ],
756}
757
Yifan Hong92409752021-07-30 21:25:32 -0700758// For testing
759cc_library_static {
760 name: "libbinder_tls_static",
761 defaults: ["libbinder_tls_defaults"],
762 visibility: [
763 ":__subpackages__",
764 ],
765}
766
Colin Cross21c210e2017-11-14 13:05:37 -0800767// AIDL interface between libbinder and framework.jar
768filegroup {
769 name: "libbinder_aidl",
770 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000771 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700772 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700773 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700774 "aidl/android/os/IServiceManager.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000775 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800776 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700777 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800778}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700779
Samiul Islam4480b6f2021-08-26 11:41:49 +0100780aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000781 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100782 unstable: true,
783 local_include_dir: "aidl",
784 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000785 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000786 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100787 "aidl/android/content/pm/IStagedApexObserver.aidl",
788 "aidl/android/content/pm/ApexStagedEvent.aidl",
789 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000790 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900791 backend: {
792 rust: {
793 apex_available: [
794 "com.android.virt",
795 ],
796 enabled: true,
797 },
798 },
Steven Morelandf9514192021-03-26 01:34:55 +0000799}
800
Steven Moreland82c97cf2019-10-16 16:29:27 -0700801aidl_interface {
802 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900803 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700804 local_include_dir: "aidl",
805 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700806 vendor_available: true,
807 backend: {
808 java: {
809 enabled: false,
810 },
811 },
Steven Morelandae351c22023-02-13 22:01:00 +0000812 visibility: [
813 ":__subpackages__",
814 "//system/tools/aidl:__subpackages__",
815 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700816}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000817
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700818// TODO(b/184872979): remove once the Rust API is created.
819cc_library {
820 name: "libbinder_rpc_unstable",
821 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700822 shared_libs: [
823 "libbase",
824 "libbinder",
825 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000826 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700827 "libutils",
828 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900829 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700830
831 // enumerate stable entry points, for apex use
832 stubs: {
833 symbol_file: "libbinder_rpc_unstable.map.txt",
834 },
835
836 // This library is intentionally limited to these targets, and it will be removed later.
837 // Do not expand the visibility.
838 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000839 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000840 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000841 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Raphael Blisteinefc3f602023-02-16 16:12:05 +0000842 "//system/software_defined_vehicle:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900843 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700844 ],
845}
846
Steven Morelandea6bfab2021-04-01 00:10:31 +0000847// libbinder historically contained additional interfaces that provided specific
848// functionality in the platform but have nothing to do with binder itself. These
849// are moved out of libbinder in order to avoid the overhead of their vtables.
850// If you are working on or own one of these interfaces, the responsible things
851// to would be:
852// - give them a new home
853// - convert them to AIDL instead of having manually written parceling code
854
855cc_library {
856 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400857 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000858 srcs: [
859 "IBatteryStats.cpp",
860 ],
861 export_include_dirs: ["include_batterystats"],
862 shared_libs: [
863 "libbinder",
864 "libutils",
865 ],
866}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000867
868cc_library {
869 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400870 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000871 srcs: [
872 "IProcessInfoService.cpp",
873 "ProcessInfoService.cpp",
874 ],
875 export_include_dirs: ["include_processinfo"],
876 shared_libs: [
877 "libbinder",
878 "libutils",
879 "liblog",
880 ],
881}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000882
Steven Moreland8a2085c2021-04-05 22:01:48 +0000883cc_library {
884 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000885 srcs: [
886 "ActivityManager.cpp",
887 "IActivityManager.cpp",
888 "IUidObserver.cpp",
889 ":activity_manager_procstate_aidl",
890 ],
891 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000892 shared_libs: [
893 "libbinder",
894 "libutils",
895 "liblog",
896 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000897 aidl: {
898 export_aidl_headers: true,
899 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000900}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700901
902cc_binary {
903 name: "servicedispatcher",
904 host_supported: false,
905 srcs: [
906 "servicedispatcher.cpp",
907 ],
908 shared_libs: [
909 "libbase",
910 "libbinder",
911 "liblog",
912 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -0700913 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -0700914 ],
915}