Commit Graph

523 Commits

Author SHA1 Message Date
Dario Freni da1aefe44e Pass apex_build_info to bundle base.zip file
Fix: 150077028
Test: manual inspection of com.android.wifi-base.zip
Merged-In: Id201a3410a46e0c88a77e6f88e5b85906c7a6c8b
Change-Id: Id201a3410a46e0c88a77e6f88e5b85906c7a6c8b
(cherry picked from commit 18423788cb)
2020-03-14 06:58:46 +00:00
Treehugger Robot 845f655011 Merge "Add __ANDROID_SDK_VERSION__=<ver> macro" 2020-03-13 09:45:10 +00:00
Jiyong Park 1731f6ae3f Remove libselinux from the apex_available whitelist
libselinux no longer is included in any APEX. Only the platform variant
of it (/system/lib/libselinux.so) exists and APEXes link to it.

Removing the lib name from the whitelist to make it clear that the
library is not available to any APEX.

Bug: 151053366
Bug: 150999716
Test: m
Change-Id: Id4fb933141ad32ff5217a58f1c7d689cc657e9ea
2020-03-12 14:16:07 +09:00
Paul Duffin 7d74e7bea3 Copy white listed apex available settings into snapshot
Makes sure that the module snapshots do not rely on the white list
of apex available settings so that when those lists are removed it is
not necessary to update any snapshots.

Bug: 142935992
Test: m nothing
Change-Id: Iedcff7dfc2646a4da77258d16e06657dd2f411f9
2020-03-11 18:31:45 +00:00
Treehugger Robot f53737fadc Merge "Remove special handling of test_ apexes" 2020-03-11 17:52:56 +00:00
Nikita Ioffe 643953d170 Merge "Always use "${codename}.${sha}" if UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true" 2020-03-11 17:45:34 +00:00
Treehugger Robot de77904484 Merge "Remove special handling of com.android.art.debug/release" 2020-03-11 16:46:21 +00:00
Paul Duffin 57380a902e Remove special handling of test_ apexes
Test apexes no longer check to see whether their contents are available
so the special handling is no longer necessary.

Bug: 142935992
Test: m nothing
Change-Id: Iecae7dcbb87908d19c672f74d3c1ed8810d4485b
2020-03-11 15:17:04 +00:00
Paul Duffin 50cbefd5e8 Remove special handling of com.android.art.debug/release
The whitelistedApexAvailable used to map references to
com.android.art.debug/release to com.android.art before looking it up
in the white list. This change removed that mapping and simply added
both to the white list.

Bug: 142935992
Test: m nothing
Change-Id: Ibad76fb73988688eb303e056197986ee9a6119ae
Merged-In: Ibad76fb73988688eb303e056197986ee9a6119ae
2020-03-11 15:16:47 +00:00
Jooyung Han 35155c4f96 Fix path in apex when native_bridge_supported: true
NativeBridgeRelativePath should be appended after /bin or /lib and
before subdir.

Bug: N/A
Test: m (add a soong test)
Change-Id: Id0c44c66b4900caa291e816cf3361fdec8ff9421
2020-03-11 20:07:34 +09:00
Jooyung Han 4c8e3509ee Merge "Fix apex_available" 2020-03-10 23:53:41 +00:00
Jooyung Han 5e9013be22 Fix apex_available
Checking apex_available was missing some corner cases.
For example, the deps of share deps of cc_library modules are missed
while those from cc_library_shared are correctly tracked.

This was due to..

* calling DepIsInSameApex in WalkDeps: both work fine separately, but
when they are used together, it fails to work. It's due to how WalkDeps
works. (We might fix this bug too risky since it is used very widely)
* incorrect receiver for DepIsInSameApex in apex_deps mutator: receiver
is supposed to be parent, but child was used before. Interestingly lots
of deps are within the same group of module types(cc to cc, java to
java), it has worked. (note that receiver's DepIsInSameApex
implementation can be different).

This change fixes them by..

* walkPayloadDeps is now relying on ApexVariation, which is calculated
correctly by TopDown apex_deps mutator.
* use correct receiver for DepIsInSameApex in apex_deps mutator, which
requires for java.SdkLibrary to override the method and for
java.Library/Import to use passed dep instead of receiver to check its
membership of sdk.

Bug: 151071238
Test: build/boot
Change-Id: I0569ef4bb8e79635e4d97a89f421a8d8b7d26456
2020-03-10 23:52:01 +00:00
Treehugger Robot 04c93a40f1 Merge "DO NOT MERGE: Remove AppSearch from Android R." 2020-03-10 08:19:05 +00:00
Jiyong Park 65cc4f7777 Apex_available check failure reveals dependency
When the check for apex_available has failed, the build system now shows
the module that brought the unavailable module into the APEX.

