blob: e10e4ddc23eb4ced6bb482fc78b93cb4273111f6 [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 {
459 name: "libbinder_client_cache_config",
460 module_type: "cc_defaults",
461 config_namespace: "libbinder",
462 bool_variables: ["release_libbinder_client_cache"],
463 properties: [
464 "cflags",
465 ],
466}
467
468libbinder_client_cache_config {
469 name: "libbinder_client_cache_flag",
470 soong_config_variables: {
471 release_libbinder_client_cache: {
472 cflags: ["-DLIBBINDER_CLIENT_CACHE"],
473 conditions_default: {
474 cflags: ["-DNO_LIBBINDER_CLIENT_CACHE"],
475 },
476 },
477 },
478}
479
Parth Sanedc207542024-11-14 11:49:08 +0000480soong_config_module_type {
481 name: "libbinder_addservice_cache_config",
482 module_type: "cc_defaults",
483 config_namespace: "libbinder",
484 bool_variables: ["release_libbinder_addservice_cache"],
485 properties: [
486 "cflags",
487 ],
488}
489
490libbinder_addservice_cache_config {
491 name: "libbinder_addservice_cache_flag",
492 soong_config_variables: {
493 release_libbinder_addservice_cache: {
494 cflags: ["-DLIBBINDER_ADDSERVICE_CACHE"],
495 conditions_default: {
496 cflags: ["-DNO_LIBBINDER_ADDSERVICE_CACHE"],
497 },
498 },
499 },
500}
501
Andrei Homescu12106de2022-04-27 04:42:21 +0000502cc_defaults {
503 name: "libbinder_kernel_defaults",
Parth Sanedc207542024-11-14 11:49:08 +0000504 defaults: [
505 "libbinder_client_cache_flag",
506 "libbinder_addservice_cache_flag",
507 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000508 srcs: [
509 "BufferedTextOutput.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000510 "BackendUnifiedServiceManager.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000511 "IPCThreadState.cpp",
512 "IServiceManager.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000513 "IServiceManagerFFI.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000514 "ProcessState.cpp",
515 "Static.cpp",
516 ":libbinder_aidl",
Devin Moore0555fbf2024-08-29 15:51:50 +0000517 ":libbinder_accessor_aidl",
Andrei Homescu12106de2022-04-27 04:42:21 +0000518 ":libbinder_device_interface_sources",
519 ],
520 target: {
521 vendor: {
522 exclude_srcs: [
523 ":libbinder_device_interface_sources",
524 ],
525 },
526 host: {
527 srcs: [
528 "ServiceManagerHost.cpp",
529 ],
530 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900531 android: {
532 shared_libs: [
533 "libapexsupport",
534 "libvndksupport",
535 ],
536 },
537 recovery: {
538 exclude_shared_libs: [
539 "libapexsupport",
540 "libvndksupport",
541 ],
542 },
543 native_bridge: {
544 exclude_shared_libs: [
545 "libapexsupport",
546 "libvndksupport",
547 ],
548 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000549 },
550 cflags: [
551 "-DBINDER_WITH_KERNEL_IPC",
552 ],
553}
554
555cc_library {
556 name: "libbinder",
557 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000558 "libbinder_common_defaults",
559 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000560 "libbinder_kernel_defaults",
561 ],
562
563 version_script: "libbinder.map",
564
Andrei Homescuc485fa32023-02-22 19:45:26 +0000565 // for vndbinder
566 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000567 recovery_available: true,
568 double_loadable: true,
569 // TODO(b/153609531): remove when no longer needed.
570 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700571 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000572
573 // libbinder does not offer a stable wire protocol.
574 // if a second copy of it is installed, then it may break after security
575 // or dessert updates. Instead, apex users should use libbinder_ndk.
576 apex_available: [
577 "//apex_available:platform",
578 ],
579
580 srcs: [
581 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000582 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000583 "LazyServiceRegistrar.cpp",
584 "MemoryBase.cpp",
585 "MemoryDealer.cpp",
586 "MemoryHeapBase.cpp",
587 "ParcelableHolder.cpp",
588 "PersistableBundle.cpp",
589 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000590 target: {
591 android: {
592 // NOT static to keep the wire protocol unfrozen
593 static: {
594 enabled: false,
595 },
596 },
597 darwin: {
598 enabled: false,
599 },
600 recovery: {
601 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900602 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000603 ],
604 },
605 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800606
Yi Kong7cd72c52021-12-23 15:51:29 +0800607 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700608}
609
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700610cc_defaults {
611 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000612
613 cflags: [
614 "-DBINDER_ENABLE_LIBLOG_ASSERT",
615 "-DBINDER_DISABLE_NATIVE_HANDLE",
616 "-DBINDER_DISABLE_BLOB",
617 "-DBINDER_NO_LIBBASE",
618 ],
619
620 header_libs: [
621 "liblog_stub",
622 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700623}
624
625cc_defaults {
626 name: "libbinder_sdk_defaults",
627
628 cmake_snapshot_supported: true,
629
630 defaults: [
631 "libbinder_common_defaults",
632 "binder_sdk_defaults",
633 ],
634
635 shared_libs: [
636 "libutils_binder_sdk",
637 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000638
639 srcs: [
640 "OS_non_android_linux.cpp",
641 "OS_unix_base.cpp",
642 ],
643
644 visibility: [
645 ":__subpackages__",
646 ],
647
648 target: {
649 windows: {
650 enabled: false,
651 },
652 },
653}
654
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700655cc_library_host_shared {
656 name: "libbinder_sdk",
657 defaults: ["libbinder_sdk_defaults"],
658}
659
660cc_library_host_shared {
661 name: "libbinder_sdk_single_threaded",
662 defaults: ["libbinder_sdk_defaults"],
663 cflags: [
664 "-DBINDER_RPC_SINGLE_THREADED",
665 ],
666}
667
Steven Moreland52728212024-04-05 20:28:14 +0000668cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000669 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000670 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000671 defaults: [
672 "libbinder_common_defaults",
673 "libbinder_android_defaults",
674 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000675 visibility: [
676 ":__subpackages__",
677 ],
678}
679
Steven Moreland52728212024-04-05 20:28:14 +0000680cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000681 name: "libbinder_rpc_no_blob",
682 vendor_available: true,
683 defaults: [
684 "libbinder_common_defaults",
685 "libbinder_android_defaults",
686 "libbinder_kernel_defaults",
687 ],
688 cflags: [
689 "-DBINDER_DISABLE_BLOB",
690 ],
691 visibility: [
692 ":__subpackages__",
693 ],
694}
695
Steven Moreland52728212024-04-05 20:28:14 +0000696cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000697 name: "libbinder_rpc_no_native_handle",
698 vendor_available: true,
699 defaults: [
700 "libbinder_common_defaults",
701 "libbinder_android_defaults",
702 "libbinder_kernel_defaults",
703 ],
704 cflags: [
705 "-DBINDER_DISABLE_NATIVE_HANDLE",
706 ],
707 visibility: [
708 ":__subpackages__",
709 ],
710}
711
Steven Moreland52728212024-04-05 20:28:14 +0000712cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000713 name: "libbinder_rpc_single_threaded",
714 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000715 "libbinder_common_defaults",
716 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000717 "libbinder_kernel_defaults",
718 ],
719 cflags: [
720 "-DBINDER_RPC_SINGLE_THREADED",
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_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000729 defaults: [
730 "libbinder_common_defaults",
731 "libbinder_android_defaults",
732 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000733 cflags: [
734 "-DBINDER_RPC_SINGLE_THREADED",
735 ],
736 visibility: [
737 ":__subpackages__",
738 ],
739}
740
Yifan Honge8212f22021-06-28 15:49:08 -0700741cc_defaults {
742 name: "libbinder_tls_shared_deps",
743 shared_libs: [
744 "libbinder",
745 "libcrypto",
746 "liblog",
747 "libssl",
748 "libutils",
749 ],
750}
751
752cc_defaults {
753 name: "libbinder_tls_defaults",
754 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000755 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700756 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700757 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700758
759 header_libs: [
760 "libbinder_headers",
761 ],
762 export_header_lib_headers: [
763 "libbinder_headers",
764 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700765 export_shared_lib_headers: [
766 "libssl",
767 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700768 export_include_dirs: ["include_tls"],
769 static_libs: [
770 "libbase",
771 ],
772 srcs: [
773 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700774 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700775 ],
776}
777
778cc_library_shared {
779 name: "libbinder_tls",
780 defaults: ["libbinder_tls_defaults"],
781}
782
Andrei Homescud65666d2023-03-03 07:28:02 +0000783cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000784 name: "libbinder_trusty",
785 vendor: true,
786 srcs: [
787 "RpcTransportTipcAndroid.cpp",
788 "RpcTrusty.cpp",
789 ],
790
791 shared_libs: [
792 "libbinder",
793 "liblog",
794 "libtrusty",
795 "libutils",
796 ],
797 static_libs: [
798 "libbase",
799 ],
800 export_include_dirs: ["include_trusty"],
801
802 // Most of Android doesn't need this library and shouldn't use it,
803 // so we restrict its visibility to the Trusty-specific packages.
804 visibility: [
805 ":__subpackages__",
806 "//system/core/trusty:__subpackages__",
807 "//vendor:__subpackages__",
808 ],
809}
810
Yifan Hong92409752021-07-30 21:25:32 -0700811// For testing
812cc_library_static {
813 name: "libbinder_tls_static",
814 defaults: ["libbinder_tls_defaults"],
815 visibility: [
816 ":__subpackages__",
817 ],
818}
819
Colin Cross21c210e2017-11-14 13:05:37 -0800820// AIDL interface between libbinder and framework.jar
821filegroup {
822 name: "libbinder_aidl",
823 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000824 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700825 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700826 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700827 "aidl/android/os/IServiceManager.aidl",
Alice Wang8578f132024-05-03 09:01:56 +0000828 "aidl/android/os/Service.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000829 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800830 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700831 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800832}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700833
Alice Wang8578f132024-05-03 09:01:56 +0000834filegroup {
835 name: "libbinder_accessor_aidl",
836 srcs: [
837 "aidl/android/os/IAccessor.aidl",
838 ],
839 path: "aidl",
Devin Moore0555fbf2024-08-29 15:51:50 +0000840 visibility: [":__subpackages__"],
Alice Wang8578f132024-05-03 09:01:56 +0000841}
842
Samiul Islam4480b6f2021-08-26 11:41:49 +0100843aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000844 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100845 unstable: true,
846 local_include_dir: "aidl",
847 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000848 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000849 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100850 "aidl/android/content/pm/IStagedApexObserver.aidl",
851 "aidl/android/content/pm/ApexStagedEvent.aidl",
852 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000853 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900854 backend: {
855 rust: {
856 apex_available: [
Vikram Gauraed4aa92024-11-14 05:08:29 +0000857 "//apex_available:platform",
Jooyung Hanfc622692021-10-05 16:51:09 +0900858 "com.android.virt",
859 ],
860 enabled: true,
861 },
862 },
Steven Morelandf9514192021-03-26 01:34:55 +0000863}
864
Steven Moreland82c97cf2019-10-16 16:29:27 -0700865aidl_interface {
866 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900867 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700868 local_include_dir: "aidl",
869 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700870 vendor_available: true,
871 backend: {
872 java: {
873 enabled: false,
874 },
875 },
Steven Morelandae351c22023-02-13 22:01:00 +0000876 visibility: [
877 ":__subpackages__",
878 "//system/tools/aidl:__subpackages__",
879 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700880}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000881
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700882// TODO(b/184872979): remove once the Rust API is created.
883cc_library {
884 name: "libbinder_rpc_unstable",
885 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700886 shared_libs: [
887 "libbase",
888 "libbinder",
889 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000890 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700891 "libutils",
892 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900893 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700894
895 // enumerate stable entry points, for apex use
896 stubs: {
897 symbol_file: "libbinder_rpc_unstable.map.txt",
898 },
899
Devin Moorea09b5b72024-10-28 21:45:47 +0000900 header_abi_checker: {
901 enabled: false,
902 },
903
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700904 // This library is intentionally limited to these targets, and it will be removed later.
905 // Do not expand the visibility.
906 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000907 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000908 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000909 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900910 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700911 ],
912}
913
Steven Morelandea6bfab2021-04-01 00:10:31 +0000914// libbinder historically contained additional interfaces that provided specific
915// functionality in the platform but have nothing to do with binder itself. These
916// are moved out of libbinder in order to avoid the overhead of their vtables.
917// If you are working on or own one of these interfaces, the responsible things
918// to would be:
919// - give them a new home
920// - convert them to AIDL instead of having manually written parceling code
921
922cc_library {
923 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400924 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000925 srcs: [
926 "IBatteryStats.cpp",
927 ],
928 export_include_dirs: ["include_batterystats"],
929 shared_libs: [
930 "libbinder",
931 "libutils",
932 ],
933}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000934
935cc_library {
936 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400937 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000938 srcs: [
939 "IProcessInfoService.cpp",
940 "ProcessInfoService.cpp",
941 ],
942 export_include_dirs: ["include_processinfo"],
943 shared_libs: [
944 "libbinder",
945 "libutils",
946 "liblog",
947 ],
948}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000949
Steven Moreland8a2085c2021-04-05 22:01:48 +0000950cc_library {
951 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000952 srcs: [
953 "ActivityManager.cpp",
954 "IActivityManager.cpp",
955 "IUidObserver.cpp",
956 ":activity_manager_procstate_aidl",
957 ],
958 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000959 shared_libs: [
960 "libbinder",
961 "libutils",
962 "liblog",
963 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000964 aidl: {
965 export_aidl_headers: true,
966 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000967}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700968
969cc_binary {
970 name: "servicedispatcher",
971 host_supported: false,
972 srcs: [
973 "servicedispatcher.cpp",
974 ],
975 shared_libs: [
976 "libbase",
977 "libbinder",
978 "liblog",
979 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -0700980 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -0700981 ],
982}