blob: a3499c196327ddf8e291ff1f02166dce4291135b [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",
Steven Moreland17305282025-01-09 21:28:44 +0000272 "-Wunused-result",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800273 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
274 "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
Frederick Maylef785b792024-06-28 20:04:29 +0000275 // Hide symbols by default and set the BUILDING_LIBBINDER macro so that
276 // the code knows to export them.
277 "-fvisibility=hidden",
278 "-DBUILDING_LIBBINDER",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800279 ],
Andrei Homescu875996f2022-08-24 04:25:11 +0000280}
281
282cc_defaults {
283 name: "libbinder_android_defaults",
284
285 // TODO(b/31559095): get headers from bionic on host
286 include_dirs: [
287 "bionic/libc/kernel/android/uapi/",
288 "bionic/libc/kernel/uapi/",
289 ],
290
291 srcs: [
Tomasz Wasilczyk0d9dec22023-10-06 20:28:49 +0000292 "OS_android.cpp",
293 "OS_unix_base.cpp",
Andrei Homescu875996f2022-08-24 04:25:11 +0000294 ],
295
Jiyong Park47f876b2018-04-17 13:56:46 +0900296 target: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700297 host: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700298 srcs: [
299 "UtilsHost.cpp",
300 ],
301 },
Yi Kong60560432024-03-12 12:47:44 +0900302 android: {
303 lto: {
Jeongik Cha91486ee2024-03-12 19:35:12 +0900304 thin: true,
Yi Kong60560432024-03-12 12:47:44 +0900305 },
306 },
Jiyong Park47f876b2018-04-17 13:56:46 +0900307 },
308
Todd Kennedy757186e2017-08-02 07:49:20 -0700309 aidl: {
310 export_aidl_headers: true,
311 },
312
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700313 product_variables: {
Yifan Hong84bedeb2021-04-21 21:37:17 -0700314 debuggable: {
Sahil Somani2522b072022-08-08 14:07:47 -0700315 cflags: [
316 "-DBINDER_RPC_DEV_SERVERS",
317 "-DBINDER_ENABLE_RECORDING",
318 ],
Yifan Hong84bedeb2021-04-21 21:37:17 -0700319 },
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700320 },
321
322 shared_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000323 "libcutils",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700324 "liblog",
Steven Morelandb27aa332023-10-09 22:22:27 +0000325 "libutils",
326 ],
327
328 static_libs: [
329 "libbase",
Steven Moreland62129012021-07-29 12:14:44 -0700330 ],
331
Jiyong Park42842052017-06-20 13:51:22 +0900332 header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900333 "jni_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +0000334 "libbinder_headers",
Jiyong Park42842052017-06-20 13:51:22 +0900335 ],
336
Jiyong Park42842052017-06-20 13:51:22 +0900337 export_header_lib_headers: [
338 "libbinder_headers",
Dan Stozad630e522016-12-01 15:16:31 -0800339 ],
340
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700341 sanitize: {
342 misc_undefined: ["integer"],
343 },
Jiyong Park25265082020-11-13 16:58:57 +0900344
345 tidy: true,
346 tidy_flags: [
347 // Only check our headers
348 "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
349 ],
Steven Moreland525dd902021-04-22 23:00:04 +0000350 tidy_checks: [
351 "-performance-no-int-to-ptr",
352 ],
Jiyong Park25265082020-11-13 16:58:57 +0900353 tidy_checks_as_errors: [
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800354 // Explicitly list the checks that should not occur in this module.
355 "abseil-*",
356 "android-*",
357 "bugprone-*",
Chih-Hung Hsieh41366b42022-06-09 23:12:22 -0700358 "-bugprone-branch-clone", // b/155034972
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800359 "cert-*",
360 "clang-analyzer-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800361 "google-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800362 "misc-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800363 "performance*",
Steven Moreland67f85902023-03-15 01:13:49 +0000364 "-performance-move-const-arg", // b/273486801
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800365 "portability*",
Jiyong Park25265082020-11-13 16:58:57 +0900366 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000367}
368
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000369cc_library_headers {
370 name: "trusty_mock_headers",
371 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000372 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000373
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000374 export_include_dirs: [
375 "trusty/include",
376 "trusty/include_mock",
377 ],
378
379 visibility: [
380 ":__subpackages__",
381 ],
382}
383
384cc_defaults {
385 name: "trusty_mock_defaults",
Andrei Homescu4d9420e2023-01-31 01:38:48 +0000386 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000387 vendor_available: true,
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000388
389 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000390 "libbinder_headers_base",
Tomasz Wasilczykc7c22ea2023-11-30 20:13:44 -0800391 "liblog_stub",
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000392 "trusty_mock_headers",
Andrei Homescu875996f2022-08-24 04:25:11 +0000393 ],
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000394 export_header_lib_headers: [
395 "libbinder_headers_base",
396 "liblog_stub",
397 "trusty_mock_headers",
398 ],
Andrei Homescu875996f2022-08-24 04:25:11 +0000399
Steven Morelandb27aa332023-10-09 22:22:27 +0000400 shared_libs: [
401 "libutils_binder_sdk",
402 ],
403
Andrei Homescu875996f2022-08-24 04:25:11 +0000404 cflags: [
405 "-DBINDER_RPC_SINGLE_THREADED",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800406 "-DBINDER_ENABLE_LIBLOG_ASSERT",
Tomasz Wasilczykbe685c02023-11-30 20:20:53 -0800407 "-DBINDER_DISABLE_NATIVE_HANDLE",
408 "-DBINDER_DISABLE_BLOB",
409 "-DBINDER_NO_LIBBASE",
Steven Morelandd5beffc2023-12-15 21:58:38 +0000410 // TODO: switch to "vendor: true" rather than copying this
Andrei Homescu875996f2022-08-24 04:25:11 +0000411 // Trusty libbinder uses vendor stability for its binders
Steven Morelandd5beffc2023-12-15 21:58:38 +0000412 "-D__ANDROID_VENDOR__",
Andrei Homescu875996f2022-08-24 04:25:11 +0000413 "-D__ANDROID_VNDK__",
414 "-U__ANDROID__",
415 "-D__TRUSTY__",
416 "-DTRUSTY_USERSPACE",
417 // Flags from the Trusty build system
418 "-Werror",
419 "-Wsign-compare",
420 "-Wno-unused-function",
421 "-Wno-unused-label",
422 "-fno-common",
423 "-fno-omit-frame-pointer",
424 "-fno-threadsafe-statics",
425 ],
426 rtti: false,
427
Andrei Homescu875996f2022-08-24 04:25:11 +0000428 visibility: [
429 ":__subpackages__",
430 ],
431}
432
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000433cc_library_shared {
434 name: "libbinder_on_trusty_mock",
435 defaults: [
436 "libbinder_common_defaults",
437 "trusty_mock_defaults",
438 ],
439
440 srcs: [
441 // Trusty-specific files
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000442 "trusty/OS.cpp",
443 "trusty/RpcServerTrusty.cpp",
444 "trusty/RpcTransportTipcTrusty.cpp",
445 "trusty/TrustyStatus.cpp",
446 "trusty/socket.cpp",
447 ],
448}
449
Parth Sanec452eee2024-07-04 13:31:21 +0000450soong_config_module_type {
Parth Sane5e1b7e12024-11-29 10:40:41 +0000451 name: "libbinder_remove_cache_static_list_config",
452 module_type: "cc_defaults",
453 config_namespace: "libbinder",
454 bool_variables: ["release_libbinder_remove_cache_static_list"],
455 properties: [
456 "cflags",
457 ],
458}
459
460libbinder_remove_cache_static_list_config {
461 name: "libbinder_remove_cache_static_list_flag",
462 soong_config_variables: {
463 release_libbinder_remove_cache_static_list: {
464 cflags: ["-DLIBBINDER_REMOVE_CACHE_STATIC_LIST"],
465 conditions_default: {
466 cflags: ["-DNO_LIBBINDER_REMOVE_CACHE_STATIC_LIST"],
467 },
468 },
469 },
470}
471
472soong_config_module_type {
Parth Sanec452eee2024-07-04 13:31:21 +0000473 name: "libbinder_client_cache_config",
474 module_type: "cc_defaults",
475 config_namespace: "libbinder",
476 bool_variables: ["release_libbinder_client_cache"],
477 properties: [
478 "cflags",
479 ],
480}
481
482libbinder_client_cache_config {
483 name: "libbinder_client_cache_flag",
484 soong_config_variables: {
485 release_libbinder_client_cache: {
486 cflags: ["-DLIBBINDER_CLIENT_CACHE"],
487 conditions_default: {
488 cflags: ["-DNO_LIBBINDER_CLIENT_CACHE"],
489 },
490 },
491 },
492}
493
Parth Sanedc207542024-11-14 11:49:08 +0000494soong_config_module_type {
495 name: "libbinder_addservice_cache_config",
496 module_type: "cc_defaults",
497 config_namespace: "libbinder",
498 bool_variables: ["release_libbinder_addservice_cache"],
499 properties: [
500 "cflags",
501 ],
502}
503
504libbinder_addservice_cache_config {
505 name: "libbinder_addservice_cache_flag",
506 soong_config_variables: {
507 release_libbinder_addservice_cache: {
508 cflags: ["-DLIBBINDER_ADDSERVICE_CACHE"],
509 conditions_default: {
510 cflags: ["-DNO_LIBBINDER_ADDSERVICE_CACHE"],
511 },
512 },
513 },
514}
515
Andrei Homescu12106de2022-04-27 04:42:21 +0000516cc_defaults {
517 name: "libbinder_kernel_defaults",
Parth Sanedc207542024-11-14 11:49:08 +0000518 defaults: [
519 "libbinder_client_cache_flag",
520 "libbinder_addservice_cache_flag",
Parth Sane5e1b7e12024-11-29 10:40:41 +0000521 "libbinder_remove_cache_static_list_flag",
Parth Sanedc207542024-11-14 11:49:08 +0000522 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000523 srcs: [
524 "BufferedTextOutput.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000525 "BackendUnifiedServiceManager.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000526 "IPCThreadState.cpp",
527 "IServiceManager.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000528 "IServiceManagerFFI.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000529 "ProcessState.cpp",
530 "Static.cpp",
531 ":libbinder_aidl",
Devin Moore0555fbf2024-08-29 15:51:50 +0000532 ":libbinder_accessor_aidl",
Andrei Homescu12106de2022-04-27 04:42:21 +0000533 ":libbinder_device_interface_sources",
534 ],
535 target: {
536 vendor: {
537 exclude_srcs: [
538 ":libbinder_device_interface_sources",
539 ],
540 },
541 host: {
542 srcs: [
543 "ServiceManagerHost.cpp",
544 ],
545 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900546 android: {
547 shared_libs: [
548 "libapexsupport",
549 "libvndksupport",
550 ],
551 },
552 recovery: {
553 exclude_shared_libs: [
554 "libapexsupport",
555 "libvndksupport",
556 ],
557 },
558 native_bridge: {
559 exclude_shared_libs: [
560 "libapexsupport",
561 "libvndksupport",
562 ],
563 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000564 },
565 cflags: [
566 "-DBINDER_WITH_KERNEL_IPC",
567 ],
568}
569
570cc_library {
571 name: "libbinder",
572 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000573 "libbinder_common_defaults",
574 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000575 "libbinder_kernel_defaults",
576 ],
577
578 version_script: "libbinder.map",
579
Andrei Homescuc485fa32023-02-22 19:45:26 +0000580 // for vndbinder
581 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000582 recovery_available: true,
583 double_loadable: true,
584 // TODO(b/153609531): remove when no longer needed.
585 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700586 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000587
588 // libbinder does not offer a stable wire protocol.
589 // if a second copy of it is installed, then it may break after security
590 // or dessert updates. Instead, apex users should use libbinder_ndk.
591 apex_available: [
592 "//apex_available:platform",
593 ],
594
595 srcs: [
596 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000597 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000598 "LazyServiceRegistrar.cpp",
599 "MemoryBase.cpp",
600 "MemoryDealer.cpp",
601 "MemoryHeapBase.cpp",
602 "ParcelableHolder.cpp",
603 "PersistableBundle.cpp",
604 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000605 target: {
606 android: {
607 // NOT static to keep the wire protocol unfrozen
608 static: {
609 enabled: false,
610 },
611 },
612 darwin: {
613 enabled: false,
614 },
615 recovery: {
616 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900617 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000618 ],
619 },
620 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800621
Yi Kong7cd72c52021-12-23 15:51:29 +0800622 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700623}
624
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700625cc_defaults {
626 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000627
628 cflags: [
629 "-DBINDER_ENABLE_LIBLOG_ASSERT",
630 "-DBINDER_DISABLE_NATIVE_HANDLE",
631 "-DBINDER_DISABLE_BLOB",
632 "-DBINDER_NO_LIBBASE",
633 ],
634
635 header_libs: [
636 "liblog_stub",
637 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700638}
639
640cc_defaults {
641 name: "libbinder_sdk_defaults",
642
643 cmake_snapshot_supported: true,
644
645 defaults: [
646 "libbinder_common_defaults",
647 "binder_sdk_defaults",
648 ],
649
650 shared_libs: [
651 "libutils_binder_sdk",
652 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000653
654 srcs: [
655 "OS_non_android_linux.cpp",
656 "OS_unix_base.cpp",
657 ],
658
659 visibility: [
660 ":__subpackages__",
661 ],
662
663 target: {
664 windows: {
665 enabled: false,
666 },
667 },
668}
669
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700670cc_library_host_shared {
671 name: "libbinder_sdk",
672 defaults: ["libbinder_sdk_defaults"],
673}
674
675cc_library_host_shared {
676 name: "libbinder_sdk_single_threaded",
677 defaults: ["libbinder_sdk_defaults"],
678 cflags: [
679 "-DBINDER_RPC_SINGLE_THREADED",
680 ],
681}
682
Steven Moreland52728212024-04-05 20:28:14 +0000683cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000684 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000685 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000686 defaults: [
687 "libbinder_common_defaults",
688 "libbinder_android_defaults",
689 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000690 visibility: [
691 ":__subpackages__",
692 ],
693}
694
Steven Moreland52728212024-04-05 20:28:14 +0000695cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000696 name: "libbinder_rpc_no_blob",
697 vendor_available: true,
698 defaults: [
699 "libbinder_common_defaults",
700 "libbinder_android_defaults",
701 "libbinder_kernel_defaults",
702 ],
703 cflags: [
704 "-DBINDER_DISABLE_BLOB",
705 ],
706 visibility: [
707 ":__subpackages__",
708 ],
709}
710
Steven Moreland52728212024-04-05 20:28:14 +0000711cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000712 name: "libbinder_rpc_no_native_handle",
713 vendor_available: true,
714 defaults: [
715 "libbinder_common_defaults",
716 "libbinder_android_defaults",
717 "libbinder_kernel_defaults",
718 ],
719 cflags: [
720 "-DBINDER_DISABLE_NATIVE_HANDLE",
721 ],
722 visibility: [
723 ":__subpackages__",
724 ],
725}
726
Steven Moreland52728212024-04-05 20:28:14 +0000727cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000728 name: "libbinder_rpc_single_threaded",
729 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000730 "libbinder_common_defaults",
731 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000732 "libbinder_kernel_defaults",
733 ],
734 cflags: [
735 "-DBINDER_RPC_SINGLE_THREADED",
736 ],
737 visibility: [
738 ":__subpackages__",
739 ],
740}
741
Steven Moreland52728212024-04-05 20:28:14 +0000742cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000743 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000744 defaults: [
745 "libbinder_common_defaults",
746 "libbinder_android_defaults",
747 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000748 cflags: [
749 "-DBINDER_RPC_SINGLE_THREADED",
750 ],
751 visibility: [
752 ":__subpackages__",
753 ],
754}
755
Yifan Honge8212f22021-06-28 15:49:08 -0700756cc_defaults {
757 name: "libbinder_tls_shared_deps",
758 shared_libs: [
759 "libbinder",
760 "libcrypto",
761 "liblog",
762 "libssl",
763 "libutils",
764 ],
765}
766
767cc_defaults {
768 name: "libbinder_tls_defaults",
769 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000770 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700771 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700772 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700773
774 header_libs: [
775 "libbinder_headers",
776 ],
777 export_header_lib_headers: [
778 "libbinder_headers",
779 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700780 export_shared_lib_headers: [
781 "libssl",
782 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700783 export_include_dirs: ["include_tls"],
784 static_libs: [
785 "libbase",
786 ],
787 srcs: [
788 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700789 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700790 ],
791}
792
793cc_library_shared {
794 name: "libbinder_tls",
795 defaults: ["libbinder_tls_defaults"],
796}
797
Andrei Homescud65666d2023-03-03 07:28:02 +0000798cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000799 name: "libbinder_trusty",
800 vendor: true,
801 srcs: [
802 "RpcTransportTipcAndroid.cpp",
803 "RpcTrusty.cpp",
804 ],
805
806 shared_libs: [
807 "libbinder",
808 "liblog",
809 "libtrusty",
810 "libutils",
811 ],
812 static_libs: [
813 "libbase",
814 ],
815 export_include_dirs: ["include_trusty"],
816
817 // Most of Android doesn't need this library and shouldn't use it,
818 // so we restrict its visibility to the Trusty-specific packages.
819 visibility: [
820 ":__subpackages__",
Orlando Arbildo2ac9f9f2025-02-20 23:40:52 +0000821 "//hardware/interfaces/security/see:__subpackages__",
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000822 "//system/core/trusty:__subpackages__",
823 "//vendor:__subpackages__",
824 ],
825}
826
Yifan Hong92409752021-07-30 21:25:32 -0700827// For testing
828cc_library_static {
829 name: "libbinder_tls_static",
830 defaults: ["libbinder_tls_defaults"],
831 visibility: [
832 ":__subpackages__",
833 ],
834}
835
Colin Cross21c210e2017-11-14 13:05:37 -0800836// AIDL interface between libbinder and framework.jar
837filegroup {
838 name: "libbinder_aidl",
839 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000840 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700841 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700842 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700843 "aidl/android/os/IServiceManager.aidl",
Alice Wang8578f132024-05-03 09:01:56 +0000844 "aidl/android/os/Service.aidl",
Parth Sane5e1b7e12024-11-29 10:40:41 +0000845 "aidl/android/os/ServiceWithMetadata.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000846 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800847 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700848 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800849}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700850
Alice Wang8578f132024-05-03 09:01:56 +0000851filegroup {
852 name: "libbinder_accessor_aidl",
853 srcs: [
854 "aidl/android/os/IAccessor.aidl",
855 ],
856 path: "aidl",
Devin Moore0555fbf2024-08-29 15:51:50 +0000857 visibility: [":__subpackages__"],
Alice Wang8578f132024-05-03 09:01:56 +0000858}
859
Samiul Islam4480b6f2021-08-26 11:41:49 +0100860aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000861 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100862 unstable: true,
863 local_include_dir: "aidl",
864 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000865 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000866 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100867 "aidl/android/content/pm/IStagedApexObserver.aidl",
868 "aidl/android/content/pm/ApexStagedEvent.aidl",
869 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000870 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900871 backend: {
872 rust: {
873 apex_available: [
Vikram Gauraed4aa92024-11-14 05:08:29 +0000874 "//apex_available:platform",
Jooyung Hanfc622692021-10-05 16:51:09 +0900875 "com.android.virt",
876 ],
877 enabled: true,
878 },
879 },
Steven Morelandf9514192021-03-26 01:34:55 +0000880}
881
Steven Moreland82c97cf2019-10-16 16:29:27 -0700882aidl_interface {
883 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900884 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700885 local_include_dir: "aidl",
886 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700887 vendor_available: true,
888 backend: {
889 java: {
890 enabled: false,
891 },
892 },
Steven Morelandae351c22023-02-13 22:01:00 +0000893 visibility: [
894 ":__subpackages__",
895 "//system/tools/aidl:__subpackages__",
896 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700897}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000898
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700899// TODO(b/184872979): remove once the Rust API is created.
900cc_library {
901 name: "libbinder_rpc_unstable",
902 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700903 shared_libs: [
904 "libbase",
905 "libbinder",
906 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000907 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700908 "libutils",
909 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900910 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700911
912 // enumerate stable entry points, for apex use
913 stubs: {
914 symbol_file: "libbinder_rpc_unstable.map.txt",
915 },
916
Devin Moorea09b5b72024-10-28 21:45:47 +0000917 header_abi_checker: {
918 enabled: false,
919 },
920
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700921 // This library is intentionally limited to these targets, and it will be removed later.
922 // Do not expand the visibility.
923 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000924 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000925 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000926 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900927 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700928 ],
929}
930
Steven Morelandea6bfab2021-04-01 00:10:31 +0000931// libbinder historically contained additional interfaces that provided specific
932// functionality in the platform but have nothing to do with binder itself. These
933// are moved out of libbinder in order to avoid the overhead of their vtables.
934// If you are working on or own one of these interfaces, the responsible things
935// to would be:
936// - give them a new home
937// - convert them to AIDL instead of having manually written parceling code
938
939cc_library {
940 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400941 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000942 srcs: [
943 "IBatteryStats.cpp",
944 ],
945 export_include_dirs: ["include_batterystats"],
946 shared_libs: [
947 "libbinder",
948 "libutils",
949 ],
950}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000951
952cc_library {
953 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400954 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000955 srcs: [
956 "IProcessInfoService.cpp",
957 "ProcessInfoService.cpp",
958 ],
959 export_include_dirs: ["include_processinfo"],
960 shared_libs: [
961 "libbinder",
962 "libutils",
963 "liblog",
964 ],
965}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000966
Steven Moreland8a2085c2021-04-05 22:01:48 +0000967cc_library {
968 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000969 srcs: [
970 "ActivityManager.cpp",
971 "IActivityManager.cpp",
972 "IUidObserver.cpp",
973 ":activity_manager_procstate_aidl",
974 ],
975 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000976 shared_libs: [
977 "libbinder",
978 "libutils",
979 "liblog",
980 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000981 aidl: {
982 export_aidl_headers: true,
983 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000984}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700985
986cc_binary {
987 name: "servicedispatcher",
988 host_supported: false,
989 srcs: [
990 "servicedispatcher.cpp",
991 ],
992 shared_libs: [
993 "libbase",
994 "libbinder",
995 "liblog",
996 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -0700997 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -0700998 ],
999}