blob: 2ef642a3a087be73e59c567b2fdfeab96a3dd33e [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
Andrei Homescu12106de2022-04-27 04:42:21 +0000480cc_defaults {
481 name: "libbinder_kernel_defaults",
Parth Sanec452eee2024-07-04 13:31:21 +0000482 defaults: ["libbinder_client_cache_flag"],
Andrei Homescu12106de2022-04-27 04:42:21 +0000483 srcs: [
484 "BufferedTextOutput.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000485 "BackendUnifiedServiceManager.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000486 "IPCThreadState.cpp",
487 "IServiceManager.cpp",
Parth Sane56a04712024-04-22 14:21:07 +0000488 "IServiceManagerFFI.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000489 "ProcessState.cpp",
490 "Static.cpp",
491 ":libbinder_aidl",
Devin Moore0555fbf2024-08-29 15:51:50 +0000492 ":libbinder_accessor_aidl",
Andrei Homescu12106de2022-04-27 04:42:21 +0000493 ":libbinder_device_interface_sources",
494 ],
495 target: {
496 vendor: {
497 exclude_srcs: [
498 ":libbinder_device_interface_sources",
499 ],
500 },
501 host: {
502 srcs: [
503 "ServiceManagerHost.cpp",
504 ],
505 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900506 android: {
507 shared_libs: [
508 "libapexsupport",
509 "libvndksupport",
510 ],
511 },
512 recovery: {
513 exclude_shared_libs: [
514 "libapexsupport",
515 "libvndksupport",
516 ],
517 },
518 native_bridge: {
519 exclude_shared_libs: [
520 "libapexsupport",
521 "libvndksupport",
522 ],
523 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000524 },
525 cflags: [
526 "-DBINDER_WITH_KERNEL_IPC",
527 ],
528}
529
530cc_library {
531 name: "libbinder",
532 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000533 "libbinder_common_defaults",
534 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000535 "libbinder_kernel_defaults",
536 ],
537
538 version_script: "libbinder.map",
539
Andrei Homescuc485fa32023-02-22 19:45:26 +0000540 // for vndbinder
541 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000542 recovery_available: true,
543 double_loadable: true,
544 // TODO(b/153609531): remove when no longer needed.
545 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700546 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000547
548 // libbinder does not offer a stable wire protocol.
549 // if a second copy of it is installed, then it may break after security
550 // or dessert updates. Instead, apex users should use libbinder_ndk.
551 apex_available: [
552 "//apex_available:platform",
553 ],
554
555 srcs: [
556 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000557 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000558 "LazyServiceRegistrar.cpp",
559 "MemoryBase.cpp",
560 "MemoryDealer.cpp",
561 "MemoryHeapBase.cpp",
562 "ParcelableHolder.cpp",
563 "PersistableBundle.cpp",
564 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000565 target: {
566 android: {
567 // NOT static to keep the wire protocol unfrozen
568 static: {
569 enabled: false,
570 },
571 },
572 darwin: {
573 enabled: false,
574 },
575 recovery: {
576 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900577 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000578 ],
579 },
580 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800581
Yi Kong7cd72c52021-12-23 15:51:29 +0800582 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700583}
584
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700585cc_defaults {
586 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000587
588 cflags: [
589 "-DBINDER_ENABLE_LIBLOG_ASSERT",
590 "-DBINDER_DISABLE_NATIVE_HANDLE",
591 "-DBINDER_DISABLE_BLOB",
592 "-DBINDER_NO_LIBBASE",
593 ],
594
595 header_libs: [
596 "liblog_stub",
597 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700598}
599
600cc_defaults {
601 name: "libbinder_sdk_defaults",
602
603 cmake_snapshot_supported: true,
604
605 defaults: [
606 "libbinder_common_defaults",
607 "binder_sdk_defaults",
608 ],
609
610 shared_libs: [
611 "libutils_binder_sdk",
612 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000613
614 srcs: [
615 "OS_non_android_linux.cpp",
616 "OS_unix_base.cpp",
617 ],
618
619 visibility: [
620 ":__subpackages__",
621 ],
622
623 target: {
624 windows: {
625 enabled: false,
626 },
627 },
628}
629
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700630cc_library_host_shared {
631 name: "libbinder_sdk",
632 defaults: ["libbinder_sdk_defaults"],
633}
634
635cc_library_host_shared {
636 name: "libbinder_sdk_single_threaded",
637 defaults: ["libbinder_sdk_defaults"],
638 cflags: [
639 "-DBINDER_RPC_SINGLE_THREADED",
640 ],
641}
642
Steven Moreland52728212024-04-05 20:28:14 +0000643cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000644 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000645 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000646 defaults: [
647 "libbinder_common_defaults",
648 "libbinder_android_defaults",
649 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000650 visibility: [
651 ":__subpackages__",
652 ],
653}
654
Steven Moreland52728212024-04-05 20:28:14 +0000655cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000656 name: "libbinder_rpc_no_blob",
657 vendor_available: true,
658 defaults: [
659 "libbinder_common_defaults",
660 "libbinder_android_defaults",
661 "libbinder_kernel_defaults",
662 ],
663 cflags: [
664 "-DBINDER_DISABLE_BLOB",
665 ],
666 visibility: [
667 ":__subpackages__",
668 ],
669}
670
Steven Moreland52728212024-04-05 20:28:14 +0000671cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000672 name: "libbinder_rpc_no_native_handle",
673 vendor_available: true,
674 defaults: [
675 "libbinder_common_defaults",
676 "libbinder_android_defaults",
677 "libbinder_kernel_defaults",
678 ],
679 cflags: [
680 "-DBINDER_DISABLE_NATIVE_HANDLE",
681 ],
682 visibility: [
683 ":__subpackages__",
684 ],
685}
686
Steven Moreland52728212024-04-05 20:28:14 +0000687cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000688 name: "libbinder_rpc_single_threaded",
689 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000690 "libbinder_common_defaults",
691 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000692 "libbinder_kernel_defaults",
693 ],
694 cflags: [
695 "-DBINDER_RPC_SINGLE_THREADED",
696 ],
697 visibility: [
698 ":__subpackages__",
699 ],
700}
701
Steven Moreland52728212024-04-05 20:28:14 +0000702cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000703 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000704 defaults: [
705 "libbinder_common_defaults",
706 "libbinder_android_defaults",
707 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000708 cflags: [
709 "-DBINDER_RPC_SINGLE_THREADED",
710 ],
711 visibility: [
712 ":__subpackages__",
713 ],
714}
715
Yifan Honge8212f22021-06-28 15:49:08 -0700716cc_defaults {
717 name: "libbinder_tls_shared_deps",
718 shared_libs: [
719 "libbinder",
720 "libcrypto",
721 "liblog",
722 "libssl",
723 "libutils",
724 ],
725}
726
727cc_defaults {
728 name: "libbinder_tls_defaults",
729 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000730 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700731 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700732 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700733
734 header_libs: [
735 "libbinder_headers",
736 ],
737 export_header_lib_headers: [
738 "libbinder_headers",
739 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700740 export_shared_lib_headers: [
741 "libssl",
742 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700743 export_include_dirs: ["include_tls"],
744 static_libs: [
745 "libbase",
746 ],
747 srcs: [
748 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700749 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700750 ],
751}
752
753cc_library_shared {
754 name: "libbinder_tls",
755 defaults: ["libbinder_tls_defaults"],
756}
757
Andrei Homescud65666d2023-03-03 07:28:02 +0000758cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000759 name: "libbinder_trusty",
760 vendor: true,
761 srcs: [
762 "RpcTransportTipcAndroid.cpp",
763 "RpcTrusty.cpp",
764 ],
765
766 shared_libs: [
767 "libbinder",
768 "liblog",
769 "libtrusty",
770 "libutils",
771 ],
772 static_libs: [
773 "libbase",
774 ],
775 export_include_dirs: ["include_trusty"],
776
777 // Most of Android doesn't need this library and shouldn't use it,
778 // so we restrict its visibility to the Trusty-specific packages.
779 visibility: [
780 ":__subpackages__",
781 "//system/core/trusty:__subpackages__",
782 "//vendor:__subpackages__",
783 ],
784}
785
Yifan Hong92409752021-07-30 21:25:32 -0700786// For testing
787cc_library_static {
788 name: "libbinder_tls_static",
789 defaults: ["libbinder_tls_defaults"],
790 visibility: [
791 ":__subpackages__",
792 ],
793}
794
Colin Cross21c210e2017-11-14 13:05:37 -0800795// AIDL interface between libbinder and framework.jar
796filegroup {
797 name: "libbinder_aidl",
798 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000799 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700800 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700801 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700802 "aidl/android/os/IServiceManager.aidl",
Alice Wang8578f132024-05-03 09:01:56 +0000803 "aidl/android/os/Service.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000804 "aidl/android/os/ServiceDebugInfo.aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800805 ],
Dan Willemsena5d65222018-09-14 21:27:01 -0700806 path: "aidl",
Colin Cross21c210e2017-11-14 13:05:37 -0800807}
Steven Moreland82c97cf2019-10-16 16:29:27 -0700808
Alice Wang8578f132024-05-03 09:01:56 +0000809filegroup {
810 name: "libbinder_accessor_aidl",
811 srcs: [
812 "aidl/android/os/IAccessor.aidl",
813 ],
814 path: "aidl",
Devin Moore0555fbf2024-08-29 15:51:50 +0000815 visibility: [":__subpackages__"],
Alice Wang8578f132024-05-03 09:01:56 +0000816}
817
Samiul Islam4480b6f2021-08-26 11:41:49 +0100818aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000819 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100820 unstable: true,
821 local_include_dir: "aidl",
822 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000823 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000824 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100825 "aidl/android/content/pm/IStagedApexObserver.aidl",
826 "aidl/android/content/pm/ApexStagedEvent.aidl",
827 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000828 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900829 backend: {
830 rust: {
831 apex_available: [
832 "com.android.virt",
833 ],
834 enabled: true,
835 },
836 },
Steven Morelandf9514192021-03-26 01:34:55 +0000837}
838
Steven Moreland82c97cf2019-10-16 16:29:27 -0700839aidl_interface {
840 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900841 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700842 local_include_dir: "aidl",
843 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700844 vendor_available: true,
845 backend: {
846 java: {
847 enabled: false,
848 },
849 },
Steven Morelandae351c22023-02-13 22:01:00 +0000850 visibility: [
851 ":__subpackages__",
852 "//system/tools/aidl:__subpackages__",
853 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700854}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000855
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700856// TODO(b/184872979): remove once the Rust API is created.
857cc_library {
858 name: "libbinder_rpc_unstable",
859 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700860 shared_libs: [
861 "libbase",
862 "libbinder",
863 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000864 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700865 "libutils",
866 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900867 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700868
869 // enumerate stable entry points, for apex use
870 stubs: {
871 symbol_file: "libbinder_rpc_unstable.map.txt",
872 },
873
Devin Moorea09b5b72024-10-28 21:45:47 +0000874 header_abi_checker: {
875 enabled: false,
876 },
877
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700878 // This library is intentionally limited to these targets, and it will be removed later.
879 // Do not expand the visibility.
880 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000881 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000882 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000883 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Raphael Blisteinefc3f602023-02-16 16:12:05 +0000884 "//system/software_defined_vehicle:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900885 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700886 ],
887}
888
Steven Morelandea6bfab2021-04-01 00:10:31 +0000889// libbinder historically contained additional interfaces that provided specific
890// functionality in the platform but have nothing to do with binder itself. These
891// are moved out of libbinder in order to avoid the overhead of their vtables.
892// If you are working on or own one of these interfaces, the responsible things
893// to would be:
894// - give them a new home
895// - convert them to AIDL instead of having manually written parceling code
896
897cc_library {
898 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400899 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000900 srcs: [
901 "IBatteryStats.cpp",
902 ],
903 export_include_dirs: ["include_batterystats"],
904 shared_libs: [
905 "libbinder",
906 "libutils",
907 ],
908}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000909
910cc_library {
911 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400912 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000913 srcs: [
914 "IProcessInfoService.cpp",
915 "ProcessInfoService.cpp",
916 ],
917 export_include_dirs: ["include_processinfo"],
918 shared_libs: [
919 "libbinder",
920 "libutils",
921 "liblog",
922 ],
923}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000924
Steven Moreland8a2085c2021-04-05 22:01:48 +0000925cc_library {
926 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000927 srcs: [
928 "ActivityManager.cpp",
929 "IActivityManager.cpp",
930 "IUidObserver.cpp",
931 ":activity_manager_procstate_aidl",
932 ],
933 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000934 shared_libs: [
935 "libbinder",
936 "libutils",
937 "liblog",
938 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000939 aidl: {
940 export_aidl_headers: true,
941 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000942}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700943
944cc_binary {
945 name: "servicedispatcher",
946 host_supported: false,
947 srcs: [
948 "servicedispatcher.cpp",
949 ],
950 shared_libs: [
951 "libbase",
952 "libbinder",
953 "liblog",
954 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -0700955 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -0700956 ],
957}