Bug: 151051671
Test: m
Merged-In: Id1a3fda67fe56fdc2dc90ec800d10689415de4d6
(cherry picked from commit 7bd9444b0f)
Change-Id: Id1a3fda67fe56fdc2dc90ec800d10689415de4d6
2020-03-09 18:56:54 +09:00
Alexander Dorokhine 466d39a18c DO NOT MERGE: Remove AppSearch from Android R.
Test: presubmit
Bug: 150249538
Merged-In: I0a87b9d893bc76acf5ac5e8684f450b9a4f2a0cd
(cherry picked from commit c9c7116721)
Change-Id: I0a87b9d893bc76acf5ac5e8684f450b9a4f2a0cd
2020-03-09 15:14:42 +09:00
Jooyung Han ccce2f2c23 Add __ANDROID_SDK_VERSION__=<ver> macro
sdk_version is passed for relevant variants.
If not specified or "current",
it maps to "10000" for platform variants, and
"min_sdk_version" of the apex for apex variants.

Bug: 150860940
Test: m (soong test)
      manually check build.ninja
Change-Id: I5102ab0c5086b5ad29d16ac45af55d32062167b4
2020-03-09 10:46:46 +09:00
Jooyung Han 03b5185b88 apex: choose stub according to min_sdk_version
Native modules within APEX should be linked with proper stub version
according to its min_sdk_version.

For example, when min_sdk_version is set to "29", libfoo in the apex
would be linked to libbar of version 29 from platform, even if it has
a newer version like 30.

Bug: 145796956
Test: m nothing (soong tests)
Change-Id: I4a0b2002587bc24b7deeb5d59b6eeba5e1db5b1f
2020-03-07 03:12:45 +09:00
Nikita Ioffe 1f4f345156 Always use "${codename}.${sha}" if UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true
Test: m checkbuild
Bug: 149733822
Change-Id: I3e1beeb721f7e87bc6adda61861fa962ec892360
Merged-In: I3e1beeb721f7e87bc6adda61861fa962ec892360
(cherry picked from commit 934c4f2acc)
2020-03-04 22:05:11 +00:00
Jiyong Park 20bacabe0b PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES is applicable to override_apex
apex { name: "foo" }
override_apex { name: "override_foo", base:"foo" }

PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES := foo:com.android.foo

Previously, the override was done only for the overridden package "foo",
but not for "override_foo". Fixing this issue by using ctx.ModuleName()
when finding the package name to use.

Exempt-From-Owner-Approval: cherry-pick from internal

Bug: 150645663
Test: m
Merged-In: I2947e5c75369216a4bbce8749503236be86771c3
(cherry picked from commit a519c54dd3)
Change-Id: I2947e5c75369216a4bbce8749503236be86771c3
2020-03-04 12:03:59 +09:00
Jooyung Han c87a059c88 Make __ANDROID_APEX_<NAME>__ macro optional
This is rarely used feature but cost alot for the local build and build
inra.

Bug: 150506627
Test: m
Change-Id: Iec3ada4a97c7b228f2818563fa0e81b407f2715a
2020-03-02 17:44:33 +09:00
Jiyong Park 323a4c3ab3 Runtime deps to a stubs lib crosses APEX boundary
When there is a runtime depedency (via runtime_libs property) to a
library providing stable C APIs, the dependency is considered as
crossing APEX boundary. Therefore, the requested lib doesn't need to be
made available to the APEX where the requesting lib is in.

Bug: 147813447
Test: m
Change-Id: I9cf8a5877850fb85b92c851e15fac921b8b7641b
2020-03-01 17:29:06 +09:00
Jiyong Park cfaa1643e8 bundle config contains (path,manifest) pairs of embedded APKs
If an APEX contains APKs and the manifest package name of the APKs are
overridden (either via override_android_app
orPRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES), that the path to the APK
(relative in the APEX) and the overridden manifest package name is
recorded in the bundle config file.

Bug: 148002117
Test: m

Change-Id: Ibb90bcefb77fa6b2dad77cb2facc6079de9ab154
2020-02-29 09:07:46 +09:00
Jiyong Park bd15961043 bundle config for apexes are auto-generated
bundle config file for apexes are auto-generated. It is included in the
<apex>-base.zip file, which is expected to be extracted and then fed
into the bundletool.

This change is in preparation for the upcoming change to include
information about embedded apks in the bundle confir file.

Bug: 148002117
Test: m

Change-Id: If25d75e0f62036dc777faf8593ed8eb9a74950b0
2020-02-29 09:07:08 +09:00
Jooyung Han c6e538406c Merge "Add "jni_libs" property to apex module" 2020-02-28 17:12:53 +00:00
Jooyung Han 6e147e4f54 Merge changes I789b526c,Ie15c811f
* changes:
  apex: refactor apex properties
  apex: fix a test util (ensureExactContent)
2020-02-28 17:08:45 +00:00
Jiyong Park 0ffa3aba78 Merge "No symlink for host APEXes" 2020-02-27 23:56:24 +00:00
Jooyung Han 643adc4896 Add "jni_libs" property to apex module
Which is the list of JNI libraries that are embeded inside the apex.
jni_libs is handled just like native_shared_libs except that it is
stored in apex_manifest.

When linkerconfig finds an apex with JNI libs, it exposes the namespace
for the apex as visible so that libnativeloader can link the namespace
to the corresponding classloader-namespace.

