blob: 379b609e9fe3f5e66e0fe38ce8398854aea56a13 [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",
492 ":libbinder_device_interface_sources",
493 ],
494 target: {
495 vendor: {
496 exclude_srcs: [
497 ":libbinder_device_interface_sources",
498 ],
499 },
500 host: {
501 srcs: [
502 "ServiceManagerHost.cpp",
503 ],
504 },
Jooyung Han75fc06f2024-02-03 03:56:59 +0900505 android: {
506 shared_libs: [
507 "libapexsupport",
508 "libvndksupport",
509 ],
510 },
511 recovery: {
512 exclude_shared_libs: [
513 "libapexsupport",
514 "libvndksupport",
515 ],
516 },
517 native_bridge: {
518 exclude_shared_libs: [
519 "libapexsupport",
520 "libvndksupport",
521 ],
522 },
Andrei Homescu12106de2022-04-27 04:42:21 +0000523 },
524 cflags: [
525 "-DBINDER_WITH_KERNEL_IPC",
526 ],
527}
528
529cc_library {
530 name: "libbinder",
531 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000532 "libbinder_common_defaults",
533 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000534 "libbinder_kernel_defaults",
535 ],
536
537 version_script: "libbinder.map",
538
Andrei Homescuc485fa32023-02-22 19:45:26 +0000539 // for vndbinder
540 vendor_available: true,
Andrei Homescu12106de2022-04-27 04:42:21 +0000541 recovery_available: true,
542 double_loadable: true,
543 // TODO(b/153609531): remove when no longer needed.
544 native_bridge_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700545 cmake_snapshot_supported: false,
Andrei Homescu12106de2022-04-27 04:42:21 +0000546
547 // libbinder does not offer a stable wire protocol.
548 // if a second copy of it is installed, then it may break after security
549 // or dessert updates. Instead, apex users should use libbinder_ndk.
550 apex_available: [
551 "//apex_available:platform",
552 ],
553
554 srcs: [
555 "IMemory.cpp",
Andrei Homescua543a842022-07-07 22:17:55 +0000556 "IShellCallback.cpp",
Andrei Homescu12106de2022-04-27 04:42:21 +0000557 "LazyServiceRegistrar.cpp",
558 "MemoryBase.cpp",
559 "MemoryDealer.cpp",
560 "MemoryHeapBase.cpp",
561 "ParcelableHolder.cpp",
562 "PersistableBundle.cpp",
563 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000564 target: {
565 android: {
566 // NOT static to keep the wire protocol unfrozen
567 static: {
568 enabled: false,
569 },
570 },
571 darwin: {
572 enabled: false,
573 },
574 recovery: {
575 exclude_header_libs: [
Jeongik Cha0c47d452022-10-20 00:07:55 +0900576 "jni_headers",
Andrei Homescu12106de2022-04-27 04:42:21 +0000577 ],
578 },
579 },
Yi Kong054f2fa2021-03-05 01:50:23 +0800580
Yi Kong7cd72c52021-12-23 15:51:29 +0800581 afdo: true,
Dan Willemsene05dc6d2016-07-25 17:13:45 -0700582}
583
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700584cc_defaults {
585 name: "binder_sdk_defaults",
Steven Morelandb27aa332023-10-09 22:22:27 +0000586
587 cflags: [
588 "-DBINDER_ENABLE_LIBLOG_ASSERT",
589 "-DBINDER_DISABLE_NATIVE_HANDLE",
590 "-DBINDER_DISABLE_BLOB",
591 "-DBINDER_NO_LIBBASE",
592 ],
593
594 header_libs: [
595 "liblog_stub",
596 ],
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700597}
598
599cc_defaults {
600 name: "libbinder_sdk_defaults",
601
602 cmake_snapshot_supported: true,
603
604 defaults: [
605 "libbinder_common_defaults",
606 "binder_sdk_defaults",
607 ],
608
609 shared_libs: [
610 "libutils_binder_sdk",
611 ],
Steven Morelandb27aa332023-10-09 22:22:27 +0000612
613 srcs: [
614 "OS_non_android_linux.cpp",
615 "OS_unix_base.cpp",
616 ],
617
618 visibility: [
619 ":__subpackages__",
620 ],
621
622 target: {
623 windows: {
624 enabled: false,
625 },
626 },
627}
628
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700629cc_library_host_shared {
630 name: "libbinder_sdk",
631 defaults: ["libbinder_sdk_defaults"],
632}
633
634cc_library_host_shared {
635 name: "libbinder_sdk_single_threaded",
636 defaults: ["libbinder_sdk_defaults"],
637 cflags: [
638 "-DBINDER_RPC_SINGLE_THREADED",
639 ],
640}
641
Steven Moreland52728212024-04-05 20:28:14 +0000642cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000643 name: "libbinder_rpc_no_kernel",
Andrei Homescud65666d2023-03-03 07:28:02 +0000644 vendor_available: true,
Andrei Homescu875996f2022-08-24 04:25:11 +0000645 defaults: [
646 "libbinder_common_defaults",
647 "libbinder_android_defaults",
648 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000649 visibility: [
650 ":__subpackages__",
651 ],
652}
653
Steven Moreland52728212024-04-05 20:28:14 +0000654cc_library {
Tomasz Wasilczykbca8f942023-10-09 17:42:37 +0000655 name: "libbinder_rpc_no_blob",
656 vendor_available: true,
657 defaults: [
658 "libbinder_common_defaults",
659 "libbinder_android_defaults",
660 "libbinder_kernel_defaults",
661 ],
662 cflags: [
663 "-DBINDER_DISABLE_BLOB",
664 ],
665 visibility: [
666 ":__subpackages__",
667 ],
668}
669
Steven Moreland52728212024-04-05 20:28:14 +0000670cc_library {
Tomasz Wasilczyk232d0b32023-10-09 17:37:16 +0000671 name: "libbinder_rpc_no_native_handle",
672 vendor_available: true,
673 defaults: [
674 "libbinder_common_defaults",
675 "libbinder_android_defaults",
676 "libbinder_kernel_defaults",
677 ],
678 cflags: [
679 "-DBINDER_DISABLE_NATIVE_HANDLE",
680 ],
681 visibility: [
682 ":__subpackages__",
683 ],
684}
685
Steven Moreland52728212024-04-05 20:28:14 +0000686cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000687 name: "libbinder_rpc_single_threaded",
688 defaults: [
Andrei Homescu875996f2022-08-24 04:25:11 +0000689 "libbinder_common_defaults",
690 "libbinder_android_defaults",
Andrei Homescu12106de2022-04-27 04:42:21 +0000691 "libbinder_kernel_defaults",
692 ],
693 cflags: [
694 "-DBINDER_RPC_SINGLE_THREADED",
695 ],
696 visibility: [
697 ":__subpackages__",
698 ],
699}
700
Steven Moreland52728212024-04-05 20:28:14 +0000701cc_library {
Andrei Homescu12106de2022-04-27 04:42:21 +0000702 name: "libbinder_rpc_single_threaded_no_kernel",
Andrei Homescu875996f2022-08-24 04:25:11 +0000703 defaults: [
704 "libbinder_common_defaults",
705 "libbinder_android_defaults",
706 ],
Andrei Homescu12106de2022-04-27 04:42:21 +0000707 cflags: [
708 "-DBINDER_RPC_SINGLE_THREADED",
709 ],
710 visibility: [
711 ":__subpackages__",
712 ],
713}
714
Yifan Honge8212f22021-06-28 15:49:08 -0700715cc_defaults {
716 name: "libbinder_tls_shared_deps",
717 shared_libs: [
718 "libbinder",
719 "libcrypto",
720 "liblog",
721 "libssl",
722 "libutils",
723 ],
724}
725
726cc_defaults {
727 name: "libbinder_tls_defaults",
728 defaults: ["libbinder_tls_shared_deps"],
Andrei Homescud65666d2023-03-03 07:28:02 +0000729 vendor_available: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700730 host_supported: true,
Tomasz Wasilczyka32912e2024-04-30 10:55:58 -0700731 cmake_snapshot_supported: true,
Yifan Honge8212f22021-06-28 15:49:08 -0700732
733 header_libs: [
734 "libbinder_headers",
735 ],
736 export_header_lib_headers: [
737 "libbinder_headers",
738 ],
Yifan Hongb160f8c2021-09-17 22:59:11 -0700739 export_shared_lib_headers: [
740 "libssl",
741 ],
Yifan Honge8212f22021-06-28 15:49:08 -0700742 export_include_dirs: ["include_tls"],
743 static_libs: [
744 "libbase",
745 ],
746 srcs: [
747 "RpcTransportTls.cpp",
Yifan Hongbb24eea2021-09-17 18:21:56 -0700748 "RpcTlsUtils.cpp",
Yifan Honge8212f22021-06-28 15:49:08 -0700749 ],
750}
751
752cc_library_shared {
753 name: "libbinder_tls",
754 defaults: ["libbinder_tls_defaults"],
755}
756
Andrei Homescud65666d2023-03-03 07:28:02 +0000757cc_library {
Andrei Homescua8fa78c2022-04-05 05:56:52 +0000758 name: "libbinder_trusty",
759 vendor: true,
760 srcs: [
761 "RpcTransportTipcAndroid.cpp",
762 "RpcTrusty.cpp",
763 ],
764
765 shared_libs: [
766 "libbinder",
767 "liblog",
768 "libtrusty",
769 "libutils",
770 ],
771 static_libs: [
772 "libbase",
773 ],
774 export_include_dirs: ["include_trusty"],
775
776 // Most of Android doesn't need this library and shouldn't use it,
777 // so we restrict its visibility to the Trusty-specific packages.
778 visibility: [
779 ":__subpackages__",
780 "//system/core/trusty:__subpackages__",
781 "//vendor:__subpackages__",
782 ],
783}
784
Yifan Hong92409752021-07-30 21:25:32 -0700785// For testing
786cc_library_static {
787 name: "libbinder_tls_static",
788 defaults: ["libbinder_tls_defaults"],
789 visibility: [
790 ":__subpackages__",
791 ],
792}
793
Colin Cross21c210e2017-11-14 13:05:37 -0800794// AIDL interface between libbinder and framework.jar
795filegroup {
796 name: "libbinder_aidl",
797 srcs: [
Devin Moore5e4c2f12021-09-09 22:36:33 +0000798 "aidl/android/os/ConnectionInfo.aidl",
Jon Spivack9f503a42019-10-22 16:49:19 -0700799 "aidl/android/os/IClientCallback.aidl",
Steven Moreland27cfab02019-08-12 14:34:16 -0700800 "aidl/android/os/IServiceCallback.aidl",
Steven Moreland80e1e6d2019-06-21 12:35:59 -0700801 "aidl/android/os/IServiceManager.aidl",
Alice Wang8578f132024-05-03 09:01:56 +0000802 "aidl/android/os/Service.aidl",
Steven Moreland3ea43272021-01-28 22:49:28 +0000803 "aidl/android/os/ServiceDebugInfo.aidl",
Alice Wang8578f132024-05-03 09:01:56 +0000804 ":libbinder_accessor_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",
815}
816
817// TODO(b/353492849): Make this interface private to libbinder.
818aidl_interface {
819 name: "android.os.accessor",
820 srcs: [":libbinder_accessor_aidl"],
821 unstable: true,
822 backend: {
823 rust: {
824 enabled: true,
825 apex_available: [
826 "com.android.virt",
827 ],
828 },
829 },
830 visibility: [
831 ":__subpackages__",
832 "//system/tools/aidl:__subpackages__",
833 "//packages/modules/Virtualization:__subpackages__",
834 ],
835}
836
Samiul Islam4480b6f2021-08-26 11:41:49 +0100837aidl_interface {
Steven Morelandf9514192021-03-26 01:34:55 +0000838 name: "packagemanager_aidl",
Samiul Islam4480b6f2021-08-26 11:41:49 +0100839 unstable: true,
840 local_include_dir: "aidl",
841 host_supported: true,
Steven Morelandf9514192021-03-26 01:34:55 +0000842 srcs: [
Steven Morelandf9514192021-03-26 01:34:55 +0000843 "aidl/android/content/pm/IPackageManagerNative.aidl",
Samiul Islam643744f2021-08-04 15:56:52 +0100844 "aidl/android/content/pm/IStagedApexObserver.aidl",
845 "aidl/android/content/pm/ApexStagedEvent.aidl",
846 "aidl/android/content/pm/StagedApexInfo.aidl",
Steven Morelandf9514192021-03-26 01:34:55 +0000847 ],
Jooyung Hanfc622692021-10-05 16:51:09 +0900848 backend: {
849 rust: {
850 apex_available: [
851 "com.android.virt",
852 ],
853 enabled: true,
854 },
855 },
Steven Morelandf9514192021-03-26 01:34:55 +0000856}
857
Steven Moreland82c97cf2019-10-16 16:29:27 -0700858aidl_interface {
859 name: "libbinder_aidl_test_stub",
Jiyong Park701fa1a2020-04-13 12:55:44 +0900860 unstable: true,
Steven Moreland82c97cf2019-10-16 16:29:27 -0700861 local_include_dir: "aidl",
862 srcs: [":libbinder_aidl"],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700863 vendor_available: true,
864 backend: {
865 java: {
866 enabled: false,
867 },
868 },
Steven Morelandae351c22023-02-13 22:01:00 +0000869 visibility: [
870 ":__subpackages__",
871 "//system/tools/aidl:__subpackages__",
872 ],
Steven Moreland82c97cf2019-10-16 16:29:27 -0700873}
Steven Morelandea6bfab2021-04-01 00:10:31 +0000874
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700875// TODO(b/184872979): remove once the Rust API is created.
876cc_library {
877 name: "libbinder_rpc_unstable",
878 srcs: ["libbinder_rpc_unstable.cpp"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700879 shared_libs: [
880 "libbase",
881 "libbinder",
882 "libbinder_ndk",
Inseob Kim091050a2021-10-25 14:25:25 +0000883 "liblog",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700884 "libutils",
885 ],
Inseob Kim01befc82021-08-31 20:28:50 +0900886 export_include_dirs: ["include_rpc_unstable"],
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700887
888 // enumerate stable entry points, for apex use
889 stubs: {
890 symbol_file: "libbinder_rpc_unstable.map.txt",
891 },
892
893 // This library is intentionally limited to these targets, and it will be removed later.
894 // Do not expand the visibility.
895 visibility: [
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000896 ":__subpackages__",
Nikita Ioffe605d1162024-02-20 13:37:48 +0000897 "//packages/modules/Virtualization:__subpackages__",
Rayan Hallal24bb29b2022-12-09 15:27:47 +0000898 "//device/google/cuttlefish/shared/minidroid:__subpackages__",
Raphael Blisteinefc3f602023-02-16 16:12:05 +0000899 "//system/software_defined_vehicle:__subpackages__",
Jeongik Cha91486ee2024-03-12 19:35:12 +0900900 "//visibility:any_system_partition",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700901 ],
902}
903
Steven Morelandea6bfab2021-04-01 00:10:31 +0000904// libbinder historically contained additional interfaces that provided specific
905// functionality in the platform but have nothing to do with binder itself. These
906// are moved out of libbinder in order to avoid the overhead of their vtables.
907// If you are working on or own one of these interfaces, the responsible things
908// to would be:
909// - give them a new home
910// - convert them to AIDL instead of having manually written parceling code
911
912cc_library {
913 name: "libbatterystats_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400914 host_supported: true,
Steven Morelandea6bfab2021-04-01 00:10:31 +0000915 srcs: [
916 "IBatteryStats.cpp",
917 ],
918 export_include_dirs: ["include_batterystats"],
919 shared_libs: [
920 "libbinder",
921 "libutils",
922 ],
923}
Steven Moreland45e25cb2021-04-02 04:30:41 +0000924
925cc_library {
926 name: "libprocessinfoservice_aidl",
Atneya Nair5b9cbbf2022-05-24 20:39:48 -0400927 host_supported: true,
Steven Moreland45e25cb2021-04-02 04:30:41 +0000928 srcs: [
929 "IProcessInfoService.cpp",
930 "ProcessInfoService.cpp",
931 ],
932 export_include_dirs: ["include_processinfo"],
933 shared_libs: [
934 "libbinder",
935 "libutils",
936 "liblog",
937 ],
938}
Steven Moreland8a2085c2021-04-05 22:01:48 +0000939
Steven Moreland8a2085c2021-04-05 22:01:48 +0000940cc_library {
941 name: "libactivitymanager_aidl",
Steven Moreland710ad482021-04-05 23:17:21 +0000942 srcs: [
943 "ActivityManager.cpp",
944 "IActivityManager.cpp",
945 "IUidObserver.cpp",
946 ":activity_manager_procstate_aidl",
947 ],
948 export_include_dirs: ["include_activitymanager"],
Steven Moreland8a2085c2021-04-05 22:01:48 +0000949 shared_libs: [
950 "libbinder",
951 "libutils",
952 "liblog",
953 ],
Steven Moreland710ad482021-04-05 23:17:21 +0000954 aidl: {
955 export_aidl_headers: true,
956 },
Steven Moreland8a2085c2021-04-05 22:01:48 +0000957}
Yifan Hongdbf58d42021-06-03 19:21:11 -0700958
959cc_binary {
960 name: "servicedispatcher",
961 host_supported: false,
962 srcs: [
963 "servicedispatcher.cpp",
964 ],
965 shared_libs: [
966 "libbase",
967 "libbinder",
968 "liblog",
969 "libutils",
Yifan Honga5b02692021-07-22 20:06:48 -0700970 "android.debug_aidl-cpp",
Yifan Hongdbf58d42021-06-03 19:21:11 -0700971 ],
972}