blob: aac369ddd12484154cc3db5c4b27c5d76b183d8f [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",
Steven Moreland02601132024-08-27 17:07:13 +000090 dist: {
91 targets: ["binder_sdk"],
92 dest: "binder_sdk.zip",
93 },
94
Tomasz Wasilczyk94c51ab2024-07-02 15:06:02 -070095 modules_host: [
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -070096 "libbinder_sdk",
97 "libbinder_sdk_single_threaded",
98 "libbinder_ndk_sdk",
Tomasz Wasilczyke2836312024-05-09 14:36:19 -070099 "googletest_cmake",
100
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700101 "binderRpcTestNoKernel",
Tomasz Wasilczyke2836312024-05-09 14:36:19 -0700102 "binderRpcTestSingleThreadedNoKernel",
103 "binderRpcWireProtocolTest",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700104 ],
105 prebuilts: [
106 // to enable arm64 host support, build with musl - e.g. on aosp_cf_arm64_phone
107 "aidl",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700108 ],
109 include_sources: true,
110 cflags: [
111 "-DNDEBUG",
112 "-DBINDER_ENABLE_LIBLOG_ASSERT",
113 "-DBINDER_DISABLE_NATIVE_HANDLE",
114 "-DBINDER_DISABLE_BLOB",
115 "-DBINDER_NO_LIBBASE",
116 "-DBINDER_NO_KERNEL_IPC_TESTING",
117
118 // from Soong's global.go commonGlobalCflags and noOverrideGlobalCflags
119 "-Wno-c99-designator",
120 "-Wno-missing-field-initializers",
121
122 // warnings that only pop up on gcc
123 "-Wno-unknown-pragmas", // "pragma clang"
124 "-Wno-attributes", // attributes on compound-statements
125 "-Wno-psabi", // reminders about old ABI changes
126 ],
127 cflags_ignored: [
128 // gcc requires all header constexprs to be used in all dependent compilatinon units
129 "-Wunused-const-variable",
130 ],
131 library_mapping: [
132 {
133 android_name: "libssl",
134 mapped_name: "ssl",
135 package_pregenerated: "external/boringssl",
136 },
137 {
138 android_name: "libcrypto",
139 mapped_name: "crypto",
140 package_pregenerated: "external/boringssl",
141 },
142 {
143 android_name: "libgtest",
144 mapped_name: "GTest::gtest",
Tomasz Wasilczyke2836312024-05-09 14:36:19 -0700145 package_pregenerated: "external/googletest",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700146 },
147 {
148 android_name: "libgtest_main",
Tomasz Wasilczyke2836312024-05-09 14:36:19 -0700149 mapped_name: "GTest::gtest_main",
150 package_pregenerated: "external/googletest",
151 },
152 {
153 android_name: "googletest_cmake",
154 package_pregenerated: "external/googletest",
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700155 },
156
157 // use libbinder_sdk and friends instead of full Android's libbinder
158 {
159 android_name: "libbinder_rpc_no_kernel",
160 mapped_name: "android::libbinder_sdk",
161 },
162 {
163 android_name: "libbinder_rpc_single_threaded_no_kernel",
164 mapped_name: "android::libbinder_sdk_single_threaded",
165 },
166 {
167 android_name: "libbinder_headers",
168 mapped_name: "android::libbinder_headers_base",
169 },
170 {
171 android_name: "libbinder",
172 mapped_name: "android::libbinder_sdk",
173 },
174 {
175 android_name: "libbinder_ndk",
176 mapped_name: "android::libbinder_ndk_sdk",
177 },
178 {
179 android_name: "liblog",
180 mapped_name: "android::liblog_stub",
181 },
182
183 // explicitly included by Binder tests, but not needed outside of Android
184 {
185 android_name: "libbase",
186 },
187 {
188 android_name: "libcutils",
189 },
190 {
191 android_name: "libutils",
192 },
193
194 // disable tests that don't work outside of Android yet
195 {
196 android_name: "binder_rpc_test_service",
197 },
198 {
199 android_name: "binder_rpc_test_service_single_threaded",
200 },
201
202 // trusty mocks are artificially triggered and not needed outside of Android build
203 {
204 android_name: "libbinder_on_trusty_mock",
205 },
206 {
207 android_name: "libbinder_ndk_on_trusty_mock",
208 },
209 {
210 android_name: "binderRpcTestService_on_trusty_mock",
211 },
212 {
213 android_name: "binderRpcTest_on_trusty_mock",
214 },
215 ],
216}
217
Steven Moreland28723ae2019-04-01 18:52:30 -0700218// These interfaces are android-specific implementation unrelated to binder
219// transport itself and should be moved to AIDL or in domain-specific libs.
220//
221// Currently, these are only on system android (not vendor, not host)
Steven Morelandea6bfab2021-04-01 00:10:31 +0000222// TODO(b/183654927) - move these into separate libraries
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400223
224filegroup {
225 name: "libbinder_device_interface_sources",
226 srcs: [
227 "IPermissionController.cpp",
228 "PermissionCache.cpp",
229 "PermissionController.cpp",
230 ],
231}
Steven Moreland28723ae2019-04-01 18:52:30 -0700232
Andrei Homescu12106de2022-04-27 04:42:21 +0000233cc_defaults {
Andrei Homescu875996f2022-08-24 04:25:11 +0000234 name: "libbinder_common_defaults",
Steven Moreland28723ae2019-04-01 18:52:30 -0700235 host_supported: true,
236
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700237 srcs: [
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700238 "Binder.cpp",
239 "BpBinder.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700240 "Debug.cpp",
Yifan Hong8c950422021-08-05 17:13:55 -0700241 "FdTrigger.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700242 "IInterface.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700243 "IResultReceiver.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700244 "Parcel.cpp",
Ryo Hashimotobf551892018-05-31 16:58:35 +0900245 "ParcelFileDescriptor.cpp",
Fabián Cañas356a0222023-01-13 16:32:53 -0500246 "RecordedTransaction.cpp",
Steven Morelandbdb53ab2021-05-05 17:57:41 +0000247 "RpcSession.cpp",
Steven Moreland5553ac42020-11-11 02:14:45 +0000248 "RpcServer.cpp",
249 "RpcState.cpp",
Steven Morelandb27aa332023-10-09 22:22:27 +0000250 "RpcTransportRaw.cpp",
Steven Morelanda86a3562019-08-01 23:28:34 +0000251 "Stability.cpp",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700252 "Status.cpp",
253 "TextOutput.cpp",
Steven Morelandf183fdd2020-10-27 00:12:12 +0000254 "Utils.cpp",
Tomasz Wasilczyk26db5e42023-11-02 11:45:11 -0700255 "file.cpp",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100256 ],
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700257
Andrei Homescu875996f2022-08-24 04:25:11 +0000258 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000259 "libbinder_headers_base",
Andrei Homescu875996f2022-08-24 04:25:11 +0000260 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700261 export_header_lib_headers: [
262 "libbinder_headers_base",
263 ],
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800264
265 cflags: [
266 "-Wextra",
267 "-Wextra-semi",
268 "-Werror",
269 "-Wzero-as-null-pointer-constant",
270 "-Wreorder-init-list",
271 "-Wunused-const-variable",
272 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
273 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frederick Maylef785b792024-06-28 20:04:29 +0000274 // Hide symbols by default and set the BUILDING_LIBBINDER macro so that
275 // the code knows to export them.
276 "-fvisibility=hidden",
277 "-DBUILDING_LIBBINDER",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800278 ],
Frederick Maylef785b792024-06-28 20:04:29 +0000279
280 target: {
281 vendor: {
282 // Trimming the exported symbols reveals a bug in vendor code, so
283 // disable it for the vendor variant for now. http://b/349657329
284 // TODO: Fix the issue and remove this override.
285 cflags: ["-fvisibility=default"],
286 },
287 },
Andrei Homescu875996f2022-08-24 04:25:11 +0000288}
289
290cc_defaults {
291 name: "libbinder_android_defaults",
292
293 // TODO(b/31559095): get headers from bionic on host
294 include_dirs: [
295 "bionic/libc/kernel/android/uapi/",
296 "bionic/libc/kernel/uapi/",
297 ],
298
299 srcs: [
Tomasz Wasilczyk0d9dec22023-10-06 20:28:49 +0000300 "OS_android.cpp",
301 "OS_unix_base.cpp",
Andrei Homescu875996f2022-08-24 04:25:11 +0000302 ],
303
Jiyong Park47f876b2018-04-17 13:56:46 +0900304 target: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700305 host: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700306 srcs: [
307 "UtilsHost.cpp",
308 ],
309 },
Yi Kong60560432024-03-12 12:47:44 +0900310 android: {
311 lto: {
Jeongik Cha91486ee2024-03-12 19:35:12 +0900312 thin: true,
Yi Kong60560432024-03-12 12:47:44 +0900313 },
314 },
Jiyong Park47f876b2018-04-17 13:56:46 +0900315 },
316
Todd Kennedy757186e2017-08-02 07:49:20 -0700317 aidl: {
318 export_aidl_headers: true,
319 },
320
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700321 product_variables: {
Yifan Hong84bedeb2021-04-21 21:37:17 -0700322 debuggable: {
Sahil Somani2522b072022-08-08 14:07:47 -0700323 cflags: [
324 "-DBINDER_RPC_DEV_SERVERS",
325 "-DBINDER_ENABLE_RECORDING",
326 ],
Yifan Hong84bedeb2021-04-21 21:37:17 -0700327 },
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700328 },
329
330 shared_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000331 "libcutils",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700332 "liblog",
Steven Morelandb27aa332023-10-09 22:22:27 +0000333 "libutils",
334 ],
335
336 static_libs: [
337 "libbase",
Steven Moreland62129012021-07-29 12:14:44 -0700338 ],
339
Jiyong Park42842052017-06-20 13:51:22 +0900340 header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900341 "jni_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +0000342 "libbinder_headers",
Jiyong Park42842052017-06-20 13:51:22 +0900343 ],
344
Jiyong Park42842052017-06-20 13:51:22 +0900345 export_header_lib_headers: [
346 "libbinder_headers",
Dan Stozad630e522016-12-01 15:16:31 -0800347 ],
348
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700349 sanitize: {
350 misc_undefined: ["integer"],
351 },
Jiyong Park25265082020-11-13 16:58:57 +0900352
353 tidy: true,
354 tidy_flags: [
355 // Only check our headers
356 "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
357 ],
Steven Moreland525dd902021-04-22 23:00:04 +0000358 tidy_checks: [
359 "-performance-no-int-to-ptr",
360 ],
Jiyong Park25265082020-11-13 16:58:57 +0900361 tidy_checks_as_errors: [
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800362 // Explicitly list the checks that should not occur in this module.
363 "abseil-*",
364 "android-*",
365 "bugprone-*",
Chih-Hung Hsieh41366b42022-06-09 23:12:22 -0700366 "-bugprone-branch-clone", // b/155034972
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800367 "cert-*",
368 "clang-analyzer-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800369 "google-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800370 "misc-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800371 "performance*",
Steven Moreland67f85902023-03-15 01:13:49 +0000372 "-performance-move-const-arg", // b/273486801
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800373 "portability*",
Jiyong Park25265082020-11-13 16:58:57 +0900374 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000375}
376
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000377cc_library_headers {
378 name: "trusty_mock_headers",
379 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000380 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000381
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000382 export_include_dirs: [
383 "trusty/include",
384 "trusty/include_mock",
385 ],
386
387 visibility: [
388 ":__subpackages__",
389 ],
390}
391
392cc_defaults {
393 name: "trusty_mock_defaults",
Andrei Homescu4d9420e2023-01-31 01:38:48 +0000394 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000395 vendor_available: true,
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000396
397 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000398 "libbinder_headers_base",
Tomasz Wasilczykc7c22ea2023-11-30 20:13:44 -0800399 "liblog_stub",
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000400 "trusty_mock_headers",
Andrei Homescu875996f2022-08-24 04:25:11 +0000401 ],
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000402 export_header_lib_headers: [
403 "libbinder_headers_base",
404 "liblog_stub",
405 "trusty_mock_headers",
406 ],
Andrei Homescu875996f2022-08-24 04:25:11 +0000407
Steven Morelandb27aa332023-10-09 22:22:27 +0000408 shared_libs: [
409 "libutils_binder_sdk",
410 ],
411
Andrei Homescu875996f2022-08-24 04:25:11 +0000412 cflags: [
413 "-DBINDER_RPC_SINGLE_THREADED",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800414 "-DBINDER_ENABLE_LIBLOG_ASSERT",
Tomasz Wasilczykbe685c02023-11-30 20:20:53 -0800415 "-DBINDER_DISABLE_NATIVE_HANDLE",
416 "-DBINDER_DISABLE_BLOB",
417 "-DBINDER_NO_LIBBASE",
Steven Morelandd5beffc2023-12-15 21:58:38 +0000418 // TODO: switch to "vendor: true" rather than copying this
Andrei Homescu875996f2022-08-24 04:25:11 +0000419 // Trusty libbinder uses vendor stability for its binders
Steven Morelandd5beffc2023-12-15 21:58:38 +0000420 "-D__ANDROID_VENDOR__",
Andrei Homescu875996f2022-08-24 04:25:11 +0000421 "-D__ANDROID_VNDK__",
422 "-U__ANDROID__",
423 "-D__TRUSTY__",
424 "-DTRUSTY_USERSPACE",
425 // Flags from the Trusty build system
426 "-Werror",
427 "-Wsign-compare",
428 "-Wno-unused-function",
429 "-Wno-unused-label",
430 "-fno-common",
431 "-fno-omit-frame-pointer",
432 "-fno-threadsafe-statics",
433 ],
434 rtti: false,
435
Andrei Homescu875996f2022-08-24 04:25:11 +0000436 visibility: [
437 ":__subpackages__",
438 ],
439}
440
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000441cc_library_shared {
442 name: "libbinder_on_trusty_mock",
443 defaults: [
444 "libbinder_common_defaults",
445 "trusty_mock_defaults",
446 ],
447
448 srcs: [
449 // Trusty-specific files
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000450 "trusty/OS.cpp",
451 "trusty/RpcServerTrusty.cpp",
452 "trusty/RpcTransportTipcTrusty.cpp",
453 "trusty/TrustyStatus.cpp",
454 "trusty/socket.cpp",
455 ],
456}
457
Parth Sanec452eee2024-07-04 13:31:21 +0000458soong_config_module_type {
Parth Sane5e1b7e12024-11-29 10:40:41 +0000459 name: "libbinder_remove_cache_static_list_config",
460 module_type: "cc_defaults",
461 config_namespace: "libbinder",
462 bool_variables: ["release_libbinder_remove_cache_static_list"],
463 properties: [
464 "cflags",
465 ],
466}
467
468libbinder_remove_cache_static_list_config {
469 name: "libbinder_remove_cache_static_list_flag",
470 soong_config_variables: {
471 release_libbinder_remove_cache_static_list: {
472 cflags: ["-DLIBBINDER_REMOVE_CACHE_STATIC_LIST"],
473 conditions_default: {
474 cflags: ["-DNO_LIBBINDER_REMOVE_CACHE_STATIC_LIST"],
475 },
476 },
477 },
478}
479
480soong_config_module_type {
Parth Sanec452eee2024-07-04 13:31:21 +0000481 name: "libbinder_client_cache_config",
482 module_type: "cc_defaults",
483 config_namespace: "libbinder",
484 bool_variables: ["release_libbinder_client_cache"],
485 properties: [
486 "cflags",
487 ],
488}
489
490libbinder_client_cache_config {
491 name: "libbinder_client_cache_flag",
492 soong_config_variables: {
493 release_libbinder_client_cache: {
494 cflags: ["-DLIBBINDER_CLIENT_CACHE"],
495 conditions_default: {
496 cflags: ["-DNO_LIBBINDER_CLIENT_CACHE"],
497 },
498 },
499 },
500}
501
Parth Sanedc207542024-11-14 11:49:08 +0000502soong_config_module_type {
503 name: "libbinder_addservice_cache_config",
504 module_type: "cc_defaults",
505 config_namespace: "libbinder",
506 bool_variables: ["release_libbinder_addservice_cache"],
507 properties: [
508 "cflags",
509 ],
510}
511
512libbinder_addservice_cache_config {
513 name: "libbinder_addservice_cache_flag",
514 soong_config_variables: {
515 release_libbinder_addservice_cache: {
516 cflags: ["-DLIBBINDER_ADDSERVICE_CACHE"],
517 conditions_default: {
518 cflags: ["-DNO_LIBBINDER_ADDSERVICE_CACHE"],
519 },
520 },
521 },
522}
523
Andrei Homescu12106de2022-04-27 04:42:21 +0000524cc_defaults {
525 name: "libbinder_kernel_defaults",
Parth Sanedc207542024-11-14 11:49:08 +0000526 defaults: [
527 "libbinder_client_cache_flag",
528 "libbinder_addservice_cache_flag",
Parth Sane5e1b7e12024-11-29 10:40:41 +0000529 "libbinder_remove_cache_static_list_flag",
Parth Sanedc207542024-11-14 11:49:08 +0000530 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000531 srcs: [
532 "BufferedTextOutput.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000533 "BackendUnifiedServiceManager.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000534 "IPCThreadState.cpp",
535 "IServiceManager.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000536 "IServiceManagerFFI.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000537 "ProcessState.cpp",
538 "Static.cpp",
539 ":libbinder_aidl",
Devin Moore0555fbf2024-08-29 15:51:50 +0000540 ":libbinder_accessor_aidl",
Andrei Homescu12106de2022-04-27 04:42:21 +0000541 ":libbinder_device_interface_sources",
542 ],
543 target: {
544 vendor: {
545 exclude_srcs: [
546 ":libbinder_device_interface_sources",
547 ],
548 },
549 host: {
550 srcs: [
551 "ServiceManagerHost.cpp",
552 ],
553 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900554 android: {
555 shared_libs: [
556 "libapexsupport",
557 "libvndksupport",
558 ],
559 },
560 recovery: {
561 exclude_shared_libs: [
562 "libapexsupport",
563 "libvndksupport",
564 ],
565 },
566 native_bridge: {
567 exclude_shared_libs: [
568 "libapexsupport",
569 "libvndksupport",
570 ],
571 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000572 },
573 cflags: [
574 "-DBINDER_WITH_KERNEL_IPC",
575 ],
576}
577
578cc_library {
579 name: "libbinder",
580 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000581 "libbinder_common_defaults",
582 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000583 "libbinder_kernel_defaults",
584 ],
585
586 version_script: "libbinder.map",
587
Andrei Homescuc485fa32023-02-22 19:45:26 +0000588 // for vndbinder
589 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000590 recovery_available: true,
591 double_loadable: true,
592 // TODO(b/153609531): remove when no longer needed.
593 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700594 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000595
596 // libbinder does not offer a stable wire protocol.
597 // if a second copy of it is installed, then it may break after security
598 // or dessert updates. Instead, apex users should use libbinder_ndk.
599 apex_available: [
600 "//apex_available:platform",
601 ],
602
603 srcs: [
604 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000605 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000606 "LazyServiceRegistrar.cpp",
607 "MemoryBase.cpp",
608 "MemoryDealer.cpp",
609 "MemoryHeapBase.cpp",
610 "ParcelableHolder.cpp",
611 "PersistableBundle.cpp",
612 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000613 target: {
614 android: {
615 // NOT static to keep the wire protocol unfrozen
616 static: {
617 enabled: false,
618 },
619 },
620 darwin: {
621 enabled: false,
622 },
623 recovery: {
624 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900625 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000626 ],
627 },
628 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800629
Yi Kong7cd72c52021-12-23 15:51:29 +0800630 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700631}
632
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700633cc_defaults {
634 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000635
636 cflags: [
637 "-DBINDER_ENABLE_LIBLOG_ASSERT",
638 "-DBINDER_DISABLE_NATIVE_HANDLE",
639 "-DBINDER_DISABLE_BLOB",
640 "-DBINDER_NO_LIBBASE",
641 ],
642
643 header_libs: [
644 "liblog_stub",
645 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700646}
647
648cc_defaults {
649 name: "libbinder_sdk_defaults",
650
651 cmake_snapshot_supported: true,
652
653 defaults: [
654 "libbinder_common_defaults",
655 "binder_sdk_defaults",
656 ],
657
658 shared_libs: [
659 "libutils_binder_sdk",
660 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000661
662 srcs: [
663 "OS_non_android_linux.cpp",
664 "OS_unix_base.cpp",
665 ],
666
667 visibility: [
668 ":__subpackages__",
669 ],
670
671 target: {
672 windows: {
673 enabled: false,
674 },
675 },
676}
677
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700678cc_library_host_shared {
679 name: "libbinder_sdk",
680 defaults: ["libbinder_sdk_defaults"],
681}
682
683cc_library_host_shared {
684 name: "libbinder_sdk_single_threaded",
685 defaults: ["libbinder_sdk_defaults"],
686 cflags: [
687 "-DBINDER_RPC_SINGLE_THREADED",
688 ],
689}
690
Steven Moreland52728212024-04-05 20:28:14 +0000691cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000692 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000693 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000694 defaults: [
695 "libbinder_common_defaults",
696 "libbinder_android_defaults",
697 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000698 visibility: [
699 ":__subpackages__",
700 ],
701}
702
Steven Moreland52728212024-04-05 20:28:14 +0000703cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000704 name: "libbinder_rpc_no_blob",
705 vendor_available: true,
706 defaults: [
707 "libbinder_common_defaults",
708 "libbinder_android_defaults",
709 "libbinder_kernel_defaults",
710 ],
711 cflags: [
712 "-DBINDER_DISABLE_BLOB",
713 ],
714 visibility: [
715 ":__subpackages__",
716 ],
717}
718
Steven Moreland52728212024-04-05 20:28:14 +0000719cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000720 name: "libbinder_rpc_no_native_handle",
721 vendor_available: true,
722 defaults: [
723 "libbinder_common_defaults",
724 "libbinder_android_defaults",
725 "libbinder_kernel_defaults",
726 ],
727 cflags: [
728 "-DBINDER_DISABLE_NATIVE_HANDLE",
729 ],
730 visibility: [
731 ":__subpackages__",
732 ],
733}
734
Steven Moreland52728212024-04-05 20:28:14 +0000735cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000736 name: "libbinder_rpc_single_threaded",
737 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000738 "libbinder_common_defaults",
739 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000740 "libbinder_kernel_defaults",
741 ],
742 cflags: [
743 "-DBINDER_RPC_SINGLE_THREADED",
744 ],
745 visibility: [
746 ":__subpackages__",
747 ],
748}
749
Steven Moreland52728212024-04-05 20:28:14 +0000750cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000751 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000752 defaults: [
753 "libbinder_common_defaults",
754 "libbinder_android_defaults",
755 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000756 cflags: [
757 "-DBINDER_RPC_SINGLE_THREADED",
758 ],
759 visibility: [
760 ":__subpackages__",
761 ],
762}
763
Yifan Honge8212f22021-06-28 15:49:08 -0700764cc_defaults {
765 name: "libbinder_tls_shared_deps",
766 shared_libs: [
767 "libbinder",
768 "libcrypto",
769 "liblog",
770 "libssl",
771 "libutils",
772 ],
773}
774
775cc_defaults {
776 name: "libbinder_tls_defaults",
777 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000778 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700779 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700780 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700781
782 header_libs: [
783 "libbinder_headers",
784 ],
785 export_header_lib_headers: [
786 "libbinder_headers",
787 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700788 export_shared_lib_headers: [
789 "libssl",
790 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700791 export_include_dirs: ["include_tls"],
792 static_libs: [
793 "libbase",
794 ],
795 srcs: [
796 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700797 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700798 ],
799}
800
801cc_library_shared {
802 name: "libbinder_tls",
803 defaults: ["libbinder_tls_defaults"],
804}
805
Andrei Homescud65666d2023-03-03 07:28:02 +0000806cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000807 name: "libbinder_trusty",
808 vendor: true,
809 srcs: [
810 "RpcTransportTipcAndroid.cpp",
811 "RpcTrusty.cpp",
812 ],
813
814 shared_libs: [
815 "libbinder",
816 "liblog",
817 "libtrusty",
818 "libutils",
819 ],
820 static_libs: [
821 "libbase",
822 ],
823 export_include_dirs: ["include_trusty"],
824
825 // Most of Android doesn't need this library and shouldn't use it,
826 // so we restrict its visibility to the Trusty-specific packages.
827 visibility: [
828 ":__subpackages__",
829 "//system/core/trusty:__subpackages__",
830 "//vendor:__subpackages__",
831 ],
832}
833
Yifan Hong92409752021-07-30 21:25:32 -0700834// For testing
835cc_library_static {
836 name: "libbinder_tls_static",
837 defaults: ["libbinder_tls_defaults"],
838 visibility: [
839 ":__subpackages__",
840 ],
841}
842
Colin Cross21c210e2017-11-14 13:05:37 -0800843// AIDL interface between libbinder and framework.jar
844filegroup {
845 name: "libbinder_aidl",
846 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000847 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700848 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700849 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700850 "aidl/android/os/IServiceManager.aidl",
Alice Wang8578f132024-05-03 09:01:56 +0000851 "aidl/android/os/Service.aidl",
Parth Sane5e1b7e12024-11-29 10:40:41 +0000852 "aidl/android/os/ServiceWithMetadata.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000853 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800854 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700855 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800856}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700857
Alice Wang8578f132024-05-03 09:01:56 +0000858filegroup {
859 name: "libbinder_accessor_aidl",
860 srcs: [
861 "aidl/android/os/IAccessor.aidl",
862 ],
863 path: "aidl",
Devin Moore0555fbf2024-08-29 15:51:50 +0000864 visibility: [":__subpackages__"],
Alice Wang8578f132024-05-03 09:01:56 +0000865}
866
Samiul Islam4480b6f2021-08-26 11:41:49 +0100867aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000868 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100869 unstable: true,
870 local_include_dir: "aidl",
871 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000872 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000873 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100874 "aidl/android/content/pm/IStagedApexObserver.aidl",
875 "aidl/android/content/pm/ApexStagedEvent.aidl",
876 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000877 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900878 backend: {
879 rust: {
880 apex_available: [
Vikram Gauraed4aa92024-11-14 05:08:29 +0000881 "//apex_available:platform",
Jooyung Hanfc622692021-10-05 16:51:09 +0900882 "com.android.virt",
883 ],
884 enabled: true,
885 },
886 },
Steven Morelandf9514192021-03-26 01:34:55 +0000887}
888
Steven Moreland82c97cf2019-10-16 16:29:27 -0700889aidl_interface {
890 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900891 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700892 local_include_dir: "aidl",
893 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700894 vendor_available: true,
895 backend: {
896 java: {
897 enabled: false,
898 },
899 },
Steven Morelandae351c22023-02-13 22:01:00 +0000900 visibility: [
901 ":__subpackages__",
902 "//system/tools/aidl:__subpackages__",
903 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700904}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000905
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700906// TODO(b/184872979): remove once the Rust API is created.
907cc_library {
908 name: "libbinder_rpc_unstable",
909 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700910 shared_libs: [
911 "libbase",
912 "libbinder",
913 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000914 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700915 "libutils",
916 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900917 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700918
919 // enumerate stable entry points, for apex use
920 stubs: {
921 symbol_file: "libbinder_rpc_unstable.map.txt",
922 },
923
Devin Moorea09b5b72024-10-28 21:45:47 +0000924 header_abi_checker: {
925 enabled: false,
926 },
927
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700928 // This library is intentionally limited to these targets, and it will be removed later.
929 // Do not expand the visibility.
930 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000931 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000932 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000933 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900934 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700935 ],
936}
937
Steven Morelandea6bfab2021-04-01 00:10:31 +0000938// libbinder historically contained additional interfaces that provided specific
939// functionality in the platform but have nothing to do with binder itself. These
940// are moved out of libbinder in order to avoid the overhead of their vtables.
941// If you are working on or own one of these interfaces, the responsible things
942// to would be:
943// - give them a new home
944// - convert them to AIDL instead of having manually written parceling code
945
946cc_library {
947 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400948 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000949 srcs: [
950 "IBatteryStats.cpp",
951 ],
952 export_include_dirs: ["include_batterystats"],
953 shared_libs: [
954 "libbinder",
955 "libutils",
956 ],
957}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000958
959cc_library {
960 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400961 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000962 srcs: [
963 "IProcessInfoService.cpp",
964 "ProcessInfoService.cpp",
965 ],
966 export_include_dirs: ["include_processinfo"],
967 shared_libs: [
968 "libbinder",
969 "libutils",
970 "liblog",
971 ],
972}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000973
Steven Moreland8a2085c2021-04-05 22:01:48 +0000974cc_library {
975 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000976 srcs: [
977 "ActivityManager.cpp",
978 "IActivityManager.cpp",
979 "IUidObserver.cpp",
980 ":activity_manager_procstate_aidl",
981 ],
982 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000983 shared_libs: [
984 "libbinder",
985 "libutils",
986 "liblog",
987 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000988 aidl: {
989 export_aidl_headers: true,
990 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000991}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700992
993cc_binary {
994 name: "servicedispatcher",
995 host_supported: false,
996 srcs: [
997 "servicedispatcher.cpp",
998 ],
999 shared_libs: [
1000 "libbase",
1001 "libbinder",
1002 "liblog",
1003 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -07001004 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -07001005 ],
1006}