Bug: 149363889
Test: m nothing(runs soong test)
Change-Id: I52ebe38b44545e6e8853e34a3404a235c858112a
2020-02-27 13:50:06 +09:00
Jooyung Han 01a868d096 apex: refactor apex properties
Embed common properties (apexNativeDependencies) so that the logic for
adding dependencies for native modules can be reused.

Bug: N/A
Test: m

Change-Id: I789b526c09eea14213ab1544590ed2238ed8c625
2020-02-27 13:45:14 +09:00
Jooyung Han e6436d7bf0 apex: fix a test util (ensureExactContent)
ensureExactContent shouldn't return immediately when it finds a match
from expected list of files.

Bug: N/A
Test: m nothing
Change-Id: Ie15c811f9cfcae7ede28dee0fcf203cee24659a0
2020-02-27 13:31:56 +09:00
Jiyong Park 638d30ed21 No symlink for host APEXes
Symlinking doesn't make sense for host APEXes.

Bug: 150255435
Test: m com.android.art.host and inspect the built APEX; there is
no symlink.

Merged-In: I28492dfaaef471117a430be05255fbef76e557b0
(cherry picked from commit 9b96418dfe)
Change-Id: I28492dfaaef471117a430be05255fbef76e557b0
2020-02-27 12:09:33 +09:00
Colin Cross 1c85e8e019 Only dist apex sizes for checkbuild
Using $(call dist-for-goals,droidcore,...) for every apex
installed-files.txt causes every apex to be built for all builds,
causing a signficiant regression in build time.  For now only
dist them in checkbuilds, which were going to build all of them
anyways.

Ideally we would like to dist the installed-files.txt only if
the apex was already built, but there is not currently a way to
express that.

Test: treehugger
Bug: 149979076
Change-Id: I21edbc90980f94ad6d497cb86ee80223dd782fe1
2020-02-27 00:58:50 +00:00
Bob Badour 40017be1c3 Merge "Unless overridden include LICENSE files in notices." 2020-02-26 20:37:22 +00:00
Jooyung Han 077f9a44f9 Merge "apex: do not follow jni_libs from android_app" 2020-02-26 02:35:10 +00:00
Colin Cross 414d50c35d Merge "Add min_sdk_version property to apexes" 2020-02-25 15:34:26 +00:00
Jooyung Han b7bebe2616 apex: do not follow jni_libs from android_app
Because APK-in-APEX embeds its jni_libs in it. We don't have to follow
deps of jni_libs.

Bug: 146992436
Test: m com.android.tethering
      deapexer extract com.android.tethering.apex apex
      ls apex # there should be no /lib dir

Change-Id: Ifa1a6430a420ae7376b155cd59b8ece462cced7e
2020-02-25 20:47:04 +09:00
Colin Cross 48c2f294a6 Merge "Require apps built against the SDK to use JNI built against the NDK" 2020-02-25 00:21:07 +00:00
Nikita Ioffe 5d600c9169 For legacy10 APEXes default target_sdk_version and min_sdk_version to 29
Test: m com.android.conscrypt
Bug: 149733822
Change-Id: Ia863b5701716ef4022b470ee758368ea4fffb1d4
Merged-In: Ia863b5701716ef4022b470ee758368ea4fffb1d4
(cherry picked from commit db10c13bdf)
2020-02-22 17:33:28 +00:00
Colin Cross 50317874ff Add min_sdk_version property to apexes
Add a min_sdk_version property apexes.  Currently a noop, but will
be used to enforce that dependencies are compatible with the
specified version.

Test: m checkbuild
Bug: 149591522
Change-Id: I923773c90fe15becbffae3986791aa9edde8f8f6
2020-02-21 14:54:31 -08:00
Colin Cross 094cde4430 Require apps built against the SDK to use JNI built against the NDK
Apps that expect to run on older platforms should use JNI libraries
that will also run on older platforms.  Require that apps that set
sdk_version have jni_libs modules that also set sdk_version, or
set jni_uses_platform_apis: true to bypass the check.

Fixes: 149591057
Test: app_test.go
Change-Id: I76b9b45fb5773bc4dfc10520108f4f3578723909
2020-02-21 14:54:31 -08:00
Bob Badour a75b057e17 Unless overridden include LICENSE files in notices.
As a second step to removing the go/android3p instructions to copy or
to link NOTICE to LICENSE, include LICENSE files in the notices, which
will allow deleting all of the copied/linked NOTICE files.

The change causes a few additions to the system image notice files.

Test: manually built and compared before and after notices
Change-Id: Ia7bc58e2eba7bed5e63934881b5298201a93bc3e
2020-02-21 20:40:43 +00:00
Baligh Uddin 004d717158 Allow for setting a logging_parent for an Apex.
Test: go test ./... -test.v -run TestOverrideApex
BUG: 148198056
Change-Id: Ib3749e59f5e31903f2dbe75f86534738147a55ec
2020-02-21 16:59:26 +00:00
Colin Cross f9aabd719a Make apex use cc.GatherRequiredDepsForTests
Remove the duplicated native modules from apex_test.go.

