blob: fb00d4f46814d1ec6ac921d477fcea52a4429c07 [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 ],
Frederick Maylef785b792024-06-28 20:04:29 +0000280
281 target: {
282 vendor: {
283 // Trimming the exported symbols reveals a bug in vendor code, so
284 // disable it for the vendor variant for now. http://b/349657329
285 // TODO: Fix the issue and remove this override.
286 cflags: ["-fvisibility=default"],
287 },
288 },
Andrei Homescu875996f2022-08-24 04:25:11 +0000289}
290
291cc_defaults {
292 name: "libbinder_android_defaults",
293
294 // TODO(b/31559095): get headers from bionic on host
295 include_dirs: [
296 "bionic/libc/kernel/android/uapi/",
297 "bionic/libc/kernel/uapi/",
298 ],
299
300 srcs: [
Tomasz Wasilczyk0d9dec22023-10-06 20:28:49 +0000301 "OS_android.cpp",
302 "OS_unix_base.cpp",
Andrei Homescu875996f2022-08-24 04:25:11 +0000303 ],
304
Jiyong Park47f876b2018-04-17 13:56:46 +0900305 target: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700306 host: {
Yifan Hongaf766e62021-06-14 13:24:19 -0700307 srcs: [
308 "UtilsHost.cpp",
309 ],
310 },
Yi Kong60560432024-03-12 12:47:44 +0900311 android: {
312 lto: {
Jeongik Cha91486ee2024-03-12 19:35:12 +0900313 thin: true,
Yi Kong60560432024-03-12 12:47:44 +0900314 },
315 },
Jiyong Park47f876b2018-04-17 13:56:46 +0900316 },
317
Todd Kennedy757186e2017-08-02 07:49:20 -0700318 aidl: {
319 export_aidl_headers: true,
320 },
321
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700322 product_variables: {
Yifan Hong84bedeb2021-04-21 21:37:17 -0700323 debuggable: {
Sahil Somani2522b072022-08-08 14:07:47 -0700324 cflags: [
325 "-DBINDER_RPC_DEV_SERVERS",
326 "-DBINDER_ENABLE_RECORDING",
327 ],
Yifan Hong84bedeb2021-04-21 21:37:17 -0700328 },
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700329 },
330
331 shared_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000332 "libcutils",
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700333 "liblog",
Steven Morelandb27aa332023-10-09 22:22:27 +0000334 "libutils",
335 ],
336
337 static_libs: [
338 "libbase",
Steven Moreland62129012021-07-29 12:14:44 -0700339 ],
340
Jiyong Park42842052017-06-20 13:51:22 +0900341 header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900342 "jni_headers",
Steven Morelandb27aa332023-10-09 22:22:27 +0000343 "libbinder_headers",
Jiyong Park42842052017-06-20 13:51:22 +0900344 ],
345
Jiyong Park42842052017-06-20 13:51:22 +0900346 export_header_lib_headers: [
347 "libbinder_headers",
Dan Stozad630e522016-12-01 15:16:31 -0800348 ],
349
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700350 sanitize: {
351 misc_undefined: ["integer"],
352 },
Jiyong Park25265082020-11-13 16:58:57 +0900353
354 tidy: true,
355 tidy_flags: [
356 // Only check our headers
357 "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
358 ],
Steven Moreland525dd902021-04-22 23:00:04 +0000359 tidy_checks: [
360 "-performance-no-int-to-ptr",
361 ],
Jiyong Park25265082020-11-13 16:58:57 +0900362 tidy_checks_as_errors: [
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800363 // Explicitly list the checks that should not occur in this module.
364 "abseil-*",
365 "android-*",
366 "bugprone-*",
Chih-Hung Hsieh41366b42022-06-09 23:12:22 -0700367 "-bugprone-branch-clone", // b/155034972
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800368 "cert-*",
369 "clang-analyzer-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800370 "google-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800371 "misc-*",
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800372 "performance*",
Steven Moreland67f85902023-03-15 01:13:49 +0000373 "-performance-move-const-arg", // b/273486801
Chih-Hung Hsieh09d11b32021-01-11 21:29:01 -0800374 "portability*",
Jiyong Park25265082020-11-13 16:58:57 +0900375 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000376}
377
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000378cc_library_headers {
379 name: "trusty_mock_headers",
380 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000381 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000382
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000383 export_include_dirs: [
384 "trusty/include",
385 "trusty/include_mock",
386 ],
387
388 visibility: [
389 ":__subpackages__",
390 ],
391}
392
393cc_defaults {
394 name: "trusty_mock_defaults",
Andrei Homescu4d9420e2023-01-31 01:38:48 +0000395 host_supported: true,
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000396 vendor_available: true,
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000397
398 header_libs: [
Steven Morelandb27aa332023-10-09 22:22:27 +0000399 "libbinder_headers_base",
Tomasz Wasilczykc7c22ea2023-11-30 20:13:44 -0800400 "liblog_stub",
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000401 "trusty_mock_headers",
Andrei Homescu875996f2022-08-24 04:25:11 +0000402 ],
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000403 export_header_lib_headers: [
404 "libbinder_headers_base",
405 "liblog_stub",
406 "trusty_mock_headers",
407 ],
Andrei Homescu875996f2022-08-24 04:25:11 +0000408
Steven Morelandb27aa332023-10-09 22:22:27 +0000409 shared_libs: [
410 "libutils_binder_sdk",
411 ],
412
Andrei Homescu875996f2022-08-24 04:25:11 +0000413 cflags: [
414 "-DBINDER_RPC_SINGLE_THREADED",
Tomasz Wasilczyk83780132023-11-29 21:39:29 -0800415 "-DBINDER_ENABLE_LIBLOG_ASSERT",
Tomasz Wasilczykbe685c02023-11-30 20:20:53 -0800416 "-DBINDER_DISABLE_NATIVE_HANDLE",
417 "-DBINDER_DISABLE_BLOB",
418 "-DBINDER_NO_LIBBASE",
Steven Morelandd5beffc2023-12-15 21:58:38 +0000419 // TODO: switch to "vendor: true" rather than copying this
Andrei Homescu875996f2022-08-24 04:25:11 +0000420 // Trusty libbinder uses vendor stability for its binders
Steven Morelandd5beffc2023-12-15 21:58:38 +0000421 "-D__ANDROID_VENDOR__",
Andrei Homescu875996f2022-08-24 04:25:11 +0000422 "-D__ANDROID_VNDK__",
423 "-U__ANDROID__",
424 "-D__TRUSTY__",
425 "-DTRUSTY_USERSPACE",
426 // Flags from the Trusty build system
427 "-Werror",
428 "-Wsign-compare",
429 "-Wno-unused-function",
430 "-Wno-unused-label",
431 "-fno-common",
432 "-fno-omit-frame-pointer",
433 "-fno-threadsafe-statics",
434 ],
435 rtti: false,
436
Andrei Homescu875996f2022-08-24 04:25:11 +0000437 visibility: [
438 ":__subpackages__",
439 ],
440}
441
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000442cc_library_shared {
443 name: "libbinder_on_trusty_mock",
444 defaults: [
445 "libbinder_common_defaults",
446 "trusty_mock_defaults",
447 ],
448
449 srcs: [
450 // Trusty-specific files
Andrei Homescu9d8adb12022-08-02 04:38:30 +0000451 "trusty/OS.cpp",
452 "trusty/RpcServerTrusty.cpp",
453 "trusty/RpcTransportTipcTrusty.cpp",
454 "trusty/TrustyStatus.cpp",
455 "trusty/socket.cpp",
456 ],
457}
458
Parth Sanec452eee2024-07-04 13:31:21 +0000459soong_config_module_type {
Parth Sane5e1b7e12024-11-29 10:40:41 +0000460 name: "libbinder_remove_cache_static_list_config",
461 module_type: "cc_defaults",
462 config_namespace: "libbinder",
463 bool_variables: ["release_libbinder_remove_cache_static_list"],
464 properties: [
465 "cflags",
466 ],
467}
468
469libbinder_remove_cache_static_list_config {
470 name: "libbinder_remove_cache_static_list_flag",
471 soong_config_variables: {
472 release_libbinder_remove_cache_static_list: {
473 cflags: ["-DLIBBINDER_REMOVE_CACHE_STATIC_LIST"],
474 conditions_default: {
475 cflags: ["-DNO_LIBBINDER_REMOVE_CACHE_STATIC_LIST"],
476 },
477 },
478 },
479}
480
481soong_config_module_type {
Parth Sanec452eee2024-07-04 13:31:21 +0000482 name: "libbinder_client_cache_config",
483 module_type: "cc_defaults",
484 config_namespace: "libbinder",
485 bool_variables: ["release_libbinder_client_cache"],
486 properties: [
487 "cflags",
488 ],
489}
490
491libbinder_client_cache_config {
492 name: "libbinder_client_cache_flag",
493 soong_config_variables: {
494 release_libbinder_client_cache: {
495 cflags: ["-DLIBBINDER_CLIENT_CACHE"],
496 conditions_default: {
497 cflags: ["-DNO_LIBBINDER_CLIENT_CACHE"],
498 },
499 },
500 },
501}
502
Parth Sanedc207542024-11-14 11:49:08 +0000503soong_config_module_type {
504 name: "libbinder_addservice_cache_config",
505 module_type: "cc_defaults",
506 config_namespace: "libbinder",
507 bool_variables: ["release_libbinder_addservice_cache"],
508 properties: [
509 "cflags",
510 ],
511}
512
513libbinder_addservice_cache_config {
514 name: "libbinder_addservice_cache_flag",
515 soong_config_variables: {
516 release_libbinder_addservice_cache: {
517 cflags: ["-DLIBBINDER_ADDSERVICE_CACHE"],
518 conditions_default: {
519 cflags: ["-DNO_LIBBINDER_ADDSERVICE_CACHE"],
520 },
521 },
522 },
523}
524
Andrei Homescu12106de2022-04-27 04:42:21 +0000525cc_defaults {
526 name: "libbinder_kernel_defaults",
Parth Sanedc207542024-11-14 11:49:08 +0000527 defaults: [
528 "libbinder_client_cache_flag",
529 "libbinder_addservice_cache_flag",
Parth Sane5e1b7e12024-11-29 10:40:41 +0000530 "libbinder_remove_cache_static_list_flag",
Parth Sanedc207542024-11-14 11:49:08 +0000531 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000532 srcs: [
533 "BufferedTextOutput.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000534 "BackendUnifiedServiceManager.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000535 "IPCThreadState.cpp",
536 "IServiceManager.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000537 "IServiceManagerFFI.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000538 "ProcessState.cpp",
539 "Static.cpp",
540 ":libbinder_aidl",
Devin Moore0555fbf2024-08-29 15:51:50 +0000541 ":libbinder_accessor_aidl",
Andrei Homescu12106de2022-04-27 04:42:21 +0000542 ":libbinder_device_interface_sources",
543 ],
544 target: {
545 vendor: {
546 exclude_srcs: [
547 ":libbinder_device_interface_sources",
548 ],
549 },
550 host: {
551 srcs: [
552 "ServiceManagerHost.cpp",
553 ],
554 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900555 android: {
556 shared_libs: [
557 "libapexsupport",
558 "libvndksupport",
559 ],
560 },
561 recovery: {
562 exclude_shared_libs: [
563 "libapexsupport",
564 "libvndksupport",
565 ],
566 },
567 native_bridge: {
568 exclude_shared_libs: [
569 "libapexsupport",
570 "libvndksupport",
571 ],
572 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000573 },
574 cflags: [
575 "-DBINDER_WITH_KERNEL_IPC",
576 ],
577}
578
579cc_library {
580 name: "libbinder",
581 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000582 "libbinder_common_defaults",
583 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000584 "libbinder_kernel_defaults",
585 ],
586
587 version_script: "libbinder.map",
588
Andrei Homescuc485fa32023-02-22 19:45:26 +0000589 // for vndbinder
590 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000591 recovery_available: true,
592 double_loadable: true,
593 // TODO(b/153609531): remove when no longer needed.
594 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700595 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000596
597 // libbinder does not offer a stable wire protocol.
598 // if a second copy of it is installed, then it may break after security
599 // or dessert updates. Instead, apex users should use libbinder_ndk.
600 apex_available: [
601 "//apex_available:platform",
602 ],
603
604 srcs: [
605 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000606 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000607 "LazyServiceRegistrar.cpp",
608 "MemoryBase.cpp",
609 "MemoryDealer.cpp",
610 "MemoryHeapBase.cpp",
611 "ParcelableHolder.cpp",
612 "PersistableBundle.cpp",
613 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000614 target: {
615 android: {
616 // NOT static to keep the wire protocol unfrozen
617 static: {
618 enabled: false,
619 },
620 },
621 darwin: {
622 enabled: false,
623 },
624 recovery: {
625 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900626 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000627 ],
628 },
629 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800630
Yi Kong7cd72c52021-12-23 15:51:29 +0800631 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700632}
633
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700634cc_defaults {
635 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000636
637 cflags: [
638 "-DBINDER_ENABLE_LIBLOG_ASSERT",
639 "-DBINDER_DISABLE_NATIVE_HANDLE",
640 "-DBINDER_DISABLE_BLOB",
641 "-DBINDER_NO_LIBBASE",
642 ],
643
644 header_libs: [
645 "liblog_stub",
646 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700647}
648
649cc_defaults {
650 name: "libbinder_sdk_defaults",
651
652 cmake_snapshot_supported: true,
653
654 defaults: [
655 "libbinder_common_defaults",
656 "binder_sdk_defaults",
657 ],
658
659 shared_libs: [
660 "libutils_binder_sdk",
661 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000662
663 srcs: [
664 "OS_non_android_linux.cpp",
665 "OS_unix_base.cpp",
666 ],
667
668 visibility: [
669 ":__subpackages__",
670 ],
671
672 target: {
673 windows: {
674 enabled: false,
675 },
676 },
677}
678
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700679cc_library_host_shared {
680 name: "libbinder_sdk",
681 defaults: ["libbinder_sdk_defaults"],
682}
683
684cc_library_host_shared {
685 name: "libbinder_sdk_single_threaded",
686 defaults: ["libbinder_sdk_defaults"],
687 cflags: [
688 "-DBINDER_RPC_SINGLE_THREADED",
689 ],
690}
691
Steven Moreland52728212024-04-05 20:28:14 +0000692cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000693 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000694 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000695 defaults: [
696 "libbinder_common_defaults",
697 "libbinder_android_defaults",
698 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000699 visibility: [
700 ":__subpackages__",
701 ],
702}
703
Steven Moreland52728212024-04-05 20:28:14 +0000704cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000705 name: "libbinder_rpc_no_blob",
706 vendor_available: true,
707 defaults: [
708 "libbinder_common_defaults",
709 "libbinder_android_defaults",
710 "libbinder_kernel_defaults",
711 ],
712 cflags: [
713 "-DBINDER_DISABLE_BLOB",
714 ],
715 visibility: [
716 ":__subpackages__",
717 ],
718}
719
Steven Moreland52728212024-04-05 20:28:14 +0000720cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000721 name: "libbinder_rpc_no_native_handle",
722 vendor_available: true,
723 defaults: [
724 "libbinder_common_defaults",
725 "libbinder_android_defaults",
726 "libbinder_kernel_defaults",
727 ],
728 cflags: [
729 "-DBINDER_DISABLE_NATIVE_HANDLE",
730 ],
731 visibility: [
732 ":__subpackages__",
733 ],
734}
735
Steven Moreland52728212024-04-05 20:28:14 +0000736cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000737 name: "libbinder_rpc_single_threaded",
738 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000739 "libbinder_common_defaults",
740 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000741 "libbinder_kernel_defaults",
742 ],
743 cflags: [
744 "-DBINDER_RPC_SINGLE_THREADED",
745 ],
746 visibility: [
747 ":__subpackages__",
748 ],
749}
750
Steven Moreland52728212024-04-05 20:28:14 +0000751cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000752 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000753 defaults: [
754 "libbinder_common_defaults",
755 "libbinder_android_defaults",
756 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000757 cflags: [
758 "-DBINDER_RPC_SINGLE_THREADED",
759 ],
760 visibility: [
761 ":__subpackages__",
762 ],
763}
764
Yifan Honge8212f22021-06-28 15:49:08 -0700765cc_defaults {
766 name: "libbinder_tls_shared_deps",
767 shared_libs: [
768 "libbinder",
769 "libcrypto",
770 "liblog",
771 "libssl",
772 "libutils",
773 ],
774}
775
776cc_defaults {
777 name: "libbinder_tls_defaults",
778 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000779 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700780 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700781 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700782
783 header_libs: [
784 "libbinder_headers",
785 ],
786 export_header_lib_headers: [
787 "libbinder_headers",
788 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700789 export_shared_lib_headers: [
790 "libssl",
791 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700792 export_include_dirs: ["include_tls"],
793 static_libs: [
794 "libbase",
795 ],
796 srcs: [
797 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700798 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700799 ],
800}
801
802cc_library_shared {
803 name: "libbinder_tls",
804 defaults: ["libbinder_tls_defaults"],
805}
806
Andrei Homescud65666d2023-03-03 07:28:02 +0000807cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000808 name: "libbinder_trusty",
809 vendor: true,
810 srcs: [
811 "RpcTransportTipcAndroid.cpp",
812 "RpcTrusty.cpp",
813 ],
814
815 shared_libs: [
816 "libbinder",
817 "liblog",
818 "libtrusty",
819 "libutils",
820 ],
821 static_libs: [
822 "libbase",
823 ],
824 export_include_dirs: ["include_trusty"],
825
826 // Most of Android doesn't need this library and shouldn't use it,
827 // so we restrict its visibility to the Trusty-specific packages.
828 visibility: [
829 ":__subpackages__",
830 "//system/core/trusty:__subpackages__",
831 "//vendor:__subpackages__",
832 ],
833}
834
Yifan Hong92409752021-07-30 21:25:32 -0700835// For testing
836cc_library_static {
837 name: "libbinder_tls_static",
838 defaults: ["libbinder_tls_defaults"],
839 visibility: [
840 ":__subpackages__",
841 ],
842}
843
Colin Cross21c210e2017-11-14 13:05:37 -0800844// AIDL interface between libbinder and framework.jar
845filegroup {
846 name: "libbinder_aidl",
847 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000848 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700849 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700850 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700851 "aidl/android/os/IServiceManager.aidl",
Alice Wang8578f132024-05-03 09:01:56 +0000852 "aidl/android/os/Service.aidl",
Parth Sane5e1b7e12024-11-29 10:40:41 +0000853 "aidl/android/os/ServiceWithMetadata.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000854 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800855 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700856 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800857}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700858
Alice Wang8578f132024-05-03 09:01:56 +0000859filegroup {
860 name: "libbinder_accessor_aidl",
861 srcs: [
862 "aidl/android/os/IAccessor.aidl",
863 ],
864 path: "aidl",
Devin Moore0555fbf2024-08-29 15:51:50 +0000865 visibility: [":__subpackages__"],
Alice Wang8578f132024-05-03 09:01:56 +0000866}
867
Samiul Islam4480b6f2021-08-26 11:41:49 +0100868aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000869 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100870 unstable: true,
871 local_include_dir: "aidl",
872 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000873 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000874 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100875 "aidl/android/content/pm/IStagedApexObserver.aidl",
876 "aidl/android/content/pm/ApexStagedEvent.aidl",
877 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000878 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900879 backend: {
880 rust: {
881 apex_available: [
Vikram Gauraed4aa92024-11-14 05:08:29 +0000882 "//apex_available:platform",
Jooyung Hanfc622692021-10-05 16:51:09 +0900883 "com.android.virt",
884 ],
885 enabled: true,
886 },
887 },
Steven Morelandf9514192021-03-26 01:34:55 +0000888}
889
Steven Moreland82c97cf2019-10-16 16:29:27 -0700890aidl_interface {
891 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900892 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700893 local_include_dir: "aidl",
894 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700895 vendor_available: true,
896 backend: {
897 java: {
898 enabled: false,
899 },
900 },
Steven Morelandae351c22023-02-13 22:01:00 +0000901 visibility: [
902 ":__subpackages__",
903 "//system/tools/aidl:__subpackages__",
904 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700905}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000906
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700907// TODO(b/184872979): remove once the Rust API is created.
908cc_library {
909 name: "libbinder_rpc_unstable",
910 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700911 shared_libs: [
912 "libbase",
913 "libbinder",
914 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000915 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700916 "libutils",
917 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900918 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700919
920 // enumerate stable entry points, for apex use
921 stubs: {
922 symbol_file: "libbinder_rpc_unstable.map.txt",
923 },
924
Devin Moorea09b5b72024-10-28 21:45:47 +0000925 header_abi_checker: {
926 enabled: false,
927 },
928
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700929 // This library is intentionally limited to these targets, and it will be removed later.
930 // Do not expand the visibility.
931 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000932 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000933 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000934 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900935 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700936 ],
937}
938
Steven Morelandea6bfab2021-04-01 00:10:31 +0000939// libbinder historically contained additional interfaces that provided specific
940// functionality in the platform but have nothing to do with binder itself. These
941// are moved out of libbinder in order to avoid the overhead of their vtables.
942// If you are working on or own one of these interfaces, the responsible things
943// to would be:
944// - give them a new home
945// - convert them to AIDL instead of having manually written parceling code
946
947cc_library {
948 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400949 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000950 srcs: [
951 "IBatteryStats.cpp",
952 ],
953 export_include_dirs: ["include_batterystats"],
954 shared_libs: [
955 "libbinder",
956 "libutils",
957 ],
958}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000959
960cc_library {
961 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400962 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000963 srcs: [
964 "IProcessInfoService.cpp",
965 "ProcessInfoService.cpp",
966 ],
967 export_include_dirs: ["include_processinfo"],
968 shared_libs: [
969 "libbinder",
970 "libutils",
971 "liblog",
972 ],
973}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000974
Steven Moreland8a2085c2021-04-05 22:01:48 +0000975cc_library {
976 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000977 srcs: [
978 "ActivityManager.cpp",
979 "IActivityManager.cpp",
980 "IUidObserver.cpp",
981 ":activity_manager_procstate_aidl",
982 ],
983 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000984 shared_libs: [
985 "libbinder",
986 "libutils",
987 "liblog",
988 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000989 aidl: {
990 export_aidl_headers: true,
991 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000992}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700993
994cc_binary {
995 name: "servicedispatcher",
996 host_supported: false,
997 srcs: [
998 "servicedispatcher.cpp",
999 ],
1000 shared_libs: [
1001 "libbase",
1002 "libbinder",
1003 "liblog",
1004 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -07001005 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -07001006 ],
1007}