blob: 3f790dcf947e643fe5efe2bdb5225546d8bebb1d [file] [log] [blame]
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001// Copyright (C) 2018 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
15package apex
16
17import (
18 "fmt"
Jooyung Han54aca7b2019-11-20 02:26:02 +090019 "path"
Jiyong Park48ca7dc2018-10-10 14:01:00 +090020 "path/filepath"
Jiyong Parkab3ceb32018-10-10 14:05:29 +090021 "sort"
Jiyong Park48ca7dc2018-10-10 14:01:00 +090022 "strings"
Jooyung Han344d5432019-08-23 11:17:39 +090023 "sync"
Jiyong Park48ca7dc2018-10-10 14:01:00 +090024
25 "android/soong/android"
26 "android/soong/cc"
27 "android/soong/java"
Alex Light778127a2019-02-27 14:19:50 -080028 "android/soong/python"
Jiyong Park48ca7dc2018-10-10 14:01:00 +090029
30 "github.com/google/blueprint"
Alex Light778127a2019-02-27 14:19:50 -080031 "github.com/google/blueprint/bootstrap"
Jiyong Park48ca7dc2018-10-10 14:01:00 +090032 "github.com/google/blueprint/proptools"
33)
34
Jooyung Han72bd2f82019-10-23 16:46:38 +090035const (
36 imageApexSuffix = ".apex"
37 zipApexSuffix = ".zipapex"
Sundong Ahnabb64432019-10-22 13:58:29 +090038 flattenedSuffix = ".flattened"
Alex Light5098a612018-11-29 17:12:15 -080039
Sundong Ahnabb64432019-10-22 13:58:29 +090040 imageApexType = "image"
41 zipApexType = "zip"
42 flattenedApexType = "flattened"
Jooyung Han72bd2f82019-10-23 16:46:38 +090043)
Jiyong Park48ca7dc2018-10-10 14:01:00 +090044
45type dependencyTag struct {
46 blueprint.BaseDependencyTag
47 name string
Jiyong Parkfa899442020-01-31 02:49:53 +090048
49 // determines if the dependent will be part of the APEX payload
50 payload bool
Jiyong Park48ca7dc2018-10-10 14:01:00 +090051}
52
53var (
Jiyong Parkfa899442020-01-31 02:49:53 +090054 sharedLibTag = dependencyTag{name: "sharedLib", payload: true}
55 executableTag = dependencyTag{name: "executable", payload: true}
56 javaLibTag = dependencyTag{name: "javaLib", payload: true}
57 prebuiltTag = dependencyTag{name: "prebuilt", payload: true}
58 testTag = dependencyTag{name: "test", payload: true}
Jiyong Parkc00cbd92018-10-30 21:20:05 +090059 keyTag = dependencyTag{name: "key"}
60 certificateTag = dependencyTag{name: "certificate"}
Jooyung Han5c998b92019-06-27 11:30:33 +090061 usesTag = dependencyTag{name: "uses"}
Jiyong Parkfa899442020-01-31 02:49:53 +090062 androidAppTag = dependencyTag{name: "androidApp", payload: true}
Anton Hansson5053c292020-01-10 15:12:39 +000063 apexAvailWl = makeApexAvailableWhitelist()
Jiyong Park48ca7dc2018-10-10 14:01:00 +090064)
65
Anton Hansson5053c292020-01-10 15:12:39 +000066// This is a map from apex to modules, which overrides the
67// apex_available setting for that particular module to make
68// it available for the apex regardless of its setting.
69// TODO(b/147364041): remove this
70func makeApexAvailableWhitelist() map[string][]string {
71 // The "Module separator"s below are employed to minimize merge conflicts.
72 m := make(map[string][]string)
73 //
74 // Module separator
75 //
Jiyong Parkfa899442020-01-31 02:49:53 +090076 m["com.android.adbd"] = []string{
77 "adbd",
78 "bcm_object",
79 "fmtlib",
80 "libadbconnection_server",
81 "libadbd",
82 "libadbd_auth",
83 "libadbd_core",
84 "libadbd_services",
85 "libasyncio",
86 "libbacktrace_headers",
87 "libbase",
88 "libbase_headers",
89 "libbuildversion",
90 "libc++",
91 "libcap",
92 "libcrypto",
93 "libcrypto_utils",
94 "libcutils",
95 "libcutils_headers",
96 "libdiagnose_usb",
Jiyong Parkfa899442020-01-31 02:49:53 +090097 "liblog_headers",
98 "libmdnssd",
99 "libminijail",
100 "libminijail_gen_constants",
101 "libminijail_gen_constants_obj",
102 "libminijail_gen_syscall",
103 "libminijail_gen_syscall_obj",
104 "libminijail_generated",
105 "libpackagelistparser",
106 "libpcre2",
107 "libprocessgroup_headers",
108 "libqemu_pipe",
Jiyong Parkfa899442020-01-31 02:49:53 +0900109 "libsystem_headers",
110 "libutils_headers",
111 }
112 //
113 // Module separator
114 //
Anton Hansson5053c292020-01-10 15:12:39 +0000115 m["com.android.art"] = []string{
Jiyong Parkfa899442020-01-31 02:49:53 +0900116 "art_cmdlineparser_headers",
117 "art_disassembler_headers",
118 "art_libartbase_headers",
119 "bcm_object",
120 "bionic_libc_platform_headers",
121 "core-repackaged-icu4j",
122 "cpp-define-generator-asm-support",
123 "cpp-define-generator-definitions",
124 "crtbegin_dynamic",
125 "crtbegin_dynamic1",
126 "crtbegin_so1",
127 "crtbrand",
128 "conscrypt.module.intra.core.api.stubs",
129 "dex2oat_headers",
130 "dt_fd_forward_export",
131 "fmtlib",
132 "icu4c_extra_headers",
Anton Hanssonf17f2482020-01-16 09:11:57 +0000133 "jacocoagent",
Jiyong Parkfa899442020-01-31 02:49:53 +0900134 "javavm_headers",
135 "jni_platform_headers",
136 "libPlatformProperties",
137 "libadbconnection_client",
Anton Hansson5053c292020-01-10 15:12:39 +0000138 "libadbconnection_server",
Jiyong Parkfa899442020-01-31 02:49:53 +0900139 "libandroidicuinit",
140 "libart_runtime_headers_ndk",
Anton Hansson5053c292020-01-10 15:12:39 +0000141 "libartd-disassembler",
Jiyong Parkfa899442020-01-31 02:49:53 +0900142 "libasync_safe",
Anton Hansson5053c292020-01-10 15:12:39 +0000143 "libbacktrace",
144 "libbase",
Jiyong Parkfa899442020-01-31 02:49:53 +0900145 "libbase_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000146 "libc++",
Jiyong Parkfa899442020-01-31 02:49:53 +0900147 "libc++_static",
148 "libc++abi",
149 "libc++demangle",
150 "libc_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000151 "libcrypto",
Jiyong Parkfa899442020-01-31 02:49:53 +0900152 "libdexfile_all_headers",
153 "libdexfile_external_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000154 "libdexfile_support",
Jiyong Parkfa899442020-01-31 02:49:53 +0900155 "libdmabufinfo",
Anton Hansson5053c292020-01-10 15:12:39 +0000156 "libexpat",
Jiyong Parkfa899442020-01-31 02:49:53 +0900157 "libfdlibm",
158 "libgtest_prod",
159 "libicui18n_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000160 "libicuuc",
Jiyong Parkfa899442020-01-31 02:49:53 +0900161 "libicuuc_headers",
162 "libicuuc_stubdata",
163 "libjdwp_headers",
Jiyong Parkfa899442020-01-31 02:49:53 +0900164 "liblog_headers",
165 "liblz4",
Anton Hansson5053c292020-01-10 15:12:39 +0000166 "liblzma",
167 "libmeminfo",
Jiyong Parkfa899442020-01-31 02:49:53 +0900168 "libnativebridge-headers",
169 "libnativehelper_header_only",
170 "libnativeloader-headers",
171 "libnpt_headers",
172 "libopenjdkjvmti_headers",
173 "libperfetto_client_experimental",
Anton Hansson5053c292020-01-10 15:12:39 +0000174 "libprocinfo",
Jiyong Parkfa899442020-01-31 02:49:53 +0900175 "libprotobuf-cpp-lite",
176 "libunwind_llvm",
Anton Hansson5053c292020-01-10 15:12:39 +0000177 "libunwindstack",
Jiyong Parkfa899442020-01-31 02:49:53 +0900178 "libv8",
179 "libv8base",
180 "libv8gen",
181 "libv8platform",
182 "libv8sampler",
183 "libv8src",
Anton Hansson5053c292020-01-10 15:12:39 +0000184 "libvixl",
185 "libvixld",
186 "libz",
187 "libziparchive",
Jiyong Parkfa899442020-01-31 02:49:53 +0900188 "perfetto_trace_protos",
Anton Hansson5053c292020-01-10 15:12:39 +0000189 }
190 //
191 // Module separator
192 //
193 m["com.android.bluetooth.updatable"] = []string{
194 "android.hardware.audio.common@5.0",
Anton Hansson5053c292020-01-10 15:12:39 +0000195 "android.hardware.bluetooth.a2dp@1.0",
196 "android.hardware.bluetooth.audio@2.0",
Jiyong Parkfa899442020-01-31 02:49:53 +0900197 "android.hardware.bluetooth@1.0",
198 "android.hardware.bluetooth@1.1",
199 "android.hardware.graphics.bufferqueue@1.0",
200 "android.hardware.graphics.bufferqueue@2.0",
201 "android.hardware.graphics.common@1.0",
202 "android.hardware.graphics.common@1.1",
203 "android.hardware.graphics.common@1.2",
204 "android.hardware.media@1.0",
Anton Hansson5053c292020-01-10 15:12:39 +0000205 "android.hidl.safe_union@1.0",
Jiyong Parkfa899442020-01-31 02:49:53 +0900206 "android.hidl.token@1.0",
207 "android.hidl.token@1.0-utils",
208 "avrcp-target-service",
209 "avrcp_headers",
210 "bcm_object",
211 "bluetooth-protos-lite",
212 "bluetooth.mapsapi",
213 "com.android.vcard",
Jooyung Hanb8fa86a2020-03-10 06:23:13 +0900214 "dnsresolver_aidl_interface-V2-java",
Jiyong Parkfa899442020-01-31 02:49:53 +0900215 "fmtlib",
216 "guava",
Jooyung Hanb8fa86a2020-03-10 06:23:13 +0900217 "ipmemorystore-aidl-interfaces-V5-java",
218 "ipmemorystore-aidl-interfaces-java",
Jiyong Parkfa899442020-01-31 02:49:53 +0900219 "internal_include_headers",
220 "lib-bt-packets",
221 "lib-bt-packets-avrcp",
222 "lib-bt-packets-base",
223 "libFraunhoferAAC",
224 "libaudio-a2dp-hw-utils",
225 "libaudio-hearing-aid-hw-utils",
226 "libbacktrace_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000227 "libbase",
Jiyong Parkfa899442020-01-31 02:49:53 +0900228 "libbase_headers",
229 "libbinder_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000230 "libbluetooth",
Jiyong Parkfa899442020-01-31 02:49:53 +0900231 "libbluetooth-types",
232 "libbluetooth-types-header",
233 "libbluetooth_gd",
234 "libbluetooth_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000235 "libbluetooth_jni",
Jiyong Parkfa899442020-01-31 02:49:53 +0900236 "libbt-audio-hal-interface",
237 "libbt-bta",
238 "libbt-common",
239 "libbt-hci",
240 "libbt-platform-protos-lite",
241 "libbt-protos-lite",
242 "libbt-sbc-decoder",
243 "libbt-sbc-encoder",
244 "libbt-stack",
245 "libbt-utils",
246 "libbtcore",
247 "libbtdevice",
248 "libbte",
249 "libbtif",
Anton Hansson5053c292020-01-10 15:12:39 +0000250 "libc++",
251 "libchrome",
252 "libcrypto",
253 "libcutils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900254 "libcutils_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000255 "libevent",
256 "libfmq",
Jiyong Parkfa899442020-01-31 02:49:53 +0900257 "libg722codec",
258 "libgtest_prod",
259 "libgui_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000260 "libhidlbase",
Jiyong Parkfa899442020-01-31 02:49:53 +0900261 "libhidlbase-impl-internal",
262 "libhidltransport-impl-internal",
263 "libhwbinder-impl-internal",
264 "libjsoncpp",
265 "liblog_headers",
266 "libmedia_headers",
267 "libmodpb64",
268 "libosi",
Anton Hansson5053c292020-01-10 15:12:39 +0000269 "libprocessgroup",
Jiyong Parkfa899442020-01-31 02:49:53 +0900270 "libprocessgroup_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000271 "libprotobuf-cpp-lite",
Jiyong Parkfa899442020-01-31 02:49:53 +0900272 "libprotobuf-java-lite",
273 "libprotobuf-java-micro",
274 "libstagefright_foundation_headers",
275 "libstagefright_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000276 "libstatslog",
Jiyong Parkfa899442020-01-31 02:49:53 +0900277 "libstatssocket",
278 "libsystem_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000279 "libtinyxml2",
Jiyong Parkfa899442020-01-31 02:49:53 +0900280 "libudrv-uipc",
Jiyong Parkfa899442020-01-31 02:49:53 +0900281 "libutils_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000282 "libz",
Jiyong Parkfa899442020-01-31 02:49:53 +0900283 "media_plugin_headers",
Jooyung Hanb8fa86a2020-03-10 06:23:13 +0900284 "net-utils-services-common",
285 "netd_aidl_interface-unstable-java",
286 "netd_event_listener_interface-java",
287 "netlink-client",
288 "networkstack-aidl-interfaces-unstable-java",
289 "networkstack-client",
Jiyong Parkfa899442020-01-31 02:49:53 +0900290 "sap-api-java-static",
291 "services.net",
Anton Hansson5053c292020-01-10 15:12:39 +0000292 }
293 //
294 // Module separator
295 //
296 m["com.android.cellbroadcast"] = []string{"CellBroadcastApp", "CellBroadcastServiceModule"}
297 //
298 // Module separator
299 //
Jiyong Parkfa899442020-01-31 02:49:53 +0900300 m["com.android.conscrypt"] = []string{
301 "bcm_object",
302 "boringssl_self_test",
303 "libc++",
304 "libcrypto",
305 "libnativehelper_header_only",
306 "libssl",
Jooyung Hanb8fa86a2020-03-10 06:23:13 +0900307 "unsupportedappusage",
Jiyong Parkfa899442020-01-31 02:49:53 +0900308 }
Anton Hansson5053c292020-01-10 15:12:39 +0000309 //
310 // Module separator
311 //
Jiyong Parkfa899442020-01-31 02:49:53 +0900312 m["com.android.extservices"] = []string{
313 "flatbuffer_headers",
314 "liblua",
315 "libtextclassifier",
316 "libtextclassifier_hash_static",
317 "libtflite_static",
318 "libutf",
319 "libz_current",
320 "tensorflow_headers",
321 }
322 //
323 // Module separator
324 //
325 m["com.android.cronet"] = []string{
326 "cronet_impl_common_java",
327 "cronet_impl_native_java",
328 "cronet_impl_platform_java",
329 "libcronet.80.0.3986.0",
330 "org.chromium.net.cronet",
Jooyung Hanb8fa86a2020-03-10 06:23:13 +0900331 "org.chromium.net.cronet.xml",
Jiyong Parkfa899442020-01-31 02:49:53 +0900332 "prebuilt_libcronet.80.0.3986.0",
333 }
334 //
335 // Module separator
336 //
337 m["com.android.neuralnetworks"] = []string{
338 "android.hardware.neuralnetworks@1.0",
339 "android.hardware.neuralnetworks@1.1",
340 "android.hardware.neuralnetworks@1.2",
341 "android.hardware.neuralnetworks@1.3",
342 "android.hidl.allocator@1.0",
343 "android.hidl.memory.token@1.0",
344 "android.hidl.memory@1.0",
345 "android.hidl.safe_union@1.0",
346 "bcm_object",
347 "fmtlib",
348 "gemmlowp_headers",
349 "libarect",
350 "libbacktrace_headers",
351 "libbase",
352 "libbase_headers",
Jiyong Parkfa899442020-01-31 02:49:53 +0900353 "libbuildversion",
354 "libc++",
355 "libcrypto",
356 "libcrypto_static",
357 "libcutils",
358 "libcutils_headers",
359 "libeigen",
360 "libfmq",
361 "libhidlbase",
362 "libhidlbase-impl-internal",
363 "libhidlmemory",
364 "libhidltransport-impl-internal",
365 "libhwbinder-impl-internal",
366 "libjsoncpp",
367 "liblog_headers",
368 "libmath",
369 "libneuralnetworks_common",
370 "libneuralnetworks_headers",
371 "libprocessgroup",
372 "libprocessgroup_headers",
373 "libprocpartition",
374 "libsync",
375 "libsystem_headers",
376 "libtextclassifier_hash",
377 "libtextclassifier_hash_headers",
378 "libtextclassifier_hash_static",
379 "libtflite_kernel_utils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900380 "libutils_headers",
381 "philox_random",
382 "philox_random_headers",
383 "tensorflow_headers",
384 }
Anton Hansson5053c292020-01-10 15:12:39 +0000385 //
386 // Module separator
387 //
Anton Hansson5053c292020-01-10 15:12:39 +0000388 m["com.android.media"] = []string{
Jiyong Parkfa899442020-01-31 02:49:53 +0900389 "android.frameworks.bufferhub@1.0",
Anton Hansson5053c292020-01-10 15:12:39 +0000390 "android.hardware.cas.native@1.0",
Jiyong Parkfa899442020-01-31 02:49:53 +0900391 "android.hardware.cas@1.0",
392 "android.hardware.configstore-utils",
393 "android.hardware.configstore@1.0",
394 "android.hardware.configstore@1.1",
395 "android.hardware.graphics.allocator@2.0",
396 "android.hardware.graphics.allocator@3.0",
397 "android.hardware.graphics.bufferqueue@1.0",
398 "android.hardware.graphics.bufferqueue@2.0",
399 "android.hardware.graphics.common@1.0",
400 "android.hardware.graphics.common@1.1",
401 "android.hardware.graphics.common@1.2",
402 "android.hardware.graphics.mapper@2.0",
403 "android.hardware.graphics.mapper@2.1",
404 "android.hardware.graphics.mapper@3.0",
405 "android.hardware.media.omx@1.0",
406 "android.hardware.media@1.0",
Anton Hansson5053c292020-01-10 15:12:39 +0000407 "android.hidl.allocator@1.0",
Anton Hansson5053c292020-01-10 15:12:39 +0000408 "android.hidl.memory.token@1.0",
Jiyong Parkfa899442020-01-31 02:49:53 +0900409 "android.hidl.memory@1.0",
Anton Hansson5053c292020-01-10 15:12:39 +0000410 "android.hidl.token@1.0",
411 "android.hidl.token@1.0-utils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900412 "bcm_object",
413 "bionic_libc_platform_headers",
414 "fmtlib",
415 "gl_headers",
416 "libEGL",
417 "libEGL_blobCache",
418 "libEGL_getProcAddress",
419 "libFLAC",
420 "libFLAC-config",
421 "libFLAC-headers",
422 "libGLESv2",
Anton Hansson5053c292020-01-10 15:12:39 +0000423 "libaacextractor",
424 "libamrextractor",
Jiyong Parkfa899442020-01-31 02:49:53 +0900425 "libarect",
426 "libasync_safe",
427 "libaudio_system_headers",
428 "libaudioclient",
429 "libaudioclient_headers",
430 "libaudiofoundation",
431 "libaudiofoundation_headers",
432 "libaudiomanager",
433 "libaudiopolicy",
Anton Hansson5053c292020-01-10 15:12:39 +0000434 "libaudioutils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900435 "libaudioutils_fixedfft",
436 "libbacktrace",
437 "libbacktrace_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000438 "libbase",
Jiyong Parkfa899442020-01-31 02:49:53 +0900439 "libbase_headers",
440 "libbinder_headers",
Jiyong Parkfa899442020-01-31 02:49:53 +0900441 "libbluetooth-types-header",
442 "libbufferhub",
443 "libbufferhub_headers",
444 "libbufferhubqueue",
Anton Hansson5053c292020-01-10 15:12:39 +0000445 "libc++",
Jiyong Parkfa899442020-01-31 02:49:53 +0900446 "libc_headers",
447 "libc_malloc_debug_backtrace",
448 "libcamera_client",
449 "libcamera_metadata",
Anton Hansson5053c292020-01-10 15:12:39 +0000450 "libcrypto",
451 "libcutils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900452 "libcutils_headers",
453 "libdexfile_external_headers",
454 "libdexfile_support",
455 "libdvr_headers",
456 "libexpat",
457 "libfifo",
Anton Hansson5053c292020-01-10 15:12:39 +0000458 "libflacextractor",
Jiyong Parkfa899442020-01-31 02:49:53 +0900459 "libgrallocusage",
460 "libgraphicsenv",
461 "libgui",
462 "libgui_headers",
463 "libhardware_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000464 "libhidlbase",
Jiyong Parkfa899442020-01-31 02:49:53 +0900465 "libhidlbase-impl-internal",
Anton Hansson5053c292020-01-10 15:12:39 +0000466 "libhidlmemory",
Jiyong Parkfa899442020-01-31 02:49:53 +0900467 "libhidltransport-impl-internal",
468 "libhwbinder-impl-internal",
469 "libinput",
470 "libjsoncpp",
471 "liblog_headers",
472 "liblzma",
473 "libmath",
474 "libmedia",
475 "libmedia_codeclist",
476 "libmedia_headers",
477 "libmedia_helper",
478 "libmedia_helper_headers",
479 "libmedia_midiiowrapper",
480 "libmedia_omx",
481 "libmediautils",
Anton Hansson5053c292020-01-10 15:12:39 +0000482 "libmidiextractor",
483 "libmkvextractor",
484 "libmp3extractor",
485 "libmp4extractor",
486 "libmpeg2extractor",
Jiyong Parkfa899442020-01-31 02:49:53 +0900487 "libnativebase_headers",
488 "libnativebridge-headers",
489 "libnativebridge_lazy",
490 "libnativeloader-headers",
491 "libnativeloader_lazy",
492 "libnativewindow_headers",
493 "libnblog",
Anton Hansson5053c292020-01-10 15:12:39 +0000494 "liboggextractor",
Jiyong Parkfa899442020-01-31 02:49:53 +0900495 "libpackagelistparser",
496 "libpcre2",
497 "libpdx",
498 "libpdx_default_transport",
499 "libpdx_headers",
500 "libpdx_uds",
Anton Hansson5053c292020-01-10 15:12:39 +0000501 "libprocessgroup",
Jiyong Parkfa899442020-01-31 02:49:53 +0900502 "libprocessgroup_headers",
503 "libprocinfo",
Jiyong Parkfa899442020-01-31 02:49:53 +0900504 "libsonivox",
Anton Hansson5053c292020-01-10 15:12:39 +0000505 "libspeexresampler",
Jiyong Parkfa899442020-01-31 02:49:53 +0900506 "libspeexresampler",
507 "libstagefright_esds",
Anton Hansson5053c292020-01-10 15:12:39 +0000508 "libstagefright_flacdec",
Jiyong Parkfa899442020-01-31 02:49:53 +0900509 "libstagefright_flacdec",
510 "libstagefright_foundation",
511 "libstagefright_foundation_headers",
512 "libstagefright_foundation_without_imemory",
513 "libstagefright_headers",
514 "libstagefright_id3",
515 "libstagefright_metadatautils",
516 "libstagefright_mpeg2extractor",
517 "libstagefright_mpeg2support",
518 "libsync",
519 "libsystem_headers",
520 "libui",
521 "libui_headers",
522 "libunwindstack",
Jiyong Parkfa899442020-01-31 02:49:53 +0900523 "libutils_headers",
524 "libvibrator",
525 "libvorbisidec",
Anton Hansson5053c292020-01-10 15:12:39 +0000526 "libwavextractor",
Jiyong Parkfa899442020-01-31 02:49:53 +0900527 "libwebm",
528 "media_ndk_headers",
529 "media_plugin_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000530 "updatable-media",
531 }
532 //
533 // Module separator
534 //
535 m["com.android.media.swcodec"] = []string{
536 "android.frameworks.bufferhub@1.0",
537 "android.hardware.common-ndk_platform",
Jiyong Parkfa899442020-01-31 02:49:53 +0900538 "android.hardware.configstore-utils",
539 "android.hardware.configstore@1.0",
540 "android.hardware.configstore@1.1",
Anton Hansson5053c292020-01-10 15:12:39 +0000541 "android.hardware.graphics.allocator@2.0",
542 "android.hardware.graphics.allocator@3.0",
543 "android.hardware.graphics.allocator@4.0",
544 "android.hardware.graphics.bufferqueue@1.0",
545 "android.hardware.graphics.bufferqueue@2.0",
Jiyong Parkfa899442020-01-31 02:49:53 +0900546 "android.hardware.graphics.common-ndk_platform",
Anton Hansson5053c292020-01-10 15:12:39 +0000547 "android.hardware.graphics.common@1.0",
548 "android.hardware.graphics.common@1.1",
549 "android.hardware.graphics.common@1.2",
Anton Hansson5053c292020-01-10 15:12:39 +0000550 "android.hardware.graphics.mapper@2.0",
551 "android.hardware.graphics.mapper@2.1",
552 "android.hardware.graphics.mapper@3.0",
553 "android.hardware.graphics.mapper@4.0",
Anton Hansson5053c292020-01-10 15:12:39 +0000554 "android.hardware.media.bufferpool@2.0",
555 "android.hardware.media.c2@1.0",
556 "android.hardware.media.c2@1.1",
557 "android.hardware.media.omx@1.0",
Jiyong Parkfa899442020-01-31 02:49:53 +0900558 "android.hardware.media@1.0",
559 "android.hardware.media@1.0",
Anton Hansson5053c292020-01-10 15:12:39 +0000560 "android.hidl.memory.token@1.0",
Jiyong Parkfa899442020-01-31 02:49:53 +0900561 "android.hidl.memory@1.0",
Anton Hansson5053c292020-01-10 15:12:39 +0000562 "android.hidl.safe_union@1.0",
563 "android.hidl.token@1.0",
564 "android.hidl.token@1.0-utils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900565 "fmtlib",
566 "libEGL",
567 "libFLAC",
568 "libFLAC-config",
569 "libFLAC-headers",
570 "libFraunhoferAAC",
Jooyung Hanb8fa86a2020-03-10 06:23:13 +0900571 "libLibGuiProperties",
Jiyong Parkfa899442020-01-31 02:49:53 +0900572 "libarect",
573 "libasync_safe",
574 "libaudio_system_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000575 "libaudioutils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900576 "libaudioutils",
577 "libaudioutils_fixedfft",
578 "libavcdec",
579 "libavcenc",
Anton Hansson5053c292020-01-10 15:12:39 +0000580 "libavservices_minijail",
Jiyong Parkfa899442020-01-31 02:49:53 +0900581 "libavservices_minijail",
582 "libbacktrace",
583 "libbacktrace_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000584 "libbase",
Jiyong Parkfa899442020-01-31 02:49:53 +0900585 "libbase_headers",
586 "libbinder_headers",
Jooyung Hanb8fa86a2020-03-10 06:23:13 +0900587 "libbinderthreadstateutils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900588 "libbluetooth-types-header",
589 "libbufferhub_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000590 "libc++",
Jiyong Parkfa899442020-01-31 02:49:53 +0900591 "libc_scudo",
Anton Hansson5053c292020-01-10 15:12:39 +0000592 "libcap",
593 "libcodec2",
Jiyong Parkfa899442020-01-31 02:49:53 +0900594 "libcodec2_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000595 "libcodec2_hidl@1.0",
596 "libcodec2_hidl@1.1",
Jiyong Parkfa899442020-01-31 02:49:53 +0900597 "libcodec2_internal",
Anton Hansson5053c292020-01-10 15:12:39 +0000598 "libcodec2_soft_aacdec",
599 "libcodec2_soft_aacenc",
600 "libcodec2_soft_amrnbdec",
601 "libcodec2_soft_amrnbenc",
602 "libcodec2_soft_amrwbdec",
603 "libcodec2_soft_amrwbenc",
604 "libcodec2_soft_av1dec_gav1",
605 "libcodec2_soft_avcdec",
606 "libcodec2_soft_avcenc",
607 "libcodec2_soft_common",
608 "libcodec2_soft_flacdec",
609 "libcodec2_soft_flacenc",
610 "libcodec2_soft_g711alawdec",
611 "libcodec2_soft_g711mlawdec",
612 "libcodec2_soft_gsmdec",
613 "libcodec2_soft_h263dec",
614 "libcodec2_soft_h263enc",
615 "libcodec2_soft_hevcdec",
616 "libcodec2_soft_hevcenc",
617 "libcodec2_soft_mp3dec",
618 "libcodec2_soft_mpeg2dec",
619 "libcodec2_soft_mpeg4dec",
620 "libcodec2_soft_mpeg4enc",
621 "libcodec2_soft_opusdec",
622 "libcodec2_soft_opusenc",
623 "libcodec2_soft_rawdec",
624 "libcodec2_soft_vorbisdec",
625 "libcodec2_soft_vp8dec",
626 "libcodec2_soft_vp8enc",
627 "libcodec2_soft_vp9dec",
628 "libcodec2_soft_vp9enc",
629 "libcodec2_vndk",
Anton Hansson5053c292020-01-10 15:12:39 +0000630 "libcutils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900631 "libcutils_headers",
632 "libdexfile_support",
633 "libdvr_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000634 "libfmq",
Jiyong Parkfa899442020-01-31 02:49:53 +0900635 "libfmq",
636 "libgav1",
Anton Hansson5053c292020-01-10 15:12:39 +0000637 "libgralloctypes",
Jiyong Parkfa899442020-01-31 02:49:53 +0900638 "libgrallocusage",
639 "libgraphicsenv",
640 "libgsm",
641 "libgui_bufferqueue_static",
642 "libgui_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000643 "libhardware",
Jiyong Parkfa899442020-01-31 02:49:53 +0900644 "libhardware_headers",
645 "libhevcdec",
646 "libhevcenc",
Anton Hansson5053c292020-01-10 15:12:39 +0000647 "libhidlbase",
Jiyong Parkfa899442020-01-31 02:49:53 +0900648 "libhidlbase-impl-internal",
Anton Hansson5053c292020-01-10 15:12:39 +0000649 "libhidlmemory",
Jiyong Parkfa899442020-01-31 02:49:53 +0900650 "libhidltransport-impl-internal",
651 "libhwbinder-impl-internal",
Anton Hansson5053c292020-01-10 15:12:39 +0000652 "libion",
Jiyong Parkfa899442020-01-31 02:49:53 +0900653 "libjpeg",
654 "libjsoncpp",
655 "liblog_headers",
656 "liblzma",
657 "libmath",
Anton Hansson5053c292020-01-10 15:12:39 +0000658 "libmedia_codecserviceregistrant",
Jiyong Parkfa899442020-01-31 02:49:53 +0900659 "libmedia_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000660 "libminijail",
Jiyong Parkfa899442020-01-31 02:49:53 +0900661 "libminijail_gen_constants",
662 "libminijail_gen_constants_obj",
663 "libminijail_gen_syscall",
664 "libminijail_gen_syscall_obj",
665 "libminijail_generated",
666 "libmpeg2dec",
667 "libnativebase_headers",
668 "libnativebridge_lazy",
669 "libnativeloader_lazy",
670 "libnativewindow_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000671 "libopus",
Jiyong Parkfa899442020-01-31 02:49:53 +0900672 "libpdx_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000673 "libprocessgroup",
Jiyong Parkfa899442020-01-31 02:49:53 +0900674 "libprocessgroup_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000675 "libscudo_wrapper",
676 "libsfplugin_ccodec_utils",
677 "libspeexresampler",
678 "libstagefright_amrnb_common",
Jiyong Parkfa899442020-01-31 02:49:53 +0900679 "libstagefright_amrnbdec",
680 "libstagefright_amrnbenc",
681 "libstagefright_amrwbdec",
682 "libstagefright_amrwbenc",
Anton Hansson5053c292020-01-10 15:12:39 +0000683 "libstagefright_bufferpool@2.0.1",
684 "libstagefright_bufferqueue_helper",
685 "libstagefright_enc_common",
686 "libstagefright_flacdec",
687 "libstagefright_foundation",
Jiyong Parkfa899442020-01-31 02:49:53 +0900688 "libstagefright_foundation_headers",
689 "libstagefright_headers",
690 "libstagefright_m4vh263dec",
691 "libstagefright_m4vh263enc",
692 "libstagefright_mp3dec",
Anton Hansson5053c292020-01-10 15:12:39 +0000693 "libsync",
Jiyong Parkfa899442020-01-31 02:49:53 +0900694 "libsystem_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000695 "libui",
Jiyong Parkfa899442020-01-31 02:49:53 +0900696 "libui_headers",
697 "libunwindstack",
Jiyong Parkfa899442020-01-31 02:49:53 +0900698 "libutils_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000699 "libvorbisidec",
700 "libvpx",
Jiyong Parkfa899442020-01-31 02:49:53 +0900701 "libyuv",
702 "libyuv_static",
703 "media_ndk_headers",
704 "media_plugin_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000705 "mediaswcodec",
Anton Hansson5053c292020-01-10 15:12:39 +0000706 }
707 //
708 // Module separator
709 //
Jiyong Parkfa899442020-01-31 02:49:53 +0900710 m["com.android.mediaprovider"] = []string{
711 "MediaProvider",
712 "MediaProviderGoogle",
713 "fmtlib_ndk",
714 "guava",
715 "libbase_ndk",
716 "libfuse",
717 "libfuse_jni",
718 "libnativehelper_header_only",
719 }
720 //
721 // Module separator
722 //
723 m["com.android.permission"] = []string{
724 "androidx.annotation_annotation",
725 "androidx.annotation_annotation-nodeps",
726 "androidx.lifecycle_lifecycle-common",
727 "androidx.lifecycle_lifecycle-common-java8",
728 "androidx.lifecycle_lifecycle-common-java8-nodeps",
729 "androidx.lifecycle_lifecycle-common-nodeps",
730 "kotlin-annotations",
731 "kotlin-stdlib",
732 "kotlin-stdlib-jdk7",
733 "kotlin-stdlib-jdk8",
734 "kotlinx-coroutines-android",
735 "kotlinx-coroutines-android-nodeps",
736 "kotlinx-coroutines-core",
737 "kotlinx-coroutines-core-nodeps",
738 "libprotobuf-java-lite",
739 "permissioncontroller-statsd",
Jiyong Park26fb6bd2020-02-06 16:47:54 +0900740 "GooglePermissionController",
741 "PermissionController",
Jiyong Parkfa899442020-01-31 02:49:53 +0900742 }
Anton Hansson5053c292020-01-10 15:12:39 +0000743 //
744 // Module separator
745 //
Anton Hansson5053c292020-01-10 15:12:39 +0000746 m["com.android.runtime"] = []string{
Jiyong Parkfa899442020-01-31 02:49:53 +0900747 "bionic_libc_platform_headers",
748 "fmtlib",
749 "libarm-optimized-routines-math",
750 "libasync_safe",
751 "libasync_safe_headers",
752 "libbacktrace_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000753 "libbase",
Jiyong Parkfa899442020-01-31 02:49:53 +0900754 "libbase_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000755 "libc++",
Jiyong Parkfa899442020-01-31 02:49:53 +0900756 "libc_aeabi",
757 "libc_bionic",
758 "libc_bionic_ndk",
759 "libc_bootstrap",
760 "libc_common",
761 "libc_common_shared",
762 "libc_common_static",
763 "libc_dns",
764 "libc_dynamic_dispatch",
765 "libc_fortify",
766 "libc_freebsd",
767 "libc_freebsd_large_stack",
768 "libc_gdtoa",
769 "libc_headers",
770 "libc_init_dynamic",
771 "libc_init_static",
772 "libc_jemalloc_wrapper",
773 "libc_netbsd",
774 "libc_nomalloc",
775 "libc_nopthread",
776 "libc_openbsd",
777 "libc_openbsd_large_stack",
778 "libc_openbsd_ndk",
779 "libc_pthread",
780 "libc_static_dispatch",
781 "libc_syscalls",
782 "libc_tzcode",
783 "libc_unwind_static",
784 "libcutils",
785 "libcutils_headers",
786 "libdebuggerd",
787 "libdebuggerd_common_headers",
788 "libdebuggerd_handler_core",
789 "libdebuggerd_handler_fallback",
790 "libdexfile_external_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000791 "libdexfile_support",
Jiyong Parkfa899442020-01-31 02:49:53 +0900792 "libdexfile_support_static",
Jooyung Hanb8fa86a2020-03-10 06:23:13 +0900793 "libdl_static",
Jiyong Parkfa899442020-01-31 02:49:53 +0900794 "libgtest_prod",
795 "libjemalloc5",
796 "liblinker_main",
797 "liblinker_malloc",
Jiyong Parkfa899442020-01-31 02:49:53 +0900798 "liblog_headers",
799 "liblz4",
Anton Hansson5053c292020-01-10 15:12:39 +0000800 "liblzma",
Jiyong Parkfa899442020-01-31 02:49:53 +0900801 "libprocessgroup_headers",
802 "libprocinfo",
803 "libpropertyinfoparser",
804 "libscudo",
805 "libstdc++",
806 "libsystem_headers",
807 "libsystemproperties",
808 "libtombstoned_client_static",
Anton Hansson5053c292020-01-10 15:12:39 +0000809 "libunwindstack",
Jiyong Parkfa899442020-01-31 02:49:53 +0900810 "libutils_headers",
811 "libz",
812 "libziparchive",
Anton Hansson5053c292020-01-10 15:12:39 +0000813 }
814 //
815 // Module separator
816 //
Jiyong Parkfa899442020-01-31 02:49:53 +0900817 m["com.android.resolv"] = []string{
818 "bcm_object",
819 "dnsresolver_aidl_interface-unstable-ndk_platform",
820 "fmtlib",
821 "libbacktrace_headers",
822 "libbase",
823 "libbase_headers",
824 "libc++",
825 "libcrypto",
826 "libcutils",
827 "libcutils_headers",
828 "libgtest_prod",
829 "libjsoncpp",
Jiyong Parkfa899442020-01-31 02:49:53 +0900830 "liblog_headers",
831 "libnativehelper_header_only",
832 "libnetd_client_headers",
833 "libnetd_resolv",
834 "libnetdutils",
835 "libprocessgroup",
836 "libprocessgroup_headers",
837 "libprotobuf-cpp-lite",
838 "libssl",
839 "libstatslog_resolv",
840 "libstatspush_compat",
841 "libstatssocket",
842 "libstatssocket_headers",
843 "libsystem_headers",
844 "libsysutils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900845 "libutils_headers",
846 "netd_event_listener_interface-ndk_platform",
847 "server_configurable_flags",
848 "stats_proto",
849 }
Anton Hansson5053c292020-01-10 15:12:39 +0000850 //
851 // Module separator
852 //
Jiyong Parkfa899442020-01-31 02:49:53 +0900853 m["com.android.tethering"] = []string{
854 "libbase",
855 "libc++",
856 "libnativehelper_compat_libc++",
857 "android.hardware.tetheroffload.config@1.0",
858 "fmtlib",
859 "libbacktrace_headers",
860 "libbase_headers",
Jiyong Parkfa899442020-01-31 02:49:53 +0900861 "libcgrouprc",
862 "libcgrouprc_format",
863 "libcutils",
864 "libcutils_headers",
865 "libhidlbase",
866 "libhidlbase-impl-internal",
867 "libhidltransport-impl-internal",
868 "libhwbinder-impl-internal",
869 "libjsoncpp",
Jiyong Parkfa899442020-01-31 02:49:53 +0900870 "liblog_headers",
871 "libprocessgroup",
872 "libprocessgroup_headers",
873 "libsystem_headers",
874 "libtetherutilsjni",
Jiyong Parkfa899442020-01-31 02:49:53 +0900875 "libutils_headers",
876 "libvndksupport",
877 "tethering-aidl-interfaces-java",
878 }
Anton Hansson5053c292020-01-10 15:12:39 +0000879 //
880 // Module separator
881 //
882 m["com.android.wifi"] = []string{
Jiyong Parkfa899442020-01-31 02:49:53 +0900883 "PlatformProperties",
884 "android.hardware.wifi-V1.0-java",
Jooyung Hanb8fa86a2020-03-10 06:23:13 +0900885 "android.hardware.wifi-V1.0-java-constants",
Jiyong Parkfa899442020-01-31 02:49:53 +0900886 "android.hardware.wifi-V1.1-java",
887 "android.hardware.wifi-V1.2-java",
888 "android.hardware.wifi-V1.3-java",
889 "android.hardware.wifi-V1.4-java",
890 "android.hardware.wifi.hostapd-V1.0-java",
891 "android.hardware.wifi.hostapd-V1.1-java",
892 "android.hardware.wifi.hostapd-V1.2-java",
893 "android.hardware.wifi.supplicant-V1.0-java",
894 "android.hardware.wifi.supplicant-V1.1-java",
895 "android.hardware.wifi.supplicant-V1.2-java",
896 "android.hardware.wifi.supplicant-V1.3-java",
897 "android.hidl.base-V1.0-java",
898 "android.hidl.manager-V1.0-java",
899 "android.hidl.manager-V1.1-java",
900 "android.hidl.manager-V1.2-java",
901 "androidx.annotation_annotation",
902 "androidx.annotation_annotation-nodeps",
903 "bouncycastle-unbundled",
904 "dnsresolver_aidl_interface-V2-java",
905 "error_prone_annotations",
Jooyung Hanb8fa86a2020-03-10 06:23:13 +0900906 "framework-wifi-pre-jarjar",
907 "framework-wifi-util-lib",
Jiyong Parkfa899442020-01-31 02:49:53 +0900908 "ipmemorystore-aidl-interfaces-V3-java",
909 "ipmemorystore-aidl-interfaces-java",
910 "ksoap2",
911 "libbacktrace_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000912 "libbase",
Jiyong Parkfa899442020-01-31 02:49:53 +0900913 "libbase_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000914 "libc++",
915 "libcutils",
Jiyong Parkfa899442020-01-31 02:49:53 +0900916 "libcutils_headers",
917 "liblog_headers",
918 "libnanohttpd",
Anton Hansson5053c292020-01-10 15:12:39 +0000919 "libprocessgroup",
Jiyong Parkfa899442020-01-31 02:49:53 +0900920 "libprocessgroup_headers",
921 "libprotobuf-java-lite",
922 "libprotobuf-java-nano",
923 "libsystem_headers",
Jiyong Parkfa899442020-01-31 02:49:53 +0900924 "libutils_headers",
Anton Hansson5053c292020-01-10 15:12:39 +0000925 "libwifi-jni",
Jiyong Parkfa899442020-01-31 02:49:53 +0900926 "net-utils-services-common",
927 "netd_aidl_interface-V2-java",
928 "netd_aidl_interface-unstable-java",
929 "netd_event_listener_interface-java",
930 "netlink-client",
931 "networkstack-aidl-interfaces-unstable-java",
932 "networkstack-client",
933 "services.net",
934 "wifi-lite-protos",
935 "wifi-nano-protos",
936 "wifi-service-pre-jarjar",
Anton Hansson5053c292020-01-10 15:12:39 +0000937 "wifi-service-resources",
Jiyong Parkfa899442020-01-31 02:49:53 +0900938 "prebuilt_androidx.annotation_annotation-nodeps",
Anton Hansson5053c292020-01-10 15:12:39 +0000939 }
940 //
941 // Module separator
942 //
Jiyong Parkfa899442020-01-31 02:49:53 +0900943 m["com.android.sdkext"] = []string{
944 "fmtlib_ndk",
945 "libbase_ndk",
946 "libprotobuf-cpp-lite-ndk",
947 }
948 //
949 // Module separator
950 //
951 m["com.android.os.statsd"] = []string{
952 "libbacktrace_headers",
953 "libbase_headers",
954 "libc++",
955 "libcutils",
956 "libcutils_headers",
957 "liblog_headers",
958 "libprocessgroup_headers",
959 "libstatssocket",
960 "libsystem_headers",
961 "libutils_headers",
962 }
963 //
964 // Module separator
965 //
966 m["//any"] = []string{
967 "crtbegin_dynamic",
968 "crtbegin_dynamic1",
969 "crtbegin_so",
970 "crtbegin_so1",
971 "crtbegin_static",
972 "crtbrand",
973 "crtend_android",
974 "crtend_so",
975 "libatomic",
976 "libc++_static",
977 "libc++abi",
978 "libc++demangle",
979 "libc_headers",
980 "libclang_rt",
981 "libgcc_stripped",
982 "libprofile-clang-extras",
983 "libprofile-clang-extras_ndk",
984 "libprofile-extras",
985 "libprofile-extras_ndk",
986 "libunwind_llvm",
987 "ndk_crtbegin_dynamic.27",
988 "ndk_crtbegin_so.16",
989 "ndk_crtbegin_so.19",
990 "ndk_crtbegin_so.21",
991 "ndk_crtbegin_so.24",
992 "ndk_crtbegin_so.27",
993 "ndk_crtend_android.27",
994 "ndk_crtend_so.16",
995 "ndk_crtend_so.19",
996 "ndk_crtend_so.21",
997 "ndk_crtend_so.24",
998 "ndk_crtend_so.27",
999 "ndk_libandroid_support",
1000 "ndk_libc++_static",
1001 "ndk_libc++abi",
1002 "ndk_libunwind",
1003 }
Anton Hansson5053c292020-01-10 15:12:39 +00001004 return m
1005}
1006
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001007func init() {
Jooyung Hane17caa62020-04-08 14:13:04 +09001008 android.AddNeverAllowRules(android.NeverAllow().
1009 ModuleType("apex").
1010 With("updatable", "true").
1011 With("min_sdk_version", "").
1012 Because("All updatable apexes should set min_sdk_version."))
1013
Jiyong Parkd1063c12019-07-17 20:08:41 +09001014 android.RegisterModuleType("apex", BundleFactory)
Alex Light0851b882019-02-07 13:20:53 -08001015 android.RegisterModuleType("apex_test", testApexBundleFactory)
Jooyung Han344d5432019-08-23 11:17:39 +09001016 android.RegisterModuleType("apex_vndk", vndkApexBundleFactory)
Jiyong Park30ca9372019-02-07 16:27:23 +09001017 android.RegisterModuleType("apex_defaults", defaultsFactory)
Jaewoong Jung939ebd52019-03-26 15:07:36 -07001018 android.RegisterModuleType("prebuilt_apex", PrebuiltFactory)
Jiyong Park5d790c32019-11-15 18:40:32 +09001019 android.RegisterModuleType("override_apex", overrideApexFactory)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001020
Jooyung Han31c470b2019-10-18 16:26:59 +09001021 android.PreDepsMutators(RegisterPreDepsMutators)
Jiyong Parkd1063c12019-07-17 20:08:41 +09001022 android.PostDepsMutators(RegisterPostDepsMutators)
Jooyung Han7a78a922019-10-08 21:59:58 +09001023
1024 android.RegisterMakeVarsProvider(pctx, func(ctx android.MakeVarsContext) {
1025 apexFileContextsInfos := apexFileContextsInfos(ctx.Config())
1026 sort.Strings(*apexFileContextsInfos)
1027 ctx.Strict("APEX_FILE_CONTEXTS_INFOS", strings.Join(*apexFileContextsInfos, " "))
1028 })
Jiyong Parkd1063c12019-07-17 20:08:41 +09001029}
1030
Jooyung Han31c470b2019-10-18 16:26:59 +09001031func RegisterPreDepsMutators(ctx android.RegisterMutatorsContext) {
1032 ctx.TopDown("apex_vndk", apexVndkMutator).Parallel()
1033 ctx.BottomUp("apex_vndk_deps", apexVndkDepsMutator).Parallel()
1034}
1035
Jiyong Parkd1063c12019-07-17 20:08:41 +09001036func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
Jiyong Parkf760cae2020-02-12 07:53:12 +09001037 ctx.TopDown("apex_deps", apexDepsMutator)
Jiyong Parkd1063c12019-07-17 20:08:41 +09001038 ctx.BottomUp("apex", apexMutator).Parallel()
1039 ctx.BottomUp("apex_flattened", apexFlattenedMutator).Parallel()
1040 ctx.BottomUp("apex_uses", apexUsesMutator).Parallel()
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001041}
1042
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001043// Mark the direct and transitive dependencies of apex bundles so that they
1044// can be built for the apex bundles.
Jiyong Parkf760cae2020-02-12 07:53:12 +09001045func apexDepsMutator(mctx android.TopDownMutatorContext) {
Peter Collingbournedc4f9862020-02-12 17:13:25 -08001046 var apexBundles []android.ApexInfo
Jiyong Parkf760cae2020-02-12 07:53:12 +09001047 var directDep bool
Jooyung Hana57af4a2020-01-23 05:36:59 +00001048 if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex {
Jooyung Hanb8fa86a2020-03-10 06:23:13 +09001049 apexBundles = []android.ApexInfo{android.ApexInfo{
Jooyung Han23b0adf2020-03-12 18:37:20 +09001050 ApexName: mctx.ModuleName(),
1051 MinSdkVersion: a.minSdkVersion(mctx),
Jooyung Hanb8fa86a2020-03-10 06:23:13 +09001052 }}
Jiyong Parkf760cae2020-02-12 07:53:12 +09001053 directDep = true
1054 } else if am, ok := mctx.Module().(android.ApexModule); ok {
Peter Collingbournedc4f9862020-02-12 17:13:25 -08001055 apexBundles = am.ApexVariations()
Jiyong Parkf760cae2020-02-12 07:53:12 +09001056 directDep = false
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001057 }
Jiyong Parkf760cae2020-02-12 07:53:12 +09001058
Peter Collingbournedc4f9862020-02-12 17:13:25 -08001059 if len(apexBundles) == 0 {
Jiyong Parkf760cae2020-02-12 07:53:12 +09001060 return
1061 }
1062
Jooyung Hanb8fa86a2020-03-10 06:23:13 +09001063 cur := mctx.Module().(interface {
1064 DepIsInSameApex(android.BaseModuleContext, android.Module) bool
1065 })
1066
Jiyong Parkf760cae2020-02-12 07:53:12 +09001067 mctx.VisitDirectDeps(func(child android.Module) {
1068 depName := mctx.OtherModuleName(child)
1069 if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() &&
Jooyung Hanb8fa86a2020-03-10 06:23:13 +09001070 cur.DepIsInSameApex(mctx, child) {
Peter Collingbournedc4f9862020-02-12 17:13:25 -08001071 android.UpdateApexDependency(apexBundles, depName, directDep)
1072 am.BuildForApexes(apexBundles)
Jiyong Parkf760cae2020-02-12 07:53:12 +09001073 }
1074 })
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001075}
1076
1077// Create apex variations if a module is included in APEX(s).
1078func apexMutator(mctx android.BottomUpMutatorContext) {
1079 if am, ok := mctx.Module().(android.ApexModule); ok && am.CanHaveApexVariants() {
Jiyong Park0ddfcd12018-12-11 01:35:25 +09001080 am.CreateApexVariations(mctx)
Jooyung Hana57af4a2020-01-23 05:36:59 +00001081 } else if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex {
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001082 // apex bundle itself is mutated so that it and its modules have same
1083 // apex variant.
1084 apexBundleName := mctx.ModuleName()
1085 mctx.CreateVariations(apexBundleName)
Jiyong Park5d790c32019-11-15 18:40:32 +09001086 } else if o, ok := mctx.Module().(*OverrideApex); ok {
1087 apexBundleName := o.GetOverriddenModuleName()
1088 if apexBundleName == "" {
1089 mctx.ModuleErrorf("base property is not set")
1090 return
1091 }
1092 mctx.CreateVariations(apexBundleName)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001093 }
Jiyong Park5d790c32019-11-15 18:40:32 +09001094
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001095}
Sundong Ahne9b55722019-09-06 17:37:42 +09001096
Jooyung Han7a78a922019-10-08 21:59:58 +09001097var (
1098 apexFileContextsInfosKey = android.NewOnceKey("apexFileContextsInfosKey")
1099 apexFileContextsInfosMutex sync.Mutex
1100)
1101
1102func apexFileContextsInfos(config android.Config) *[]string {
1103 return config.Once(apexFileContextsInfosKey, func() interface{} {
1104 return &[]string{}
1105 }).(*[]string)
1106}
1107
Jooyung Han54aca7b2019-11-20 02:26:02 +09001108func addFlattenedFileContextsInfos(ctx android.BaseModuleContext, fileContextsInfo string) {
Jooyung Han7a78a922019-10-08 21:59:58 +09001109 apexFileContextsInfosMutex.Lock()
1110 defer apexFileContextsInfosMutex.Unlock()
1111 apexFileContextsInfos := apexFileContextsInfos(ctx.Config())
Jooyung Han54aca7b2019-11-20 02:26:02 +09001112 *apexFileContextsInfos = append(*apexFileContextsInfos, fileContextsInfo)
Jooyung Han7a78a922019-10-08 21:59:58 +09001113}
1114
Sundong Ahne9b55722019-09-06 17:37:42 +09001115func apexFlattenedMutator(mctx android.BottomUpMutatorContext) {
Sundong Ahne8fb7242019-09-17 13:50:45 +09001116 if ab, ok := mctx.Module().(*apexBundle); ok {
Sundong Ahnabb64432019-10-22 13:58:29 +09001117 var variants []string
1118 switch proptools.StringDefault(ab.properties.Payload_type, "image") {
1119 case "image":
1120 variants = append(variants, imageApexType, flattenedApexType)
1121 case "zip":
1122 variants = append(variants, zipApexType)
1123 case "both":
1124 variants = append(variants, imageApexType, zipApexType, flattenedApexType)
1125 default:
Sundong Ahnd95aa2d2019-10-08 19:34:03 +09001126 mctx.PropertyErrorf("type", "%q is not one of \"image\", \"zip\", or \"both\".", *ab.properties.Payload_type)
Sundong Ahnabb64432019-10-22 13:58:29 +09001127 return
1128 }
1129
1130 modules := mctx.CreateLocalVariations(variants...)
1131
1132 for i, v := range variants {
1133 switch v {
1134 case imageApexType:
1135 modules[i].(*apexBundle).properties.ApexType = imageApex
1136 case zipApexType:
1137 modules[i].(*apexBundle).properties.ApexType = zipApex
1138 case flattenedApexType:
1139 modules[i].(*apexBundle).properties.ApexType = flattenedApex
Jooyung Han91df2082019-11-20 01:49:42 +09001140 if !mctx.Config().FlattenApex() && ab.Platform() {
Sundong Ahnd95aa2d2019-10-08 19:34:03 +09001141 modules[i].(*apexBundle).MakeAsSystemExt()
1142 }
Sundong Ahnabb64432019-10-22 13:58:29 +09001143 }
Sundong Ahne9b55722019-09-06 17:37:42 +09001144 }
Jiyong Park5d790c32019-11-15 18:40:32 +09001145 } else if _, ok := mctx.Module().(*OverrideApex); ok {
1146 mctx.CreateVariations(imageApexType, flattenedApexType)
Sundong Ahne9b55722019-09-06 17:37:42 +09001147 }
1148}
1149
Jooyung Han5c998b92019-06-27 11:30:33 +09001150func apexUsesMutator(mctx android.BottomUpMutatorContext) {
1151 if ab, ok := mctx.Module().(*apexBundle); ok {
1152 mctx.AddFarVariationDependencies(nil, usesTag, ab.properties.Uses...)
1153 }
1154}
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001155
Jooyung Handc782442019-11-01 03:14:38 +09001156var (
1157 useVendorWhitelistKey = android.NewOnceKey("useVendorWhitelist")
1158)
1159
1160// useVendorWhitelist returns the list of APEXes which are allowed to use_vendor.
1161// When use_vendor is used, native modules are built with __ANDROID_VNDK__ and __ANDROID_APEX__,
1162// which may cause compatibility issues. (e.g. libbinder)
1163// Even though libbinder restricts its availability via 'apex_available' property and relies on
1164// yet another macro __ANDROID_APEX_<NAME>__, we restrict usage of "use_vendor:" from other APEX modules
1165// to avoid similar problems.
1166func useVendorWhitelist(config android.Config) []string {
1167 return config.Once(useVendorWhitelistKey, func() interface{} {
1168 return []string{
1169 // swcodec uses "vendor" variants for smaller size
1170 "com.android.media.swcodec",
1171 "test_com.android.media.swcodec",
1172 }
1173 }).([]string)
1174}
1175
1176// setUseVendorWhitelistForTest overrides useVendorWhitelist and must be
1177// called before the first call to useVendorWhitelist()
1178func setUseVendorWhitelistForTest(config android.Config, whitelist []string) {
1179 config.Once(useVendorWhitelistKey, func() interface{} {
1180 return whitelist
1181 })
1182}
1183
Alex Light9670d332019-01-29 18:07:33 -08001184type apexNativeDependencies struct {
1185 // List of native libraries
1186 Native_shared_libs []string
Jooyung Han344d5432019-08-23 11:17:39 +09001187
Alex Light9670d332019-01-29 18:07:33 -08001188 // List of native executables
1189 Binaries []string
Jooyung Han344d5432019-08-23 11:17:39 +09001190
Roland Levillain630846d2019-06-26 12:48:34 +01001191 // List of native tests
1192 Tests []string
Alex Light9670d332019-01-29 18:07:33 -08001193}
Jooyung Han344d5432019-08-23 11:17:39 +09001194
Alex Light9670d332019-01-29 18:07:33 -08001195type apexMultilibProperties struct {
1196 // Native dependencies whose compile_multilib is "first"
1197 First apexNativeDependencies
1198
1199 // Native dependencies whose compile_multilib is "both"
1200 Both apexNativeDependencies
1201
1202 // Native dependencies whose compile_multilib is "prefer32"
1203 Prefer32 apexNativeDependencies
1204
1205 // Native dependencies whose compile_multilib is "32"
1206 Lib32 apexNativeDependencies
1207
1208 // Native dependencies whose compile_multilib is "64"
1209 Lib64 apexNativeDependencies
1210}
1211
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001212type apexBundleProperties struct {
1213 // Json manifest file describing meta info of this APEX bundle. Default:
Dario Freni4abb1dc2018-11-20 18:04:58 +00001214 // "apex_manifest.json"
Colin Cross27b922f2019-03-04 22:35:41 -08001215 Manifest *string `android:"path"`
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001216
Jiyong Park40e26a22019-02-08 02:53:06 +09001217 // AndroidManifest.xml file used for the zip container of this APEX bundle.
1218 // If unspecified, a default one is automatically generated.
Colin Cross27b922f2019-03-04 22:35:41 -08001219 AndroidManifest *string `android:"path"`
Jiyong Park40e26a22019-02-08 02:53:06 +09001220
Roland Levillain411c5842019-09-19 16:37:20 +01001221 // Canonical name of the APEX bundle. Used to determine the path to the activated APEX on
1222 // device (/apex/<apex_name>).
1223 // If unspecified, defaults to the value of name.
Jiyong Park05e70dd2019-03-18 14:26:32 +09001224 Apex_name *string
1225
Jiyong Parkd0a65ba2018-11-10 06:37:15 +09001226 // Determines the file contexts file for setting security context to each file in this APEX bundle.
Jooyung Han54aca7b2019-11-20 02:26:02 +09001227 // For platform APEXes, this should points to a file under /system/sepolicy
1228 // Default: /system/sepolicy/apex/<module_name>_file_contexts.
1229 File_contexts *string `android:"path"`
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001230
1231 // List of native shared libs that are embedded inside this APEX bundle
1232 Native_shared_libs []string
1233
Roland Levillain630846d2019-06-26 12:48:34 +01001234 // List of executables that are embedded inside this APEX bundle
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001235 Binaries []string
1236
1237 // List of java libraries that are embedded inside this APEX bundle
1238 Java_libs []string
1239
1240 // List of prebuilt files that are embedded inside this APEX bundle
1241 Prebuilts []string
Jiyong Parkff1458f2018-10-12 21:49:38 +09001242
Roland Levillain630846d2019-06-26 12:48:34 +01001243 // List of tests that are embedded inside this APEX bundle
1244 Tests []string
1245
Jiyong Parkff1458f2018-10-12 21:49:38 +09001246 // Name of the apex_key module that provides the private key to sign APEX
1247 Key *string
Jiyong Park397e55e2018-10-24 21:09:55 +09001248
Alex Light5098a612018-11-29 17:12:15 -08001249 // The type of APEX to build. Controls what the APEX payload is. Either
1250 // 'image', 'zip' or 'both'. Default: 'image'.
1251 Payload_type *string
1252
Jiyong Parkc00cbd92018-10-30 21:20:05 +09001253 // The name of a certificate in the default certificate directory, blank to use the default product certificate,
1254 // or an android_app_certificate module name in the form ":module".
1255 Certificate *string
1256
Jiyong Park92c0f9c2018-12-13 23:14:57 +09001257 // Whether this APEX is installable to one of the partitions. Default: true.
1258 Installable *bool
1259
Jiyong Parkda6eb592018-12-19 17:12:36 +09001260 // For native libraries and binaries, use the vendor variant instead of the core (platform) variant.
1261 // Default is false.
1262 Use_vendor *bool
1263
Alex Lightfc0bd7c2019-01-29 18:31:59 -08001264 // For telling the apex to ignore special handling for system libraries such as bionic. Default is false.
1265 Ignore_system_library_special_case *bool
1266
Alex Light9670d332019-01-29 18:07:33 -08001267 Multilib apexMultilibProperties
Jiyong Park235e67c2019-02-09 11:50:56 +09001268
Jiyong Parkf97782b2019-02-13 20:28:58 +09001269 // List of sanitizer names that this APEX is enabled for
1270 SanitizerNames []string `blueprint:"mutated"`
Jooyung Han5c998b92019-06-27 11:30:33 +09001271
Jiyong Parkee9a98d2019-08-09 14:44:36 +09001272 PreventInstall bool `blueprint:"mutated"`
1273
1274 HideFromMake bool `blueprint:"mutated"`
1275
Jooyung Han5c998b92019-06-27 11:30:33 +09001276 // Indicates this APEX provides C++ shared libaries to other APEXes. Default: false.
1277 Provide_cpp_shared_libs *bool
1278
1279 // List of providing APEXes' names so that this APEX can depend on provided shared libraries.
1280 Uses []string
Nikita Ioffe5d5ae762019-08-31 14:38:05 +01001281
1282 // A txt file containing list of files that are whitelisted to be included in this APEX.
1283 Whitelisted_files *string
Sundong Ahne1f05aa2019-08-27 13:55:42 +09001284
Sundong Ahnabb64432019-10-22 13:58:29 +09001285 // package format of this apex variant; could be non-flattened, flattened, or zip.
1286 // imageApex, zipApex or flattened
1287 ApexType apexPackaging `blueprint:"mutated"`
Sundong Ahne8fb7242019-09-17 13:50:45 +09001288
Jiyong Parkd1063c12019-07-17 20:08:41 +09001289 // List of SDKs that are used to build this APEX. A reference to an SDK should be either
1290 // `name#version` or `name` which is an alias for `name#current`. If left empty, `platform#current`
1291 // is implied. This value affects all modules included in this APEX. In other words, they are
1292 // also built with the SDKs specified here.
1293 Uses_sdks []string
Jiyong Park5d790c32019-11-15 18:40:32 +09001294
Nikita Ioffec72b5dd2019-12-07 17:30:22 +00001295 // Whenever apex_payload.img of the APEX should include dm-verity hashtree.
1296 // Should be only used in tests#.
1297 Test_only_no_hashtree *bool
Jooyung Han214bf372019-11-12 13:03:50 +09001298
Jiyong Park956305c2020-01-09 12:32:06 +09001299 IsCoverageVariant bool `blueprint:"mutated"`
Jiyong Park9d677202020-02-19 16:29:35 +09001300
1301 // Whether this APEX is considered updatable or not. When set to true, this will enforce additional
1302 // rules for making sure that the APEX is truely updatable. This will also disable the size optimizations
1303 // like symlinking to the system libs. Default is false.
1304 Updatable *bool
Colin Cross7365eaa2020-02-19 20:41:10 -08001305
1306 // The minimum SDK version that this apex must be compatible with.
1307 Min_sdk_version *string
Alex Light9670d332019-01-29 18:07:33 -08001308}
1309
1310type apexTargetBundleProperties struct {
1311 Target struct {
1312 // Multilib properties only for android.
1313 Android struct {
1314 Multilib apexMultilibProperties
Jiyong Park397e55e2018-10-24 21:09:55 +09001315 }
Jooyung Han344d5432019-08-23 11:17:39 +09001316
Alex Light9670d332019-01-29 18:07:33 -08001317 // Multilib properties only for host.
1318 Host struct {
1319 Multilib apexMultilibProperties
Jiyong Park397e55e2018-10-24 21:09:55 +09001320 }
Jooyung Han344d5432019-08-23 11:17:39 +09001321
Alex Light9670d332019-01-29 18:07:33 -08001322 // Multilib properties only for host linux_bionic.
1323 Linux_bionic struct {
1324 Multilib apexMultilibProperties
Jiyong Park397e55e2018-10-24 21:09:55 +09001325 }
Jooyung Han344d5432019-08-23 11:17:39 +09001326
Alex Light9670d332019-01-29 18:07:33 -08001327 // Multilib properties only for host linux_glibc.
1328 Linux_glibc struct {
1329 Multilib apexMultilibProperties
Jiyong Park397e55e2018-10-24 21:09:55 +09001330 }
1331 }
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001332}
1333
Jiyong Park5d790c32019-11-15 18:40:32 +09001334type overridableProperties struct {
1335 // List of APKs to package inside APEX
1336 Apps []string
Jaewoong Jung7abcf8e2019-12-19 17:32:06 -08001337
1338 // Names of modules to be overridden. Listed modules can only be other binaries
1339 // (in Make or Soong).
1340 // This does not completely prevent installation of the overridden binaries, but if both
1341 // binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed
1342 // from PRODUCT_PACKAGES.
1343 Overrides []string
Baligh Uddin004d7172020-02-19 21:29:28 -08001344
1345 // Logging Parent value
1346 Logging_parent string
Baligh Uddincb6aa122020-03-15 13:01:05 -07001347
1348 // Apex Container Package Name.
1349 // Override value for attribute package:name in AndroidManifest.xml
1350 Package_name string
Jiyong Park5d790c32019-11-15 18:40:32 +09001351}
1352
Alex Light5098a612018-11-29 17:12:15 -08001353type apexPackaging int
1354
1355const (
1356 imageApex apexPackaging = iota
1357 zipApex
Sundong Ahnabb64432019-10-22 13:58:29 +09001358 flattenedApex
Alex Light5098a612018-11-29 17:12:15 -08001359)
1360
Sundong Ahnabb64432019-10-22 13:58:29 +09001361// The suffix for the output "file", not the module
Alex Light5098a612018-11-29 17:12:15 -08001362func (a apexPackaging) suffix() string {
1363 switch a {
1364 case imageApex:
1365 return imageApexSuffix
1366 case zipApex:
1367 return zipApexSuffix
Alex Light5098a612018-11-29 17:12:15 -08001368 default:
Roland Levillain4644b222019-07-31 14:09:17 +01001369 panic(fmt.Errorf("unknown APEX type %d", a))
Alex Light5098a612018-11-29 17:12:15 -08001370 }
1371}
1372
1373func (a apexPackaging) name() string {
1374 switch a {
1375 case imageApex:
1376 return imageApexType
1377 case zipApex:
1378 return zipApexType
Alex Light5098a612018-11-29 17:12:15 -08001379 default:
Roland Levillain4644b222019-07-31 14:09:17 +01001380 panic(fmt.Errorf("unknown APEX type %d", a))
Alex Light5098a612018-11-29 17:12:15 -08001381 }
1382}
1383
Jiyong Parkf653b052019-11-18 15:39:01 +09001384type apexFileClass int
1385
1386const (
1387 etc apexFileClass = iota
1388 nativeSharedLib
1389 nativeExecutable
1390 shBinary
1391 pyBinary
1392 goBinary
1393 javaSharedLib
1394 nativeTest
1395 app
1396)
1397
Jiyong Park8fd61922018-11-08 02:50:25 +09001398func (class apexFileClass) NameInMake() string {
1399 switch class {
1400 case etc:
1401 return "ETC"
1402 case nativeSharedLib:
1403 return "SHARED_LIBRARIES"
Alex Light778127a2019-02-27 14:19:50 -08001404 case nativeExecutable, shBinary, pyBinary, goBinary:
Jiyong Park8fd61922018-11-08 02:50:25 +09001405 return "EXECUTABLES"
1406 case javaSharedLib:
1407 return "JAVA_LIBRARIES"
Roland Levillain630846d2019-06-26 12:48:34 +01001408 case nativeTest:
1409 return "NATIVE_TESTS"
Sundong Ahne1f05aa2019-08-27 13:55:42 +09001410 case app:
Jiyong Parkf383f7c2019-10-11 20:46:25 +09001411 // b/142537672 Why isn't this APP? We want to have full control over
1412 // the paths and file names of the apk file under the flattend APEX.
1413 // If this is set to APP, then the paths and file names are modified
1414 // by the Make build system. For example, it is installed to
1415 // /system/apex/<apexname>/app/<Appname>/<apexname>.<Appname>/ instead of
1416 // /system/apex/<apexname>/app/<Appname> because the build system automatically
1417 // appends module name (which is <apexname>.<Appname> to the path.
1418 return "ETC"
Jiyong Park8fd61922018-11-08 02:50:25 +09001419 default:
Roland Levillain4644b222019-07-31 14:09:17 +01001420 panic(fmt.Errorf("unknown class %d", class))
Jiyong Park8fd61922018-11-08 02:50:25 +09001421 }
1422}
1423
Jiyong Parkf653b052019-11-18 15:39:01 +09001424// apexFile represents a file in an APEX bundle
Jiyong Park8fd61922018-11-08 02:50:25 +09001425type apexFile struct {
1426 builtFile android.Path
1427 moduleName string
Jiyong Park8fd61922018-11-08 02:50:25 +09001428 installDir string
1429 class apexFileClass
Jiyong Parka8894842018-12-19 17:36:39 +09001430 module android.Module
Jiyong Parkf653b052019-11-18 15:39:01 +09001431 // list of symlinks that will be created in installDir that point to this apexFile
1432 symlinks []string
1433 transitiveDep bool
Jiyong Park1833cef2019-12-13 13:28:36 +09001434 moduleDir string
Jiyong Park7afd1072019-12-30 16:56:33 +09001435
1436 requiredModuleNames []string
1437 targetRequiredModuleNames []string
1438 hostRequiredModuleNames []string
Jiyong Park618922e2020-01-08 13:35:43 +09001439
Colin Cross503c1d02020-01-28 14:00:53 -08001440 jacocoReportClassesFile android.Path // only for javalibs and apps
1441 certificate java.Certificate // only for apps
Jiyong Parkaf8998c2020-02-28 16:51:07 +09001442 overriddenPackageName string // only for apps
Jiyong Parkf653b052019-11-18 15:39:01 +09001443}
1444
Jiyong Park1833cef2019-12-13 13:28:36 +09001445func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, moduleName string, installDir string, class apexFileClass, module android.Module) apexFile {
1446 ret := apexFile{
Jiyong Parkf653b052019-11-18 15:39:01 +09001447 builtFile: builtFile,
1448 moduleName: moduleName,
1449 installDir: installDir,
1450 class: class,
1451 module: module,
1452 }
Jiyong Park1833cef2019-12-13 13:28:36 +09001453 if module != nil {
1454 ret.moduleDir = ctx.OtherModuleDir(module)
Jiyong Park7afd1072019-12-30 16:56:33 +09001455 ret.requiredModuleNames = module.RequiredModuleNames()
1456 ret.targetRequiredModuleNames = module.TargetRequiredModuleNames()
1457 ret.hostRequiredModuleNames = module.HostRequiredModuleNames()
Jiyong Park1833cef2019-12-13 13:28:36 +09001458 }
1459 return ret
Jiyong Parkf653b052019-11-18 15:39:01 +09001460}
1461
1462func (af *apexFile) Ok() bool {
Jiyong Park479321d2019-12-16 11:47:12 +09001463 return af.builtFile != nil && af.builtFile.String() != ""
Jiyong Park8fd61922018-11-08 02:50:25 +09001464}
1465
Jiyong Park7cd10e32020-01-14 09:22:18 +09001466// Path() returns path of this apex file relative to the APEX root
1467func (af *apexFile) Path() string {
1468 return filepath.Join(af.installDir, af.builtFile.Base())
1469}
1470
1471// SymlinkPaths() returns paths of the symlinks (if any) relative to the APEX root
1472func (af *apexFile) SymlinkPaths() []string {
1473 var ret []string
1474 for _, symlink := range af.symlinks {
1475 ret = append(ret, filepath.Join(af.installDir, symlink))
1476 }
1477 return ret
1478}
1479
1480func (af *apexFile) AvailableToPlatform() bool {
1481 if af.module == nil {
1482 return false
1483 }
1484 if am, ok := af.module.(android.ApexModule); ok {
1485 return am.AvailableFor(android.AvailableToPlatform)
1486 }
1487 return false
1488}
1489
Jiyong Park678c8812020-02-07 17:25:49 +09001490type depInfo struct {
1491 to string
1492 from []string
1493 isExternal bool
1494}
1495
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001496type apexBundle struct {
1497 android.ModuleBase
1498 android.DefaultableModuleBase
Jiyong Park5d790c32019-11-15 18:40:32 +09001499 android.OverridableModuleBase
Jiyong Parkd1063c12019-07-17 20:08:41 +09001500 android.SdkBase
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001501
Jiyong Park5d790c32019-11-15 18:40:32 +09001502 properties apexBundleProperties
1503 targetProperties apexTargetBundleProperties
Jiyong Park5d790c32019-11-15 18:40:32 +09001504 overridableProperties overridableProperties
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001505
Jooyung Hanf21c7972019-12-16 22:32:06 +09001506 // specific to apex_vndk modules
1507 vndkProperties apexVndkProperties
1508
Colin Crossa4925902018-11-16 11:36:28 -08001509 bundleModuleFile android.WritablePath
Sundong Ahnabb64432019-10-22 13:58:29 +09001510 outputFile android.WritablePath
Colin Cross70dda7e2019-10-01 22:05:35 -07001511 installDir android.InstallPath
Jiyong Park8fd61922018-11-08 02:50:25 +09001512
Jiyong Park03b68dd2019-07-26 23:20:40 +09001513 prebuiltFileToDelete string
1514
Jiyong Park42cca6c2019-04-01 11:15:50 +09001515 public_key_file android.Path
1516 private_key_file android.Path
Jiyong Park0ca3ce82019-02-18 15:25:04 +09001517
1518 container_certificate_file android.Path
1519 container_private_key_file android.Path
1520
Jooyung Han54aca7b2019-11-20 02:26:02 +09001521 fileContexts android.Path
1522
Jiyong Park8fd61922018-11-08 02:50:25 +09001523 // list of files to be included in this apex
1524 filesInfo []apexFile
1525
Jiyong Park956305c2020-01-09 12:32:06 +09001526 // list of module names that should be installed along with this APEX
1527 requiredDeps []string
1528
Jiyong Park956305c2020-01-09 12:32:06 +09001529 // list of module names that this APEX is including (to be shown via *-deps-info target)
Jiyong Park678c8812020-02-07 17:25:49 +09001530 depInfos map[string]depInfo
Jiyong Parkac2bacd2019-02-20 21:49:26 +09001531
Sundong Ahnabb64432019-10-22 13:58:29 +09001532 testApex bool
1533 vndkApex bool
Ulyana Trafimovichde534412019-11-08 10:51:01 +00001534 artApex bool
Sundong Ahnabb64432019-10-22 13:58:29 +09001535 primaryApexType bool
Jooyung Hane1633032019-08-01 17:41:43 +09001536
Jooyung Han214bf372019-11-12 13:03:50 +09001537 manifestJsonOut android.WritablePath
1538 manifestPbOut android.WritablePath
Jooyung Han72bd2f82019-10-23 16:46:38 +09001539
Jooyung Han002ab682020-01-08 01:57:58 +09001540 // list of commands to create symlinks for backward compatibility.
Jooyung Han72bd2f82019-10-23 16:46:38 +09001541 // these commands will be attached as LOCAL_POST_INSTALL_CMD to
Jooyung Han002ab682020-01-08 01:57:58 +09001542 // apex package itself(for unflattened build) or apex_manifest(for flattened build)
Jooyung Han72bd2f82019-10-23 16:46:38 +09001543 // so that compat symlinks are always installed regardless of TARGET_FLATTEN_APEX setting.
1544 compatSymlinks []string
Sundong Ahnabb64432019-10-22 13:58:29 +09001545
1546 // Suffix of module name in Android.mk
1547 // ".flattened", ".apex", ".zipapex", or ""
1548 suffix string
Jiyong Park3a1602e2020-01-14 14:39:19 +09001549
1550 installedFilesFile android.WritablePath
Jiyong Park7cd10e32020-01-14 09:22:18 +09001551
1552 // Whether to create symlink to the system file instead of having a file
1553 // inside the apex or not
1554 linkToSystemLib bool
Jiyong Park19972c72020-01-28 20:05:29 +09001555
1556 // Struct holding the merged notice file paths in different formats
1557 mergedNotices android.NoticeOutputs
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001558}
1559
Jiyong Park397e55e2018-10-24 21:09:55 +09001560func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext,
Roland Levillain630846d2019-06-26 12:48:34 +01001561 native_shared_libs []string, binaries []string, tests []string,
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001562 target android.Target, imageVariation string) {
Jiyong Park397e55e2018-10-24 21:09:55 +09001563 // Use *FarVariation* to be able to depend on modules having
1564 // conflicting variations with this module. This is required since
1565 // arch variant of an APEX bundle is 'common' but it is 'arm' or 'arm64'
1566 // for native shared libs.
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001567 ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
Jiyong Parkda6eb592018-12-19 17:12:36 +09001568 {Mutator: "image", Variation: imageVariation},
Jiyong Park397e55e2018-10-24 21:09:55 +09001569 {Mutator: "link", Variation: "shared"},
Jiyong Park28d395a2018-12-07 22:42:47 +09001570 {Mutator: "version", Variation: ""}, // "" is the non-stub variant
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001571 }...), sharedLibTag, native_shared_libs...)
Jiyong Park397e55e2018-10-24 21:09:55 +09001572
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001573 ctx.AddFarVariationDependencies(append(target.Variations(),
1574 blueprint.Variation{Mutator: "image", Variation: imageVariation}),
1575 executableTag, binaries...)
Roland Levillain630846d2019-06-26 12:48:34 +01001576
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001577 ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
Roland Levillain630846d2019-06-26 12:48:34 +01001578 {Mutator: "image", Variation: imageVariation},
Roland Levillain9b5fde92019-06-28 15:41:19 +01001579 {Mutator: "test_per_src", Variation: ""}, // "" is the all-tests variant
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001580 }...), testTag, tests...)
Jiyong Park397e55e2018-10-24 21:09:55 +09001581}
1582
Alex Light9670d332019-01-29 18:07:33 -08001583func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) {
1584 if ctx.Os().Class == android.Device {
1585 proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Android.Multilib, nil)
1586 } else {
1587 proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Host.Multilib, nil)
1588 if ctx.Os().Bionic() {
1589 proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Linux_bionic.Multilib, nil)
1590 } else {
1591 proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Linux_glibc.Multilib, nil)
1592 }
1593 }
1594}
1595
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001596func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
Jooyung Handc782442019-11-01 03:14:38 +09001597 if proptools.Bool(a.properties.Use_vendor) && !android.InList(a.Name(), useVendorWhitelist(ctx.Config())) {
1598 ctx.PropertyErrorf("use_vendor", "not allowed to set use_vendor: true")
1599 }
1600
Jiyong Park397e55e2018-10-24 21:09:55 +09001601 targets := ctx.MultiTargets()
Jiyong Park7c1dc612019-01-05 11:15:24 +09001602 config := ctx.DeviceConfig()
Alex Light9670d332019-01-29 18:07:33 -08001603
1604 a.combineProperties(ctx)
1605
Jiyong Park397e55e2018-10-24 21:09:55 +09001606 has32BitTarget := false
1607 for _, target := range targets {
1608 if target.Arch.ArchType.Multilib == "lib32" {
1609 has32BitTarget = true
1610 }
1611 }
1612 for i, target := range targets {
1613 // When multilib.* is omitted for native_shared_libs, it implies
1614 // multilib.both.
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001615 ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
Jiyong Park7c1dc612019-01-05 11:15:24 +09001616 {Mutator: "image", Variation: a.getImageVariation(config)},
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001617 {Mutator: "link", Variation: "shared"},
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001618 }...), sharedLibTag, a.properties.Native_shared_libs...)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001619
Roland Levillain630846d2019-06-26 12:48:34 +01001620 // When multilib.* is omitted for tests, it implies
1621 // multilib.both.
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001622 ctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
Roland Levillain630846d2019-06-26 12:48:34 +01001623 {Mutator: "image", Variation: a.getImageVariation(config)},
Roland Levillain9b5fde92019-06-28 15:41:19 +01001624 {Mutator: "test_per_src", Variation: ""}, // "" is the all-tests variant
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001625 }...), testTag, a.properties.Tests...)
Roland Levillain630846d2019-06-26 12:48:34 +01001626
Jiyong Park397e55e2018-10-24 21:09:55 +09001627 // Add native modules targetting both ABIs
1628 addDependenciesForNativeModules(ctx,
1629 a.properties.Multilib.Both.Native_shared_libs,
Roland Levillain630846d2019-06-26 12:48:34 +01001630 a.properties.Multilib.Both.Binaries,
1631 a.properties.Multilib.Both.Tests,
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001632 target,
Jiyong Park7c1dc612019-01-05 11:15:24 +09001633 a.getImageVariation(config))
Jiyong Park397e55e2018-10-24 21:09:55 +09001634
Alex Light3d673592019-01-18 14:37:31 -08001635 isPrimaryAbi := i == 0
1636 if isPrimaryAbi {
Jiyong Park397e55e2018-10-24 21:09:55 +09001637 // When multilib.* is omitted for binaries, it implies
1638 // multilib.first.
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001639 ctx.AddFarVariationDependencies(append(target.Variations(),
1640 blueprint.Variation{Mutator: "image", Variation: a.getImageVariation(config)}),
1641 executableTag, a.properties.Binaries...)
Jiyong Park397e55e2018-10-24 21:09:55 +09001642
1643 // Add native modules targetting the first ABI
1644 addDependenciesForNativeModules(ctx,
1645 a.properties.Multilib.First.Native_shared_libs,
Roland Levillain630846d2019-06-26 12:48:34 +01001646 a.properties.Multilib.First.Binaries,
1647 a.properties.Multilib.First.Tests,
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001648 target,
Jiyong Park7c1dc612019-01-05 11:15:24 +09001649 a.getImageVariation(config))
Jiyong Park397e55e2018-10-24 21:09:55 +09001650 }
1651
1652 switch target.Arch.ArchType.Multilib {
1653 case "lib32":
1654 // Add native modules targetting 32-bit ABI
1655 addDependenciesForNativeModules(ctx,
1656 a.properties.Multilib.Lib32.Native_shared_libs,
Roland Levillain630846d2019-06-26 12:48:34 +01001657 a.properties.Multilib.Lib32.Binaries,
1658 a.properties.Multilib.Lib32.Tests,
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001659 target,
Jiyong Park7c1dc612019-01-05 11:15:24 +09001660 a.getImageVariation(config))
Jiyong Park397e55e2018-10-24 21:09:55 +09001661
1662 addDependenciesForNativeModules(ctx,
1663 a.properties.Multilib.Prefer32.Native_shared_libs,
Roland Levillain630846d2019-06-26 12:48:34 +01001664 a.properties.Multilib.Prefer32.Binaries,
1665 a.properties.Multilib.Prefer32.Tests,
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001666 target,
Jiyong Park7c1dc612019-01-05 11:15:24 +09001667 a.getImageVariation(config))
Jiyong Park397e55e2018-10-24 21:09:55 +09001668 case "lib64":
1669 // Add native modules targetting 64-bit ABI
1670 addDependenciesForNativeModules(ctx,
1671 a.properties.Multilib.Lib64.Native_shared_libs,
Roland Levillain630846d2019-06-26 12:48:34 +01001672 a.properties.Multilib.Lib64.Binaries,
1673 a.properties.Multilib.Lib64.Tests,
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001674 target,
Jiyong Park7c1dc612019-01-05 11:15:24 +09001675 a.getImageVariation(config))
Jiyong Park397e55e2018-10-24 21:09:55 +09001676
1677 if !has32BitTarget {
1678 addDependenciesForNativeModules(ctx,
1679 a.properties.Multilib.Prefer32.Native_shared_libs,
Roland Levillain630846d2019-06-26 12:48:34 +01001680 a.properties.Multilib.Prefer32.Binaries,
1681 a.properties.Multilib.Prefer32.Tests,
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001682 target,
Jiyong Park7c1dc612019-01-05 11:15:24 +09001683 a.getImageVariation(config))
Jiyong Park397e55e2018-10-24 21:09:55 +09001684 }
Peter Collingbourne3478bb22019-04-24 14:41:12 -07001685
1686 if strings.HasPrefix(ctx.ModuleName(), "com.android.runtime") && target.Os.Class == android.Device {
1687 for _, sanitizer := range ctx.Config().SanitizeDevice() {
1688 if sanitizer == "hwaddress" {
1689 addDependenciesForNativeModules(ctx,
1690 []string{"libclang_rt.hwasan-aarch64-android"},
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001691 nil, nil, target, a.getImageVariation(config))
Peter Collingbourne3478bb22019-04-24 14:41:12 -07001692 break
1693 }
1694 }
1695 }
Jiyong Park397e55e2018-10-24 21:09:55 +09001696 }
1697
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001698 }
1699
Jiyong Parkce6aadc2019-11-20 13:58:28 +09001700 // For prebuilt_etc, use the first variant (64 on 64/32bit device,
1701 // 32 on 32bit device) regardless of the TARGET_PREFER_* setting.
1702 // b/144532908
1703 archForPrebuiltEtc := config.Arches()[0]
1704 for _, arch := range config.Arches() {
1705 // Prefer 64-bit arch if there is any
1706 if arch.ArchType.Multilib == "lib64" {
1707 archForPrebuiltEtc = arch
1708 break
1709 }
1710 }
1711 ctx.AddFarVariationDependencies([]blueprint.Variation{
1712 {Mutator: "os", Variation: ctx.Os().String()},
1713 {Mutator: "arch", Variation: archForPrebuiltEtc.String()},
1714 }, prebuiltTag, a.properties.Prebuilts...)
1715
Colin Cross0f7d2ef2019-10-16 11:03:10 -07001716 ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(),
1717 javaLibTag, a.properties.Java_libs...)
Jiyong Parkff1458f2018-10-12 21:49:38 +09001718
Ulya Trafimovich44561882020-01-03 13:25:54 +00001719 // With EMMA_INSTRUMENT_FRAMEWORK=true the ART boot image includes jacoco library.
1720 if a.artApex && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
1721 ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(),
1722 javaLibTag, "jacocoagent")
1723 }
1724
Jiyong Park23c52b02019-02-02 13:13:47 +09001725 if String(a.properties.Key) == "" {
1726 ctx.ModuleErrorf("key is missing")
1727 return
1728 }
1729 ctx.AddDependency(ctx.Module(), keyTag, String(a.properties.Key))
Jiyong Parkc00cbd92018-10-30 21:20:05 +09001730
Jiyong Parkb2742fd2019-02-11 11:38:15 +09001731 cert := android.SrcIsModule(a.getCertString(ctx))
Jiyong Park23c52b02019-02-02 13:13:47 +09001732 if cert != "" {
1733 ctx.AddDependency(ctx.Module(), certificateTag, cert)
Jiyong Parkc00cbd92018-10-30 21:20:05 +09001734 }
Jiyong Parkd1063c12019-07-17 20:08:41 +09001735
1736 // TODO(jiyong): ensure that all apexes are with non-empty uses_sdks
1737 if len(a.properties.Uses_sdks) > 0 {
1738 sdkRefs := []android.SdkRef{}
1739 for _, str := range a.properties.Uses_sdks {
1740 parsed := android.ParseSdkRef(ctx, str, "uses_sdks")
1741 sdkRefs = append(sdkRefs, parsed)
1742 }
1743 a.BuildWithSdks(sdkRefs)
1744 }
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001745}
1746
Jiyong Park5d790c32019-11-15 18:40:32 +09001747func (a *apexBundle) OverridablePropertiesDepsMutator(ctx android.BottomUpMutatorContext) {
1748 ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(),
1749 androidAppTag, a.overridableProperties.Apps...)
1750}
1751
Jiyong Parka7bc8ad2019-10-15 15:20:07 +09001752func (a *apexBundle) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
1753 // direct deps of an APEX bundle are all part of the APEX bundle
1754 return true
1755}
1756
Colin Cross0ea8ba82019-06-06 14:33:29 -07001757func (a *apexBundle) getCertString(ctx android.BaseModuleContext) string {
Jooyung Han27151d92019-12-16 17:45:32 +09001758 moduleName := ctx.ModuleName()
1759 // VNDK APEXes share the same certificate. To avoid adding a new VNDK version to the OVERRIDE_* list,
1760 // we check with the pseudo module name to see if its certificate is overridden.
1761 if a.vndkApex {
1762 moduleName = vndkApexName
1763 }
1764 certificate, overridden := ctx.DeviceConfig().OverrideCertificateFor(moduleName)
Jiyong Parkb2742fd2019-02-11 11:38:15 +09001765 if overridden {
Jaewoong Jungacb6db32019-02-28 16:22:30 +00001766 return ":" + certificate
Jiyong Parkb2742fd2019-02-11 11:38:15 +09001767 }
1768 return String(a.properties.Certificate)
1769}
1770
Colin Cross41955e82019-05-29 14:40:35 -07001771func (a *apexBundle) OutputFiles(tag string) (android.Paths, error) {
1772 switch tag {
1773 case "":
Sundong Ahnabb64432019-10-22 13:58:29 +09001774 return android.Paths{a.outputFile}, nil
Colin Cross41955e82019-05-29 14:40:35 -07001775 default:
1776 return nil, fmt.Errorf("unsupported module reference tag %q", tag)
Jiyong Park5a832022018-12-20 09:54:35 +09001777 }
Jiyong Park74e240b2018-11-27 21:27:08 +09001778}
1779
Jiyong Park92c0f9c2018-12-13 23:14:57 +09001780func (a *apexBundle) installable() bool {
Jiyong Parkee9a98d2019-08-09 14:44:36 +09001781 return !a.properties.PreventInstall && (a.properties.Installable == nil || proptools.Bool(a.properties.Installable))
Jiyong Park92c0f9c2018-12-13 23:14:57 +09001782}
1783
Nikita Ioffec72b5dd2019-12-07 17:30:22 +00001784func (a *apexBundle) testOnlyShouldSkipHashtreeGeneration() bool {
1785 return proptools.Bool(a.properties.Test_only_no_hashtree)
1786}
1787
Jiyong Park7c1dc612019-01-05 11:15:24 +09001788func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
Jooyung Han31c470b2019-10-18 16:26:59 +09001789 if a.vndkApex {
Colin Cross7228ecd2019-11-18 16:00:16 -08001790 return cc.VendorVariationPrefix + a.vndkVersion(config)
Jooyung Han31c470b2019-10-18 16:26:59 +09001791 }
Jiyong Park7c1dc612019-01-05 11:15:24 +09001792 if config.VndkVersion() != "" && proptools.Bool(a.properties.Use_vendor) {
Colin Cross7228ecd2019-11-18 16:00:16 -08001793 return cc.VendorVariationPrefix + config.PlatformVndkVersion()
Jiyong Parkda6eb592018-12-19 17:12:36 +09001794 } else {
Colin Cross7228ecd2019-11-18 16:00:16 -08001795 return android.CoreVariation
Jiyong Parkda6eb592018-12-19 17:12:36 +09001796 }
1797}
1798
Jiyong Parkf97782b2019-02-13 20:28:58 +09001799func (a *apexBundle) EnableSanitizer(sanitizerName string) {
1800 if !android.InList(sanitizerName, a.properties.SanitizerNames) {
1801 a.properties.SanitizerNames = append(a.properties.SanitizerNames, sanitizerName)
1802 }
1803}
1804
Jiyong Park388ef3f2019-01-28 19:47:32 +09001805func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool {
Jiyong Parkf97782b2019-02-13 20:28:58 +09001806 if android.InList(sanitizerName, a.properties.SanitizerNames) {
1807 return true
Jiyong Park235e67c2019-02-09 11:50:56 +09001808 }
1809
1810 // Then follow the global setting
Jiyong Park388ef3f2019-01-28 19:47:32 +09001811 globalSanitizerNames := []string{}
1812 if a.Host() {
1813 globalSanitizerNames = ctx.Config().SanitizeHost()
1814 } else {
1815 arches := ctx.Config().SanitizeDeviceArch()
1816 if len(arches) == 0 || android.InList(a.Arch().ArchType.Name, arches) {
1817 globalSanitizerNames = ctx.Config().SanitizeDevice()
1818 }
1819 }
1820 return android.InList(sanitizerName, globalSanitizerNames)
Jiyong Park379de2f2018-12-19 02:47:14 +09001821}
1822
Jiyong Parkee9a98d2019-08-09 14:44:36 +09001823func (a *apexBundle) IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool {
Oliver Nguyen1382ab62019-12-06 15:22:41 -08001824 return ctx.Device() && (ctx.DeviceConfig().NativeCoverageEnabled() || ctx.DeviceConfig().ClangCoverageEnabled())
Jiyong Parkee9a98d2019-08-09 14:44:36 +09001825}
1826
1827func (a *apexBundle) PreventInstall() {
1828 a.properties.PreventInstall = true
1829}
1830
1831func (a *apexBundle) HideFromMake() {
1832 a.properties.HideFromMake = true
1833}
1834
Jiyong Park956305c2020-01-09 12:32:06 +09001835func (a *apexBundle) MarkAsCoverageVariant(coverage bool) {
1836 a.properties.IsCoverageVariant = coverage
1837}
1838
Jiyong Parkf653b052019-11-18 15:39:01 +09001839// TODO(jiyong) move apexFileFor* close to the apexFile type definition
Jiyong Park1833cef2019-12-13 13:28:36 +09001840func apexFileForNativeLibrary(ctx android.BaseModuleContext, ccMod *cc.Module, handleSpecialLibs bool) apexFile {
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001841 // Decide the APEX-local directory by the multilib of the library
1842 // In the future, we may query this to the module.
Jiyong Parkf653b052019-11-18 15:39:01 +09001843 var dirInApex string
Martin Stjernholm279de572019-09-10 23:18:20 +01001844 switch ccMod.Arch().ArchType.Multilib {
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001845 case "lib32":
1846 dirInApex = "lib"
1847 case "lib64":
1848 dirInApex = "lib64"
1849 }
Martin Stjernholm279de572019-09-10 23:18:20 +01001850 dirInApex = filepath.Join(dirInApex, ccMod.RelativeInstallPath())
Colin Cross3b19f5d2019-09-17 14:45:31 -07001851 if ccMod.Target().NativeBridge == android.NativeBridgeEnabled {
Martin Stjernholm279de572019-09-10 23:18:20 +01001852 dirInApex = filepath.Join(dirInApex, ccMod.Target().NativeBridgeRelativePath)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001853 }
Jiyong Park1833cef2019-12-13 13:28:36 +09001854 if handleSpecialLibs && cc.InstallToBootstrap(ccMod.BaseModuleName(), ctx.Config()) {
Martin Stjernholm279de572019-09-10 23:18:20 +01001855 // Special case for Bionic libs and other libs installed with them. This is
1856 // to prevent those libs from being included in the search path
1857 // /apex/com.android.runtime/${LIB}. This exclusion is required because
1858 // those libs in the Runtime APEX are available via the legacy paths in
1859 // /system/lib/. By the init process, the libs in the APEX are bind-mounted
1860 // to the legacy paths and thus will be loaded into the default linker
1861 // namespace (aka "platform" namespace). If the libs are directly in
1862 // /apex/com.android.runtime/${LIB} then the same libs will be loaded again
1863 // into the runtime linker namespace, which will result in double loading of
1864 // them, which isn't supported.
1865 dirInApex = filepath.Join(dirInApex, "bionic")
Jiyong Parkb0788572018-12-20 22:10:17 +09001866 }
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001867
Jiyong Parkf653b052019-11-18 15:39:01 +09001868 fileToCopy := ccMod.OutputFile().Path()
Jiyong Park1833cef2019-12-13 13:28:36 +09001869 return newApexFile(ctx, fileToCopy, ccMod.Name(), dirInApex, nativeSharedLib, ccMod)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001870}
1871
Jiyong Park1833cef2019-12-13 13:28:36 +09001872func apexFileForExecutable(ctx android.BaseModuleContext, cc *cc.Module) apexFile {
Jiyong Parkf653b052019-11-18 15:39:01 +09001873 dirInApex := filepath.Join("bin", cc.RelativeInstallPath())
Colin Cross3b19f5d2019-09-17 14:45:31 -07001874 if cc.Target().NativeBridge == android.NativeBridgeEnabled {
dimitry8d6dde82019-07-11 10:23:53 +02001875 dirInApex = filepath.Join(dirInApex, cc.Target().NativeBridgeRelativePath)
Jiyong Parkacbf6c72019-07-09 16:19:16 +09001876 }
Jiyong Parkf653b052019-11-18 15:39:01 +09001877 fileToCopy := cc.OutputFile().Path()
Jiyong Park1833cef2019-12-13 13:28:36 +09001878 af := newApexFile(ctx, fileToCopy, cc.Name(), dirInApex, nativeExecutable, cc)
Jiyong Parkf653b052019-11-18 15:39:01 +09001879 af.symlinks = cc.Symlinks()
1880 return af
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001881}
1882
Jiyong Park1833cef2019-12-13 13:28:36 +09001883func apexFileForPyBinary(ctx android.BaseModuleContext, py *python.Module) apexFile {
Jiyong Parkf653b052019-11-18 15:39:01 +09001884 dirInApex := "bin"
1885 fileToCopy := py.HostToolPath().Path()
Jiyong Park1833cef2019-12-13 13:28:36 +09001886 return newApexFile(ctx, fileToCopy, py.Name(), dirInApex, pyBinary, py)
Alex Light778127a2019-02-27 14:19:50 -08001887}
Jiyong Park1833cef2019-12-13 13:28:36 +09001888func apexFileForGoBinary(ctx android.BaseModuleContext, depName string, gb bootstrap.GoBinaryTool) apexFile {
Jiyong Parkf653b052019-11-18 15:39:01 +09001889 dirInApex := "bin"
Alex Light778127a2019-02-27 14:19:50 -08001890 s, err := filepath.Rel(android.PathForOutput(ctx).String(), gb.InstallPath())
1891 if err != nil {
1892 ctx.ModuleErrorf("Unable to use compiled binary at %s", gb.InstallPath())
Jiyong Parkf653b052019-11-18 15:39:01 +09001893 return apexFile{}
Alex Light778127a2019-02-27 14:19:50 -08001894 }
Jiyong Parkf653b052019-11-18 15:39:01 +09001895 fileToCopy := android.PathForOutput(ctx, s)
1896 // NB: Since go binaries are static we don't need the module for anything here, which is
1897 // good since the go tool is a blueprint.Module not an android.Module like we would
1898 // normally use.
Jiyong Park1833cef2019-12-13 13:28:36 +09001899 return newApexFile(ctx, fileToCopy, depName, dirInApex, goBinary, nil)
Alex Light778127a2019-02-27 14:19:50 -08001900}
1901
Jiyong Park1833cef2019-12-13 13:28:36 +09001902func apexFileForShBinary(ctx android.BaseModuleContext, sh *android.ShBinary) apexFile {
Jiyong Parkf653b052019-11-18 15:39:01 +09001903 dirInApex := filepath.Join("bin", sh.SubDir())
1904 fileToCopy := sh.OutputFile()
Jiyong Park1833cef2019-12-13 13:28:36 +09001905 af := newApexFile(ctx, fileToCopy, sh.Name(), dirInApex, shBinary, sh)
Jiyong Parkf653b052019-11-18 15:39:01 +09001906 af.symlinks = sh.Symlinks()
1907 return af
Jiyong Park04480cf2019-02-06 00:16:29 +09001908}
1909
Jooyung Han58f26ab2019-12-18 15:34:32 +09001910// TODO(b/146586360): replace javaLibrary(in apex/apex.go) with java.Dependency
1911type javaLibrary interface {
1912 android.Module
1913 java.Dependency
1914}
1915
1916func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaLibrary) apexFile {
Jiyong Parkf653b052019-11-18 15:39:01 +09001917 dirInApex := "javalib"
Jooyung Han58f26ab2019-12-18 15:34:32 +09001918 fileToCopy := lib.DexJar()
Jiyong Park618922e2020-01-08 13:35:43 +09001919 af := newApexFile(ctx, fileToCopy, lib.Name(), dirInApex, javaSharedLib, lib)
1920 af.jacocoReportClassesFile = lib.JacocoReportClassesFile()
1921 return af
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001922}
1923
Jiyong Park1833cef2019-12-13 13:28:36 +09001924func apexFileForPrebuiltEtc(ctx android.BaseModuleContext, prebuilt android.PrebuiltEtcModule, depName string) apexFile {
Jiyong Parkf653b052019-11-18 15:39:01 +09001925 dirInApex := filepath.Join("etc", prebuilt.SubDir())
1926 fileToCopy := prebuilt.OutputFile()
Jiyong Park1833cef2019-12-13 13:28:36 +09001927 return newApexFile(ctx, fileToCopy, depName, dirInApex, etc, prebuilt)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09001928}
1929
atrost6e126252020-01-27 17:01:16 +00001930func apexFileForCompatConfig(ctx android.BaseModuleContext, config java.PlatformCompatConfigIntf, depName string) apexFile {
1931 dirInApex := filepath.Join("etc", config.SubDir())
1932 fileToCopy := config.CompatConfig()
1933 return newApexFile(ctx, fileToCopy, depName, dirInApex, etc, config)
1934}
1935
Jiyong Park1833cef2019-12-13 13:28:36 +09001936func apexFileForAndroidApp(ctx android.BaseModuleContext, aapp interface {
Jiyong Parkf653b052019-11-18 15:39:01 +09001937 android.Module
1938 Privileged() bool
1939 OutputFile() android.Path
Jiyong Park618922e2020-01-08 13:35:43 +09001940 JacocoReportClassesFile() android.Path
Colin Cross503c1d02020-01-28 14:00:53 -08001941 Certificate() java.Certificate
Jiyong Parkf653b052019-11-18 15:39:01 +09001942}, pkgName string) apexFile {
Jiyong Parkf7487312019-10-17 12:54:30 +09001943 appDir := "app"
Jiyong Parkf653b052019-11-18 15:39:01 +09001944 if aapp.Privileged() {
Jiyong Parkf7487312019-10-17 12:54:30 +09001945 appDir = "priv-app"
1946 }
Jiyong Parkf653b052019-11-18 15:39:01 +09001947 dirInApex := filepath.Join(appDir, pkgName)
1948 fileToCopy := aapp.OutputFile()
Jiyong Park618922e2020-01-08 13:35:43 +09001949 af := newApexFile(ctx, fileToCopy, aapp.Name(), dirInApex, app, aapp)
1950 af.jacocoReportClassesFile = aapp.JacocoReportClassesFile()
Colin Cross503c1d02020-01-28 14:00:53 -08001951 af.certificate = aapp.Certificate()
Jiyong Parkaf8998c2020-02-28 16:51:07 +09001952
1953 if app, ok := aapp.(interface {
1954 OverriddenManifestPackageName() string
1955 }); ok {
1956 af.overriddenPackageName = app.OverriddenManifestPackageName()
1957 }
Jiyong Park618922e2020-01-08 13:35:43 +09001958 return af
Dario Frenicde2a032019-10-27 00:29:22 +01001959}
1960
Roland Levillain935639d2019-08-13 14:55:28 +01001961// Context "decorator", overriding the InstallBypassMake method to always reply `true`.
1962type flattenedApexContext struct {
1963 android.ModuleContext
1964}
1965
1966func (c *flattenedApexContext) InstallBypassMake() bool {
1967 return true
1968}
1969
Jiyong Park201cedd2020-02-07 17:25:49 +09001970// Visit dependencies that contributes to the payload of this APEX
1971func (a *apexBundle) walkPayloadDeps(ctx android.ModuleContext,
1972 do func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool)) {
Jiyong Parkfa899442020-01-31 02:49:53 +09001973 ctx.WalkDepsBlueprint(func(child, parent blueprint.Module) bool {
1974 am, ok := child.(android.ApexModule)
1975 if !ok || !am.CanHaveApexVariants() {
1976 return false
1977 }
1978
1979 // Check for the direct dependencies that contribute to the payload
1980 if dt, ok := ctx.OtherModuleDependencyTag(child).(dependencyTag); ok {
1981 if dt.payload {
Jiyong Park201cedd2020-02-07 17:25:49 +09001982 do(ctx, parent, am, false /* externalDep */)
Jiyong Parkfa899442020-01-31 02:49:53 +09001983 return true
1984 }
1985 return false
1986 }
1987
1988 // Check for the indirect dependencies if it is considered as part of the APEX
Jooyung Hanb8fa86a2020-03-10 06:23:13 +09001989 if am.ApexName() != "" {
Jiyong Park201cedd2020-02-07 17:25:49 +09001990 do(ctx, parent, am, false /* externalDep */)
Jiyong Parkfa899442020-01-31 02:49:53 +09001991 return true
1992 }
1993
Jiyong Park201cedd2020-02-07 17:25:49 +09001994 do(ctx, parent, am, true /* externalDep */)
1995
Jiyong Parkfa899442020-01-31 02:49:53 +09001996 // As soon as the dependency graph crosses the APEX boundary, don't go further.
1997 return false
1998 })
1999}
2000
Jooyung Han0c4e0162020-02-26 22:45:42 +09002001func (a *apexBundle) minSdkVersion(ctx android.BaseModuleContext) int {
2002 ver := proptools.StringDefault(a.properties.Min_sdk_version, "current")
Jooyung Han29e91d22020-04-02 01:41:41 +09002003 intVer, err := android.ApiStrToNum(ctx, ver)
2004 if err != nil {
2005 ctx.PropertyErrorf("min_sdk_version", "%s", err.Error())
Jooyung Han0c4e0162020-02-26 22:45:42 +09002006 }
Jooyung Han29e91d22020-04-02 01:41:41 +09002007 return intVer
Jooyung Han0c4e0162020-02-26 22:45:42 +09002008}
2009
Jiyong Park201cedd2020-02-07 17:25:49 +09002010// Ensures that the dependencies are marked as available for this APEX
2011func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
2012 // Let's be practical. Availability for test, host, and the VNDK apex isn't important
2013 if ctx.Host() || a.testApex || a.vndkApex {
2014 return
2015 }
2016
2017 a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) {
2018 apexName := ctx.ModuleName()
Jooyung Hanb8fa86a2020-03-10 06:23:13 +09002019 fromName := ctx.OtherModuleName(from)
2020 toName := ctx.OtherModuleName(to)
2021 if externalDep || to.AvailableFor(apexName) || whitelistedApexAvailable(apexName, toName) {
Jiyong Park201cedd2020-02-07 17:25:49 +09002022 return
2023 }
Jooyung Hanb8fa86a2020-03-10 06:23:13 +09002024 ctx.ModuleErrorf("%q requires %q that is not available for the APEX.", fromName, toName)
Jiyong Park201cedd2020-02-07 17:25:49 +09002025 })
2026}
2027
Jiyong Park678c8812020-02-07 17:25:49 +09002028// Collects the list of module names that directly or indirectly contributes to the payload of this APEX
2029func (a *apexBundle) collectDepsInfo(ctx android.ModuleContext) {
2030 a.depInfos = make(map[string]depInfo)
2031 a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) {
2032 if from.Name() == to.Name() {
2033 // This can happen for cc.reuseObjTag. We are not interested in tracking this.
2034 return
2035 }
2036
2037 if info, exists := a.depInfos[to.Name()]; exists {
2038 if !android.InList(from.Name(), info.from) {
2039 info.from = append(info.from, from.Name())
2040 }
2041 info.isExternal = info.isExternal && externalDep
2042 a.depInfos[to.Name()] = info
2043 } else {
2044 a.depInfos[to.Name()] = depInfo{
2045 to: to.Name(),
2046 from: []string{from.Name()},
2047 isExternal: externalDep,
2048 }
2049 }
2050 })
2051}
2052
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002053func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
Sundong Ahnabb64432019-10-22 13:58:29 +09002054 buildFlattenedAsDefault := ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild()
2055 switch a.properties.ApexType {
2056 case imageApex:
2057 if buildFlattenedAsDefault {
2058 a.suffix = imageApexSuffix
2059 } else {
2060 a.suffix = ""
2061 a.primaryApexType = true
Jooyung Han3ab2c3e2019-12-05 16:27:44 +09002062
2063 if ctx.Config().InstallExtraFlattenedApexes() {
Jiyong Park956305c2020-01-09 12:32:06 +09002064 a.requiredDeps = append(a.requiredDeps, a.Name()+flattenedSuffix)
Jooyung Han3ab2c3e2019-12-05 16:27:44 +09002065 }
Sundong Ahnabb64432019-10-22 13:58:29 +09002066 }
2067 case zipApex:
2068 if proptools.String(a.properties.Payload_type) == "zip" {
2069 a.suffix = ""
2070 a.primaryApexType = true
2071 } else {
2072 a.suffix = zipApexSuffix
2073 }
2074 case flattenedApex:
2075 if buildFlattenedAsDefault {
2076 a.suffix = ""
2077 a.primaryApexType = true
2078 } else {
2079 a.suffix = flattenedSuffix
2080 }
Alex Light5098a612018-11-29 17:12:15 -08002081 }
2082
Roland Levillain630846d2019-06-26 12:48:34 +01002083 if len(a.properties.Tests) > 0 && !a.testApex {
2084 ctx.PropertyErrorf("tests", "property not allowed in apex module type")
2085 return
2086 }
2087
Jiyong Parkfa899442020-01-31 02:49:53 +09002088 a.checkApexAvailability(ctx)
2089
Jiyong Park678c8812020-02-07 17:25:49 +09002090 a.collectDepsInfo(ctx)
2091
Alex Lightfc0bd7c2019-01-29 18:31:59 -08002092 handleSpecialLibs := !android.Bool(a.properties.Ignore_system_library_special_case)
2093
Jooyung Hane1633032019-08-01 17:41:43 +09002094 // native lib dependencies
2095 var provideNativeLibs []string
2096 var requireNativeLibs []string
2097
Jooyung Han5c998b92019-06-27 11:30:33 +09002098 // Check if "uses" requirements are met with dependent apexBundles
2099 var providedNativeSharedLibs []string
2100 useVendor := proptools.Bool(a.properties.Use_vendor)
2101 ctx.VisitDirectDepsBlueprint(func(m blueprint.Module) {
2102 if ctx.OtherModuleDependencyTag(m) != usesTag {
2103 return
2104 }
2105 otherName := ctx.OtherModuleName(m)
2106 other, ok := m.(*apexBundle)
2107 if !ok {
2108 ctx.PropertyErrorf("uses", "%q is not a provider", otherName)
2109 return
2110 }
2111 if proptools.Bool(other.properties.Use_vendor) != useVendor {
2112 ctx.PropertyErrorf("use_vendor", "%q has different value of use_vendor", otherName)
2113 return
2114 }
2115 if !proptools.Bool(other.properties.Provide_cpp_shared_libs) {
2116 ctx.PropertyErrorf("uses", "%q does not provide native_shared_libs", otherName)
2117 return
2118 }
2119 providedNativeSharedLibs = append(providedNativeSharedLibs, other.properties.Native_shared_libs...)
2120 })
2121
Jiyong Parkf653b052019-11-18 15:39:01 +09002122 var filesInfo []apexFile
Jiyong Park678c8812020-02-07 17:25:49 +09002123 // TODO(jiyong) do this using walkPayloadDeps
Alex Light778127a2019-02-27 14:19:50 -08002124 ctx.WalkDepsBlueprint(func(child, parent blueprint.Module) bool {
Roland Levillainf89cd092019-07-29 16:22:59 +01002125 depTag := ctx.OtherModuleDependencyTag(child)
2126 depName := ctx.OtherModuleName(child)
Jiyong Parkf653b052019-11-18 15:39:01 +09002127 if _, isDirectDep := parent.(*apexBundle); isDirectDep {
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002128 switch depTag {
2129 case sharedLibTag:
Jooyung Hanfaa2d5f2020-02-06 17:42:40 +09002130 if c, ok := child.(*cc.Module); ok {
2131 // bootstrap bionic libs are treated as provided by system
2132 if c.HasStubsVariants() && !cc.InstallToBootstrap(c.BaseModuleName(), ctx.Config()) {
2133 provideNativeLibs = append(provideNativeLibs, c.OutputFile().Path().Base())
Jooyung Hane1633032019-08-01 17:41:43 +09002134 }
Jooyung Hanfaa2d5f2020-02-06 17:42:40 +09002135 filesInfo = append(filesInfo, apexFileForNativeLibrary(ctx, c, handleSpecialLibs))
Jiyong Parkf653b052019-11-18 15:39:01 +09002136 return true // track transitive dependencies
Jiyong Parkff1458f2018-10-12 21:49:38 +09002137 } else {
2138 ctx.PropertyErrorf("native_shared_libs", "%q is not a cc_library or cc_library_shared module", depName)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002139 }
2140 case executableTag:
2141 if cc, ok := child.(*cc.Module); ok {
Jiyong Park1833cef2019-12-13 13:28:36 +09002142 filesInfo = append(filesInfo, apexFileForExecutable(ctx, cc))
Jiyong Parkf653b052019-11-18 15:39:01 +09002143 return true // track transitive dependencies
Jiyong Park04480cf2019-02-06 00:16:29 +09002144 } else if sh, ok := child.(*android.ShBinary); ok {
Jiyong Park1833cef2019-12-13 13:28:36 +09002145 filesInfo = append(filesInfo, apexFileForShBinary(ctx, sh))
Alex Light778127a2019-02-27 14:19:50 -08002146 } else if py, ok := child.(*python.Module); ok && py.HostToolPath().Valid() {
Jiyong Park1833cef2019-12-13 13:28:36 +09002147 filesInfo = append(filesInfo, apexFileForPyBinary(ctx, py))
Alex Light778127a2019-02-27 14:19:50 -08002148 } else if gb, ok := child.(bootstrap.GoBinaryTool); ok && a.Host() {
Jiyong Parkf653b052019-11-18 15:39:01 +09002149 filesInfo = append(filesInfo, apexFileForGoBinary(ctx, depName, gb))
Jiyong Parkff1458f2018-10-12 21:49:38 +09002150 } else {
Alex Light778127a2019-02-27 14:19:50 -08002151 ctx.PropertyErrorf("binaries", "%q is neither cc_binary, (embedded) py_binary, (host) blueprint_go_binary, (host) bootstrap_go_binary, nor sh_binary", depName)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002152 }
2153 case javaLibTag:
Jiyong Park9e6c2422019-08-09 20:39:45 +09002154 if javaLib, ok := child.(*java.Library); ok {
Jiyong Park1833cef2019-12-13 13:28:36 +09002155 af := apexFileForJavaLibrary(ctx, javaLib)
Jiyong Parkf653b052019-11-18 15:39:01 +09002156 if !af.Ok() {
Jiyong Park8fd61922018-11-08 02:50:25 +09002157 ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
2158 } else {
Jiyong Parkf653b052019-11-18 15:39:01 +09002159 filesInfo = append(filesInfo, af)
2160 return true // track transitive dependencies
Jiyong Park9e6c2422019-08-09 20:39:45 +09002161 }
Jooyung Han58f26ab2019-12-18 15:34:32 +09002162 } else if sdkLib, ok := child.(*java.SdkLibrary); ok {
2163 af := apexFileForJavaLibrary(ctx, sdkLib)
2164 if !af.Ok() {
2165 ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
2166 return false
2167 }
2168 filesInfo = append(filesInfo, af)
Jooyung Han58f26ab2019-12-18 15:34:32 +09002169 return true // track transitive dependencies
Jiyong Parkff1458f2018-10-12 21:49:38 +09002170 } else {
Jiyong Park9e6c2422019-08-09 20:39:45 +09002171 ctx.PropertyErrorf("java_libs", "%q of type %q is not supported", depName, ctx.OtherModuleType(child))
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002172 }
Jiyong Parkf653b052019-11-18 15:39:01 +09002173 case androidAppTag:
2174 pkgName := ctx.DeviceConfig().OverridePackageNameFor(depName)
2175 if ap, ok := child.(*java.AndroidApp); ok {
Jiyong Park1833cef2019-12-13 13:28:36 +09002176 filesInfo = append(filesInfo, apexFileForAndroidApp(ctx, ap, pkgName))
Jiyong Parkf653b052019-11-18 15:39:01 +09002177 return true // track transitive dependencies
2178 } else if ap, ok := child.(*java.AndroidAppImport); ok {
Jiyong Park1833cef2019-12-13 13:28:36 +09002179 filesInfo = append(filesInfo, apexFileForAndroidApp(ctx, ap, pkgName))
Dario Freni6f3937c2019-12-20 22:58:03 +00002180 } else if ap, ok := child.(*java.AndroidTestHelperApp); ok {
2181 filesInfo = append(filesInfo, apexFileForAndroidApp(ctx, ap, pkgName))
Jiyong Parkf653b052019-11-18 15:39:01 +09002182 } else {
2183 ctx.PropertyErrorf("apps", "%q is not an android_app module", depName)
2184 }
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002185 case prebuiltTag:
Jooyung Han39edb6c2019-11-06 16:53:07 +09002186 if prebuilt, ok := child.(android.PrebuiltEtcModule); ok {
Jiyong Park1833cef2019-12-13 13:28:36 +09002187 filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
atrost6e126252020-01-27 17:01:16 +00002188 } else if prebuilt, ok := child.(java.PlatformCompatConfigIntf); ok {
2189 filesInfo = append(filesInfo, apexFileForCompatConfig(ctx, prebuilt, depName))
Jiyong Parkff1458f2018-10-12 21:49:38 +09002190 } else {
atrost6e126252020-01-27 17:01:16 +00002191 ctx.PropertyErrorf("prebuilts", "%q is not a prebuilt_etc and not a platform_compat_config module", depName)
Jiyong Parkff1458f2018-10-12 21:49:38 +09002192 }
Roland Levillain630846d2019-06-26 12:48:34 +01002193 case testTag:
Roland Levillainf89cd092019-07-29 16:22:59 +01002194 if ccTest, ok := child.(*cc.Module); ok {
2195 if ccTest.IsTestPerSrcAllTestsVariation() {
2196 // Multiple-output test module (where `test_per_src: true`).
2197 //
2198 // `ccTest` is the "" ("all tests") variation of a `test_per_src` module.
2199 // We do not add this variation to `filesInfo`, as it has no output;
2200 // however, we do add the other variations of this module as indirect
2201 // dependencies (see below).
2202 return true
Roland Levillain9b5fde92019-06-28 15:41:19 +01002203 } else {
Roland Levillainf89cd092019-07-29 16:22:59 +01002204 // Single-output test module (where `test_per_src: false`).
Jiyong Park1833cef2019-12-13 13:28:36 +09002205 af := apexFileForExecutable(ctx, ccTest)
Jiyong Parkf653b052019-11-18 15:39:01 +09002206 af.class = nativeTest
2207 filesInfo = append(filesInfo, af)
Roland Levillain9b5fde92019-06-28 15:41:19 +01002208 }
Roland Levillain630846d2019-06-26 12:48:34 +01002209 } else {
2210 ctx.PropertyErrorf("tests", "%q is not a cc module", depName)
2211 }
Jiyong Parkff1458f2018-10-12 21:49:38 +09002212 case keyTag:
2213 if key, ok := child.(*apexKey); ok {
Jiyong Park0ca3ce82019-02-18 15:25:04 +09002214 a.private_key_file = key.private_key_file
2215 a.public_key_file = key.public_key_file
Jiyong Parkff1458f2018-10-12 21:49:38 +09002216 } else {
2217 ctx.PropertyErrorf("key", "%q is not an apex_key module", depName)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002218 }
Jiyong Parkf653b052019-11-18 15:39:01 +09002219 return false
Jiyong Parkc00cbd92018-10-30 21:20:05 +09002220 case certificateTag:
2221 if dep, ok := child.(*java.AndroidAppCertificate); ok {
Jiyong Park0ca3ce82019-02-18 15:25:04 +09002222 a.container_certificate_file = dep.Certificate.Pem
2223 a.container_private_key_file = dep.Certificate.Key
Jiyong Parkc00cbd92018-10-30 21:20:05 +09002224 } else {
2225 ctx.ModuleErrorf("certificate dependency %q must be an android_app_certificate module", depName)
2226 }
Jiyong Park03b68dd2019-07-26 23:20:40 +09002227 case android.PrebuiltDepTag:
2228 // If the prebuilt is force disabled, remember to delete the prebuilt file
2229 // that might have been installed in the previous builds
2230 if prebuilt, ok := child.(*Prebuilt); ok && prebuilt.isForceDisabled() {
2231 a.prebuiltFileToDelete = prebuilt.InstallFilename()
2232 }
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002233 }
Jooyung Han8aee2042019-10-29 05:08:31 +09002234 } else if !a.vndkApex {
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002235 // indirect dependencies
Jooyung Han9c80bae2019-08-20 17:30:57 +09002236 if am, ok := child.(android.ApexModule); ok {
Roland Levillainf89cd092019-07-29 16:22:59 +01002237 // We cannot use a switch statement on `depTag` here as the checked
2238 // tags used below are private (e.g. `cc.sharedDepTag`).
Jiyong Park52cd06f2019-11-11 10:14:32 +09002239 if cc.IsSharedDepTag(depTag) || cc.IsRuntimeDepTag(depTag) {
Roland Levillainf89cd092019-07-29 16:22:59 +01002240 if cc, ok := child.(*cc.Module); ok {
2241 if android.InList(cc.Name(), providedNativeSharedLibs) {
2242 // If we're using a shared library which is provided from other APEX,
2243 // don't include it in this APEX
2244 return false
Jiyong Parkac2bacd2019-02-20 21:49:26 +09002245 }
Jooyung Han671f1ce2019-12-17 12:47:13 +09002246 if !a.Host() && !android.DirectlyInApex(ctx.ModuleName(), ctx.OtherModuleName(cc)) && (cc.IsStubs() || cc.HasStubsVariants()) {
Roland Levillainf89cd092019-07-29 16:22:59 +01002247 // If the dependency is a stubs lib, don't include it in this APEX,
2248 // but make sure that the lib is installed on the device.
2249 // In case no APEX is having the lib, the lib is installed to the system
2250 // partition.
2251 //
2252 // Always include if we are a host-apex however since those won't have any
2253 // system libraries.
Jiyong Park956305c2020-01-09 12:32:06 +09002254 if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.Name(), a.requiredDeps) {
2255 a.requiredDeps = append(a.requiredDeps, cc.Name())
Roland Levillainf89cd092019-07-29 16:22:59 +01002256 }
Jooyung Hane1633032019-08-01 17:41:43 +09002257 requireNativeLibs = append(requireNativeLibs, cc.OutputFile().Path().Base())
Roland Levillainf89cd092019-07-29 16:22:59 +01002258 // Don't track further
2259 return false
2260 }
Jiyong Park1833cef2019-12-13 13:28:36 +09002261 af := apexFileForNativeLibrary(ctx, cc, handleSpecialLibs)
Jiyong Parkf653b052019-11-18 15:39:01 +09002262 af.transitiveDep = true
2263 filesInfo = append(filesInfo, af)
2264 return true // track transitive dependencies
Jiyong Park25fc6a92018-11-18 18:02:45 +09002265 }
Roland Levillainf89cd092019-07-29 16:22:59 +01002266 } else if cc.IsTestPerSrcDepTag(depTag) {
2267 if cc, ok := child.(*cc.Module); ok {
Jiyong Park1833cef2019-12-13 13:28:36 +09002268 af := apexFileForExecutable(ctx, cc)
Roland Levillainf89cd092019-07-29 16:22:59 +01002269 // Handle modules created as `test_per_src` variations of a single test module:
2270 // use the name of the generated test binary (`fileToCopy`) instead of the name
2271 // of the original test module (`depName`, shared by all `test_per_src`
2272 // variations of that module).
Jiyong Parkf653b052019-11-18 15:39:01 +09002273 af.moduleName = filepath.Base(af.builtFile.String())
Jiyong Park7cd10e32020-01-14 09:22:18 +09002274 // these are not considered transitive dep
2275 af.transitiveDep = false
Jiyong Parkf653b052019-11-18 15:39:01 +09002276 filesInfo = append(filesInfo, af)
2277 return true // track transitive dependencies
Roland Levillainf89cd092019-07-29 16:22:59 +01002278 }
Jiyong Park52cd06f2019-11-11 10:14:32 +09002279 } else if java.IsJniDepTag(depTag) {
Jooyung Han65041792020-02-25 16:59:29 +09002280 // Because APK-in-APEX embeds jni_libs transitively, we don't need to track transitive deps
2281 return false
Jiyong Parke3833882020-02-17 17:28:10 +09002282 } else if java.IsXmlPermissionsFileDepTag(depTag) {
2283 if prebuilt, ok := child.(android.PrebuiltEtcModule); ok {
2284 filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
2285 }
Jooyung Han9c80bae2019-08-20 17:30:57 +09002286 } else if am.CanHaveApexVariants() && am.IsInstallableToApex() {
Roland Levillainf89cd092019-07-29 16:22:59 +01002287 ctx.ModuleErrorf("unexpected tag %q for indirect dependency %q", depTag, depName)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002288 }
2289 }
2290 }
2291 return false
2292 })
2293
Ulyana Trafimovichde534412019-11-08 10:51:01 +00002294 // Specific to the ART apex: dexpreopt artifacts for libcore Java libraries.
2295 // Build rules are generated by the dexpreopt singleton, and here we access build artifacts
2296 // via the global boot image config.
2297 if a.artApex {
2298 for arch, files := range java.DexpreoptedArtApexJars(ctx) {
2299 dirInApex := filepath.Join("javalib", arch.String())
2300 for _, f := range files {
2301 localModule := "javalib_" + arch.String() + "_" + filepath.Base(f.String())
Jiyong Park1833cef2019-12-13 13:28:36 +09002302 af := newApexFile(ctx, f, localModule, dirInApex, etc, nil)
Jiyong Parkf653b052019-11-18 15:39:01 +09002303 filesInfo = append(filesInfo, af)
Ulyana Trafimovichde534412019-11-08 10:51:01 +00002304 }
2305 }
2306 }
2307
Jiyong Park0ca3ce82019-02-18 15:25:04 +09002308 if a.private_key_file == nil {
Jiyong Parkfa0a3732018-11-09 05:52:26 +09002309 ctx.PropertyErrorf("key", "private_key for %q could not be found", String(a.properties.Key))
2310 return
2311 }
2312
Jiyong Park8fd61922018-11-08 02:50:25 +09002313 // remove duplicates in filesInfo
2314 removeDup := func(filesInfo []apexFile) []apexFile {
Jiyong Park7cd10e32020-01-14 09:22:18 +09002315 encountered := make(map[string]apexFile)
Jiyong Park8fd61922018-11-08 02:50:25 +09002316 for _, f := range filesInfo {
Jooyung Han344d5432019-08-23 11:17:39 +09002317 dest := filepath.Join(f.installDir, f.builtFile.Base())
Jiyong Park7cd10e32020-01-14 09:22:18 +09002318 if e, ok := encountered[dest]; !ok {
2319 encountered[dest] = f
2320 } else {
2321 // If a module is directly included and also transitively depended on
2322 // consider it as directly included.
2323 e.transitiveDep = e.transitiveDep && f.transitiveDep
2324 encountered[dest] = e
Jiyong Park8fd61922018-11-08 02:50:25 +09002325 }
2326 }
Jiyong Park7cd10e32020-01-14 09:22:18 +09002327 var result []apexFile
2328 for _, v := range encountered {
2329 result = append(result, v)
2330 }
Jiyong Park8fd61922018-11-08 02:50:25 +09002331 return result
2332 }
2333 filesInfo = removeDup(filesInfo)
2334
2335 // to have consistent build rules
2336 sort.Slice(filesInfo, func(i, j int) bool {
2337 return filesInfo[i].builtFile.String() < filesInfo[j].builtFile.String()
2338 })
2339
Jiyong Park8fd61922018-11-08 02:50:25 +09002340 a.installDir = android.PathForModuleInstall(ctx, "apex")
2341 a.filesInfo = filesInfo
Alex Light5098a612018-11-29 17:12:15 -08002342
Jooyung Han54aca7b2019-11-20 02:26:02 +09002343 if a.properties.ApexType != zipApex {
2344 if a.properties.File_contexts == nil {
2345 a.fileContexts = android.PathForSource(ctx, "system/sepolicy/apex", ctx.ModuleName()+"-file_contexts")
2346 } else {
2347 a.fileContexts = android.PathForModuleSrc(ctx, *a.properties.File_contexts)
2348 if a.Platform() {
2349 if matched, err := path.Match("system/sepolicy/**/*", a.fileContexts.String()); err != nil || !matched {
2350 ctx.PropertyErrorf("file_contexts", "should be under system/sepolicy, but %q", a.fileContexts)
2351 }
2352 }
2353 }
2354 if !android.ExistentPathForSource(ctx, a.fileContexts.String()).Valid() {
2355 ctx.PropertyErrorf("file_contexts", "cannot find file_contexts file: %q", a.fileContexts)
2356 return
2357 }
2358 }
Jiyong Park7cd10e32020-01-14 09:22:18 +09002359 // Optimization. If we are building bundled APEX, for the files that are gathered due to the
2360 // transitive dependencies, don't place them inside the APEX, but place a symlink pointing
2361 // the same library in the system partition, thus effectively sharing the same libraries
2362 // across the APEX boundary. For unbundled APEX, all the gathered files are actually placed
2363 // in the APEX.
2364 a.linkToSystemLib = !ctx.Config().UnbundledBuild() &&
2365 a.installable() &&
2366 !proptools.Bool(a.properties.Use_vendor)
Jooyung Han54aca7b2019-11-20 02:26:02 +09002367
Jiyong Park9d677202020-02-19 16:29:35 +09002368 // We don't need the optimization for updatable APEXes, as it might give false signal
2369 // to the system health when the APEXes are still bundled (b/149805758)
2370 if proptools.Bool(a.properties.Updatable) && a.properties.ApexType == imageApex {
2371 a.linkToSystemLib = false
2372 }
2373
Jiyong Park9b964182020-02-26 18:27:19 +09002374 // We also don't want the optimization for host APEXes, because it doesn't make sense.
2375 if ctx.Host() {
2376 a.linkToSystemLib = false
2377 }
2378
Jooyung Hand15aa1f2019-09-27 00:38:03 +09002379 // prepare apex_manifest.json
Jooyung Han01a3ee22019-11-02 02:52:25 +09002380 a.buildManifest(ctx, provideNativeLibs, requireNativeLibs)
2381
2382 a.setCertificateAndPrivateKey(ctx)
2383 if a.properties.ApexType == flattenedApex {
2384 a.buildFlattenedApex(ctx)
2385 } else {
2386 a.buildUnflattenedApex(ctx)
2387 }
2388
Jooyung Han002ab682020-01-08 01:57:58 +09002389 a.compatSymlinks = makeCompatSymlinks(a.BaseModuleName(), ctx)
Jiyong Park956305c2020-01-09 12:32:06 +09002390
2391 a.buildApexDependencyInfo(ctx)
Jooyung Han01a3ee22019-11-02 02:52:25 +09002392}
2393
Jooyung Hanb8fa86a2020-03-10 06:23:13 +09002394func whitelistedApexAvailable(apex, moduleName string) bool {
Anton Hansson5053c292020-01-10 15:12:39 +00002395 key := apex
2396 key = strings.Replace(key, "test_", "", 1)
2397 key = strings.Replace(key, "com.android.art.debug", "com.android.art", 1)
2398 key = strings.Replace(key, "com.android.art.release", "com.android.art", 1)
2399
Jiyong Parkfa899442020-01-31 02:49:53 +09002400 // Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build
2401 // system. Trim the prefix for the check since they are confusing
2402 moduleName = strings.TrimPrefix(moduleName, "prebuilt_")
2403 if strings.HasPrefix(moduleName, "libclang_rt.") {
2404 // This module has many arch variants that depend on the product being built.
2405 // We don't want to list them all
2406 moduleName = "libclang_rt"
Anton Hansson5053c292020-01-10 15:12:39 +00002407 }
2408
2409 if val, ok := apexAvailWl[key]; ok && android.InList(moduleName, val) {
2410 return true
2411 }
2412
Jiyong Parkfa899442020-01-31 02:49:53 +09002413 key = "//any"
2414 if val, ok := apexAvailWl[key]; ok && android.InList(moduleName, val) {
2415 return true
2416 }
2417
Anton Hansson5053c292020-01-10 15:12:39 +00002418 return false
2419}
2420
Jooyung Han344d5432019-08-23 11:17:39 +09002421func newApexBundle() *apexBundle {
Sundong Ahnabb64432019-10-22 13:58:29 +09002422 module := &apexBundle{}
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002423 module.AddProperties(&module.properties)
Alex Light9670d332019-01-29 18:07:33 -08002424 module.AddProperties(&module.targetProperties)
Jiyong Park5d790c32019-11-15 18:40:32 +09002425 module.AddProperties(&module.overridableProperties)
Alex Light5098a612018-11-29 17:12:15 -08002426 module.Prefer32(func(ctx android.BaseModuleContext, base *android.ModuleBase, class android.OsClass) bool {
Jiyong Park397e55e2018-10-24 21:09:55 +09002427 return class == android.Device && ctx.Config().DevicePrefer32BitExecutables()
2428 })
Alex Light5098a612018-11-29 17:12:15 -08002429 android.InitAndroidMultiTargetsArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002430 android.InitDefaultableModule(module)
Jiyong Parkd1063c12019-07-17 20:08:41 +09002431 android.InitSdkAwareModule(module)
Jaewoong Jung7abcf8e2019-12-19 17:32:06 -08002432 android.InitOverridableModule(module, &module.overridableProperties.Overrides)
Jiyong Park48ca7dc2018-10-10 14:01:00 +09002433 return module
2434}
Jiyong Park30ca9372019-02-07 16:27:23 +09002435
Ulyana Trafimovichde534412019-11-08 10:51:01 +00002436func ApexBundleFactory(testApex bool, artApex bool) android.Module {
Jooyung Han344d5432019-08-23 11:17:39 +09002437 bundle := newApexBundle()
2438 bundle.testApex = testApex
Ulyana Trafimovichde534412019-11-08 10:51:01 +00002439 bundle.artApex = artApex
Jooyung Han344d5432019-08-23 11:17:39 +09002440 return bundle
2441}
2442
Jiyong Parkfce0b422020-02-11 03:56:06 +09002443// apex_test is an APEX for testing. The difference from the ordinary apex module type is that
2444// certain compatibility checks such as apex_available are not done for apex_test.
Jooyung Han344d5432019-08-23 11:17:39 +09002445func testApexBundleFactory() android.Module {
2446 bundle := newApexBundle()
2447 bundle.testApex = true
2448 return bundle
2449}
2450
Jiyong Parkfce0b422020-02-11 03:56:06 +09002451// apex packages other modules into an APEX file which is a packaging format for system-level
2452// components like binaries, shared libraries, etc.
Jiyong Parkd1063c12019-07-17 20:08:41 +09002453func BundleFactory() android.Module {
Jooyung Han344d5432019-08-23 11:17:39 +09002454 return newApexBundle()
2455}
2456
Jiyong Park30ca9372019-02-07 16:27:23 +09002457//
2458// Defaults
2459//
2460type Defaults struct {
2461 android.ModuleBase
2462 android.DefaultsModuleBase
2463}
2464
Jiyong Park30ca9372019-02-07 16:27:23 +09002465func defaultsFactory() android.Module {
2466 return DefaultsFactory()
2467}
2468
2469func DefaultsFactory(props ...interface{}) android.Module {
2470 module := &Defaults{}
2471
2472 module.AddProperties(props...)
2473 module.AddProperties(
2474 &apexBundleProperties{},
2475 &apexTargetBundleProperties{},
Jooyung Hanf21c7972019-12-16 22:32:06 +09002476 &overridableProperties{},
Jiyong Park30ca9372019-02-07 16:27:23 +09002477 )
2478
2479 android.InitDefaultsModule(module)
2480 return module
2481}
Jiyong Park5d790c32019-11-15 18:40:32 +09002482
2483//
2484// OverrideApex
2485//
2486type OverrideApex struct {
2487 android.ModuleBase
2488 android.OverrideModuleBase
2489}
2490
2491func (o *OverrideApex) GenerateAndroidBuildActions(ctx android.ModuleContext) {
2492 // All the overrides happen in the base module.
2493}
2494
2495// override_apex is used to create an apex module based on another apex module
2496// by overriding some of its properties.
2497func overrideApexFactory() android.Module {
2498 m := &OverrideApex{}
2499 m.AddProperties(&overridableProperties{})
2500
2501 android.InitAndroidMultiTargetsArchModule(m, android.DeviceSupported, android.MultilibCommon)
2502 android.InitOverrideModule(m)
2503 return m
2504}