Test: all soong tests
Change-Id: Ib88af058d23cf37446d7a4bb571edfb1e0880854
2020-02-19 19:07:11 -08:00
Jiyong Park eb9b9f23ec Merge "have a per-module switch to turn the symlinking optimizaiton off" 2020-02-20 01:47:57 +00:00
Jiyong Park 2d6d5d8995 Merge "Permissions XML file for java_sdk_library is mutated for APEX" 2020-02-19 23:57:14 +00:00
Jiyong Park 9d677206d1 have a per-module switch to turn the symlinking optimizaiton off
The optimization is confusing syshealth because the modules will use
more memory when they are switched to the prebuilt (unbundled) or
updated via Play.

Let's have a per-module switch to control the behavior and turn it on
only for non-updatable modules like ART.

Bug: 149805758
Test: m
Change-Id: Ieb842c47f31f3b06e403b1e1f9e463c3e5524107
2020-02-19 20:16:25 +09:00
Jiyong Park e383388f98 Permissions XML file for java_sdk_library is mutated for APEX
This change fixes a regression that was introduced with
I597bccbb177b6b6320c3a3edeff467243230d384. With the change, the content
of the permissions XML file for a java_sdk_library was determined before
the java_sdk_library is mutated for an APEX. As a result, the file path
to the implementation jar library was always set to
/system/framework/*.jar regardless of whether the java_sdk_library is
part of an APEX or not.

This change fixes the problem, by creating the permissions XML file via
a new module type. The content of the xml file is determined after the
xml file is mutated for APEXes.

Bug: 149600642
Test: m

Change-Id: Id21f8d8285df49b0b3be1daf0f101f2bc978eeb0
2020-02-19 09:47:37 +09:00
Peter Collingbourne dc4f986b2a Statically link the unwinder into binaries packaged into an unbundled APEX with legacy_android10_support: true.
Bug: 149075752
Test: tapas com.android.conscrypt com.android.tethering arm64
Test: m out/target/product/generic_arm64/{,symbols/}apex/com.android.{tethering,conscrypt}/lib64/libc++.so
Test: Verified that unwinder was dynamically linked to tethering's
Test: libc++ and statically linked to conscrypt's.
Test: lunch flame-userdebug && m
Test: Verified that unwinder was dynamically linked to /system/lib64/libc++.so
Change-Id: I98eed7cb4316962b19b5c12e150c224c25d0e91d
2020-02-13 22:29:44 -08:00
Jeffrey Huang 7d8ecd0bc1 Merge "Remove liblog from whitelist" 2020-02-14 00:45:22 +00:00
Treehugger Robot 680afd7bc7 Merge "apexDepsMutator is a top-down mutator" 2020-02-13 22:29:23 +00:00
Jeffrey Huang f0ae6ccaa7 Remove liblog from whitelist
Bug: 145923087
Test: m -j
Change-Id: Ib1b711c01262ce9466cdd49daa3cc7142376004c
2020-02-13 12:33:39 -08:00
Jeffrey Huang 9401b187f8 Update apex.go to remove libutils
Bug: 145922701
Test: m -j
Change-Id: I13078f43129a7a9478b9bb97bb94c2c70fdb148c
2020-02-12 17:35:59 -08:00
Jiyong Park f760cae41b apexDepsMutator is a top-down mutator
apex { name: ["myapex"], native_shared_libs: ["libX", "libY"] }
cc_library { name: "libX", shared_libs: ["libY"] }
cc_library { name: "libY", shared_libs: ["libZ"], stubs: {...} }

apexDepsMutator was a bottom up mutator and it uses WalkDeps to traverse
the dependency tree rooted at myapex in a depth-first order. While
traversing the tree, if calls BuildForApex for a module that will be
part of the APEX.

libY is visited twice. Once via libX and once via myapex. If the visit
from libX was before the visit from myapex (since this is a depth-first
traversing), BuildForApex is not called for libY and its dependency
libZ, because libY provides a stub. And then when libY is again visited
via myapex, BuildForApex is correctly called for the module, but not for
its dependencies libZ because the paths from libY to libZ was already
visited.

As a result, the apex variant of libY has a dependency to the non-apex
variant of libZ.

Fixing the problem by changing the mutator a top-down one.

Bug: 148645937
Test: m
Change-Id: Ib2cb28852087c63a568b3fd036504e9261cf0782
2020-02-12 17:01:26 +09:00
Treehugger Robot 4e29184a4e Merge "Update apex dependency even for test and non-installable APEXes" 2020-02-12 07:45:47 +00:00
Treehugger Robot 6655756230 Merge "Automatically set compile_dex:true and hostdex:true for APEX variants" 2020-02-12 05:35:25 +00:00
Jiyong Park 6b21c7d2ab Automatically set compile_dex:true and hostdex:true for APEX variants
... unless they are turned off explicitly.

Bug: 147221965
Test: m
Change-Id: I6b91d6409d9cf06ad09467c53d5d51a9c693256e
2020-02-12 10:47:36 +09:00
Jiyong Park 2bb26d3fad Merge "<apex_name>-deps-info correctly tracks dependencies" 2020-02-12 00:47:21 +00:00
Treehugger Robot 45f3c9b6a6 Merge "m <module_name> builds <module_name>.<apex_name>" 2020-02-12 00:35:55 +00:00
Jiyong Park ab872e0295 Update apex dependency even for test and non-installable APEXes
The apex dependency map wasn't updated for test or non-installable
APEXes to work around the problem that a module being in such APEX
prevented the module from being installed in the system partition.

Since that problem is not happening any more, removing the unnecessary
work-around.

Bug: 123892969
Test: m
Change-Id: I43e07a9611a3e08ff39b9a64454b1c67949d35bc
2020-02-12 07:45:16 +09:00
Steven Moreland 7072100760 Merge "rm libbinderthreadstate" 2020-02-11 18:45:39 +00:00
Jiyong Park 31af2678fe m <module_name> builds <module_name>.<apex_name>
When a module is not available for platform (i.e.
//apex_available:platform is missing in the apex_available property), m
<module_name> previously just didn't work because there is no platform
variant of the module.

This change fixes the behavior; regardless of whether the platform
variant is available or not, m <module_name> builds all the apex
variants of the module along with the platform variant if it exists.

Bug: 147728094
Test: m conscrypt
Change-Id: Iedd3fa6fc0ed779c5f7c5d65f23d86f799ac0cbe
2020-02-11 09:44:06 +09:00
Jiyong Park fce0b4209f Document apex and apex_test
Bug: 149082647
Test: m
Change-Id: I39e72eecda1d0e2984a3dde4987c4928f58d2afc
2020-02-11 03:56:06 +09:00
Jiyong Park 58b5030e30 Merge "add walkPayloadDeps" 2020-02-10 05:20:59 +00:00
Jiyong Park 22f3ce1ea7 Merge "<apexname>-installed-file.txt shows symlinks" 2020-02-10 03:44:00 +00:00
Jiyong Park bd63a108a0 <apexname>-installed-file.txt shows symlinks
Bug: 147605944
Test: m and inspect the generated txt files
Change-Id: I26ecaf66a531478d22fb4611bb4ea19e92ef132e
2020-02-08 17:18:03 +09:00
Steven Moreland 14850a5139 rm libbinderthreadstate
This library is empty, and its functionality has moved
into libbinder/libhwbinder.

Bug: 148692216
Test: N/A
Change-Id: I5874efda9ab43fc00cf90395a1aabde45cf49579
2020-02-07 16:22:28 -08:00
Treehugger Robot 9be2556d90 Merge "java_sdk_library - Allow it to be replaced by prebuilt" 2020-02-07 11:16:41 +00:00
Jiyong Park 678c881a4f <apex_name>-deps-info correctly tracks dependencies
The APEX dependency is more correctly tracked. Previously, the
dependency was tracked while we gather modules that will be installed to
an APEX. This actually was incorrect because we skipped many dependency
types that we don't need to follow to gather the modules list, such as
the headers dependency.

Now, the dependency is tracked directly when a module is mutated for an
APEX. In other words, if a module is mutated for an apex X, then the
module will appear in the X-deps-into.txt file.

This change also changes the format of the txt file. It now clearly
shows why a module is included in the APEX by showing the list of
modules that depend on the module.

Bug: 146323213
Test: m
Change-Id: I0a70cf9cce56e36565f9d55683fdaace8748a081
2020-02-07 18:53:12 +09:00
Jiyong Park 201cedd608 add walkPayloadDeps
The function visits dependencies of an APEX that contribute to the
payload. checkApexAvailability is rewritten using the generic function.
There is no change in behavior.

Bug: N/A
Test: m

Change-Id: I1a8b4eb0a60a432f667a61b4f6f457c3b8f1cd3d
2020-02-07 18:48:26 +09:00
Treehugger Robot 570147469f Merge "Do not add bootstrap libs as providing from apex" 2020-02-07 07:23:14 +00:00
Jiyong Park f48392279c Merge "Don't use apexName where apexBundleName is expected" 2020-02-07 05:41:26 +00:00
Jiyong Park a594801999 Don't use apexName where apexBundleName is expected
With I63f8a1de463011c6e0b97f5f6eee83103e22bc30, a flattened APEX is
installed to /system/apex/<apexBundleName> not /system/apex/<apexName>.
The change was to be in sync with the non-flattened APEXes that are
installed to /system/apex/<apexBundleName>.apex.

apexName is from the 'name' property while apexBundleName is from the
'apex_name' property. The two names are mostly the same, but can be
different, notably for the ART and the VNDK APEXes. e,g apexName =
com.android.art, apexBundleName = com.android.art.release.

However, there was a bug in the fix; we haven't updated the path for the
flattened APEXes in other places: filecontexts and symlinks. As a
result, the files for the APEXes where apexName is different from
apexBundleName were incorrectly labeled and caused a boot loop.

Fixing the bug.

Bug: 140136207
Bug: 149013536
Test: m
Test: OVERRIDE_TARGET_FLATTEN_APEX=true m; then inspect the built
system.img to verify that
/system/apex/com.android.vndk.current/lib/libcrypto.so is correctly
labeled as system_lib_file.

Exempt-From-Owner-Approval: cherry-pick from internal

Merged-In: I4aaf674a5daeabab5ed6e7025c5389821ee9a013
(cherry picked from commit be95e6b245)
Change-Id: I4aaf674a5daeabab5ed6e7025c5389821ee9a013
2020-02-07 13:20:13 +09:00
Paul Duffin e74ac73bc9 java_sdk_library - Allow it to be replaced by prebuilt
Previously, a java_sdk_library called "SDKLIB" would create a
prebuilt_etc module called "SDKLIB.xml" which installs the generated
XML permission file to /etc/permissions/SDKLIB.xml. That module
depended on the java_sdk_library "SDKLIB" to generate the XML file
as one of its outputs by specifying srcs: [":SDKLIB{.xml}"].

If the java_sdk_library is replaced by a prebuilt then the SDKLIB.xml
module expects the prebuilt to provide the XML permissions file which
it doesn't because that is an implementation detail and so the build
breaks.

A couple of alternative approaches were looked at to fix this. One was
to have the logic that replaced the source module with the prebuilt to
inform the source module that it was being replaced so it could disable
its created module. That lead to a dependency cycle where
    SDKLIB -> SDKLIB.xml -> SDKLIB{.xml}

Another solution was to mark dependency tags in such a way that the
prebuilt could automatically identify and disable the SDKLIB.xml
module. Similar to how the visibility code will ignore dependencies
that are tagged with ExcludeFromVisibilityEnforcementTag. That became
very convoluted.

Instead the java_sdk_library was changed so that it was not responsible
for creating the XML permissions file. Instead it created a genrule
called "gen-SDKLIB.xml" to create it and then "SDKLIB.xml" depended on
that. The java_sdk_library also depended on the genrule to make the XML
permissions file available for APEX and testing.

Some refactoring of the APEX code and tests was necessary because they
had knowledge of the internal implementation of java_sdk_library. The
refactoring insulates them a little better from those details.

Bug: 148080325
Test: m droid && TARGET_BUILD_APPS=Camera2 m
Change-Id: I597bccbb177b6b6320c3a3edeff467243230d384
2020-02-06 15:58:05 +00:00
Jooyung Han faa2d5f0e5 Do not add bootstrap libs as providing from apex
Currently, com.android.runtime provides libc/libm/libdl to system. But
they are supposed to be used from symlinks under /system/lib not
directly from runtime apex.

This helps linkerconfig to generate ld.config.txt automatically for
apexes.

Bug: 144664390
Test: m com.android.runtime
      deapexer info com.android.runtime.apex

Change-Id: I1620e88e489fba88a06cc3bd6eb5b86a9b581e4f
2020-02-06 17:42:40 +09:00
Jiyong Park 0f80c1848a apex_available tracks static dependencies
This change fixes a bug that apex_available is not enforced for static
dependencies. For example, a module with 'apex_available:
["//apex_available:platform"]' was able to be statically linked to any
APEX. This was happening because the check was done on the modules that
are actually installed to an APEX. Static dependencies of the modules
were not counted as they are not installed to the APEX as files.

Fixing this bug by doing the check by traversing the tree in the method
checkApexAvailability.

This change includes a few number of related changes:

1) DepIsInSameApex implementation for cc.Module was changed as well.
Previuosly, it returned false only when the dependency is actually a
stub variant of a lib. Now, it returns false when the dependency has one
or more stub variants. To understand why, we need to recall that when
there is a dependency to a lib having stubs, we actually create two
dependencies: to the non-stub variant and to the stub variant during the
DepsMutator phase. And later in the build action generation phase, we
choose one of them depending on the context. Also recall that an APEX
variant is created only when DepIsInSameApex returns true. Given these,
with the previous implementatin of DepIsInSameApex, we did create apex
variants of the non-stub variant of the dependency, while not creating
the apex variant for the stub variant. This is not right; we needlessly
created the apex variant. The extra apex variant has caused no harm so
far, but since the apex_available check became more correct, it actually
breaks the build. To fix the issue, we stop creating the APEX variant
both for non-stub and stub variants.

2) platform variant is created regardless of the apex_available value.
This is required for the case when a library X that provides stub is in
an APEX A and is configured to be available only for A. In that case,
libs in other APEX can't use the stub library since the stub library is
mutated only for apex A. By creating the platform variant for the stub
library, it can be used from outside as the default dependency variation
is set to the platform variant when creating the APEX variations.

3) The ApexAvailableWhitelist is added with the dependencies that were
revealed with this change.

Exempt-From-Owner-Approval: cherry-pick from internal

Bug: 147671264
Test: m

Merged-In: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e
(cherry picked from commit fa89944c79)
Change-Id: Iaedc05494085ff4e8af227a6392bdd0c338b8e6e
2020-02-06 14:45:08 +09:00
Treehugger Robot 22b08b4af6 Merge "Use module name as the suffix for apex variant" 2020-02-06 04:22:22 +00:00
Jiyong Park db334861b2 Use module name as the suffix for apex variant
apex {
    name: "myapex",
    native_shared_libs: ["libfoo"],
    apex_name: "apex_name",
}

override_apex {
    name: "myapex.override",
    base: "myapex"
}

Previsouly, above wasn't supported because both APEXes have the same
apex_name and that apex_name is used as the suffix of libfoo. i.e.,
there are two libfoo.apex_name modules defined.

Now, the two apex variants of libfoo are named as
libfoo.myapex and libfoo.myapex.override.

Bug: 140136207
Test: m
Change-Id: I63f8a1de463011c6e0b97f5f6eee83103e22bc30
2020-02-06 10:54:30 +09:00
atrost 6e12625c0f Add support for compat config in APEX.
apex module accepts PlatformCompatConfigIntf as prebuilt,
and places it in the etc folder of the apex.

Test: m
Test: flash device with dummy config in mediaprovider APEX -
the config is present
Change-Id: Ifc62cd262f6c6571c1bf6c2943879aa20877ecad
2020-02-05 13:33:50 +00:00
Treehugger Robot 86ef38cfbf Merge "Add native_coverage to product variables" 2020-01-31 03:12:22 +00:00
Treehugger Robot f9192060bd Merge "Set LOCAL_CERTIFICATE for flattened apex APKs" 2020-01-29 17:42:51 +00:00
Ulyana Trafimovich 28e36b1455 Merge "Store uncompressed and aligned DEX files for java libs in APEXes." 2020-01-29 10:25:33 +00:00
Treehugger Robot 70b0162472 Merge "Fix rebuilding with whitelisted_files" 2020-01-29 01:54:06 +00:00
Dan Willemsen 81e43c5994 Fix rebuilding with whitelisted_files
All commands must produce their output files, or they'll trigger
rebuilds the next build.

Test: m com.android.apex.cts.shim.v3; repeat; "ninja: nothing to do"
Change-Id: If30e9d90ce3efc0689cd04ac62cc8207f3a38dd5
2020-01-28 15:40:19 -08:00
Colin Cross 503c1d06e8 Set LOCAL_CERTIFICATE for flattened apex APKs
Leaving out LOCAL_CERTIFICATE for flattened apex APKs causes
the apkcerts.txt to have empty keys for those APKs, which
confuses the signing tools.  Set LOCAL_CERTIFICATE for them.

Also refactor the Certificate support to avoid introducing
duplicated handling for presigned certificates.

Bug: 147765187
Test: m apkcerts-list
Change-Id: Ife07661761cd5a89c9f009b8ce041db4dff9ec54
2020-01-28 14:03:08 -08:00
Treehugger Robot 76fde9212a Merge "License info for APEXes are correctly gathered" 2020-01-28 18:56:47 +00:00
Jiyong Park 19972c7935 License info for APEXes are correctly gathered
This change fixes a bug that license info for non-flattened APEXes are
not captured in /system/etc/NOTICE.xml.gz file. For non-flatted APEXes,
we have been creating NOTICE.html.gz file by concatenating all the
license infos of the modules that contributes to the APEX and embedding
the file into the asset directory of the APEX. Then at runtime, the info
is shown through the "Google Play System Update Licenses" UI. However,
this was problematic because the UI only shows license info for the
Google-signed APEXes, leaving OEM-signed APEXes (a.k.a. optional
modules).

The problem is now fixed by associating a merged license file with each
APEX and exporting them to Make, so that the merged license files are
included in the partition level /system/etc/NOTICE.xml.gz file
regardless of whether the APEX is a Google-signed one or not.

This also fixes a bug that license info entries are created for the
runtime paths /apex/<apex_name>/<path_to_a_file>, which is not necessary
as they are already included in the license info of the containing APEX.

Bug: N/A
Test: Go to Settings->About Phone->Legal information and check
that a) /system/apex/*.apex files are shown and b) /apex/<apex_name>/*
files are not shown

Change-Id: I2c25c803b6a4c39b24bb3f724502699382fab50c
2020-01-28 17:20:45 +00:00
Jiyong Park 7aa3f76696 Remove unnecessary symlink for non-flattend APEXes
This change fixes a bug that symlinks to the system partition are
created in /system/apex/<apex_name> directories even when the APEXes are
non-flattened. The symlinks are needed only for flattened APEX (of
course regardless of whether the APEX is a primary one or not).

Bug: N/A
Test: examine /system/apex directory manually
Change-Id: I00bb1423d0a2497408f05e49767b42437210bab8
2020-01-28 16:51:34 +09:00
Colin Cross d9a121ba2a Add native_coverage to product variables
Allow native_coverage to adjust sources in product_variables.

Fixes: 148088129
Test: m checkbuild
Change-Id: I9c9d491cda92d69726a0d598408de2060241365b
2020-01-27 16:09:57 -08:00
Ulya Trafimovich f491dde8ea Store uncompressed and aligned DEX files for java libs in APEXes.
Test: aosp_walleye-userdebug boots.

Test: In internal, cherry-picked this CL, walleye-userdebug boots.

Test: In internal, ensure that DEX file wifi-service.jar in the
  com.android.wifi APEX is now stored uncompressed:

    $ zipinfo out/target/product/walleye/apex/com.android.wifi/javalib/wifi-service.jar
    Archive:  out/target/product/walleye/apex/com.android.wifi/javalib/wifi-service.jar
    Zip file size: 3086879 bytes, number of entries: 3
    -rw----     2.0 fat  3086304 b- stor 08-Jan-01 00:00 classes.dex
    -rw----     2.0 fat      339 b- defN 80-Feb-01 00:00 META-INF/proguard/androidx-annotations.pro
    -rw----     2.0 fat       45 b- defN 08-Jan-01 00:00 META-INF/MANIFEST.MF
    3 files, 3086688 bytes uncompressed, 3086480 bytes compressed:  0.0%

  Before the change it was:

    $ zipinfo out/target/product/walleye/apex/com.android.wifi/javalib/wifi-service.jar
    Archive:  out/target/product/walleye/apex/com.android.wifi/javalib/wifi-service.jar
    Zip file size: 1241938 bytes, number of entries: 3
    -rw----     2.0 fat  3086304 bl defN 08-Jan-01 00:00 classes.dex
    -rw----     2.0 fat      339 b- defN 80-Feb-01 00:00 META-INF/proguard/androidx-annotations.pro
    -rw----     2.0 fat       45 b- defN 08-Jan-01 00:00 META-INF/MANIFEST.MF
    3 files, 3086688 bytes uncompressed, 1241526 bytes compressed:  59.8%

Bug: 148099857
Bug: 146984232

Change-Id: Ia302967b280be85665032cc870c5d5d2419586fc
2020-01-27 10:19:10 +00:00
Baligh Uddin cf0bba7a30 Merge "Revert "Revert "Allow codename.fingerprint format for minSdkVersion""" 2020-01-25 04:12:30 +00:00
Baligh Uddin f62013736a Revert "Revert "Allow codename.fingerprint format for minSdkVersion""
This reverts commit 230e241f58.

Reason for revert: This is a revert of a revert.  Downstream problem has been fixed and have been validated locally and via Forrest build.

Change-Id: I89c51d25b3adb818ea44a983d0ac681a88790d8c
2020-01-24 23:15:44 +00:00
Treehugger Robot 8c94763bf7 Merge "Fix symlinks to system libs for flattened apex" 2020-01-24 08:32:05 +00:00
Jooyung Han 75de261056 Fix symlinks to system libs for flattened apex
Symlinks to system libs should be created for flattened apex regardless
that it is primary or not.

For example, GSI installs non-primary flattened apexes as well. These
flattened (non-primary) apexes could be activated on non-updatable
devices.

Bug: 148195518
Test: GSI runs on P
Change-Id: I238b226473d923e03280b1b28dd0d5d1f77ae74a
2020-01-24 02:02:45 +09:00
Jooyung Han a57af4adc0 Revert "Revert "apex_vndk uses vendor variants only""
This reverts commit 5df3b11f78.

Reason for revert: re-land with a fix

Fix a broken soong test
Add implicit dependency (libprofile-clang-extra) to make a test pass.

Bug: n/a
Test: m
Change-Id: I0b179199bc032501354f8e24782837453781bd8c
2020-01-23 14:48:29 +09:00
Jooyung Han 7dfb229936 Merge "Revert "apex_vndk uses vendor variants only"" 2020-01-23 05:34:42 +00:00
Jooyung Han 5df3b11f78 Revert "apex_vndk uses vendor variants only"
This reverts commit 559ad01db9.

Reason for revert: broken builds

Change-Id: Ia8a09a2bdbdc8e76f2d4b9eb54e36ccc544e9397
Bug: b/148181875
2020-01-23 05:31:05 +00:00
Treehugger Robot e4226c4d67 Merge "apex_vndk uses vendor variants only" 2020-01-23 04:47:05 +00:00
Jooyung Han 559ad01db9 apex_vndk uses vendor variants only
VNDK APEX is supposed to contain "vendor" variants of VNDK libraries.
This is different from normal APEXes which have "apex" variants.

Bug: 146758869
Test: build / flash / boot
Change-Id: I5e035678c337334092616b58d2e0e404788a6639
Exempt-From-Owner-Approval: Got ORV, but rebased with resolving merge conflicts.
2020-01-23 04:46:53 +00:00
Oliver Nguyen b6aeb14150 Merge "Add coverage flags for Clang coverage builds." 2020-01-22 22:34:35 +00:00
Treehugger Robot 21e40ce36e Merge "Reland "use symlink for bundled APEX"" 2020-01-22 01:41:14 +00:00
Pete Gillin 230e241f58 Revert "Allow codename.fingerprint format for minSdkVersion"
This reverts commit 014a85712d.

Reason for revert: Caused vendor/google/build/build_mainline_modules.sh to fail with `Error: minSdkVersion (10000) is greater than maxSdkVersion (30)`.

Bug: 130541924
Change-Id: Ifa233bf40a674481d21b61ee816c5fdde8201080
2020-01-21 13:44:50 +00:00