Commit graph

52 commits

Author SHA1 Message Date
Jihoon Kang
842b999a53 Add environment variable UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA
UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA enables user to specify
${codename}.${sha} as min_sdk_version and target_sdk_version in order to
support mainline train building into android build.

Test: TH
Bug: 295905124
Change-Id: I032d464aaa7314520f98b8eafa53d962940075ce
2024-02-12 21:12:58 +00:00
Alix
96ea8845c5 add manifest_values application id property to soong
Bug:278905106
Test: go test ./java --run TestManifestValuesApplicationIdSetsPackageName
	and locally built a module and checked manifest pacakge_name
Change-Id: I5c8fd27c177b9e255dce197706f62580894008cb
2023-10-23 18:26:53 +00:00
Alix
f7a1027c6b Use an option struct in aapt.buildActions & manifestMerger
Change-Id: Ia056ab321e1fd146ed0cdb98fc2d4455601f648c
Test: Treehugger
2023-10-10 14:31:03 +00:00
Spandan Das
fb6a1ee68b target_sdk_version replacement should respect REL branches
Currently, target_sdk_version of MTS tests were being set to 10000 even
in release branches. This should only happen in active branches.

Test: Unit test
Test: aapt2 on CtsContentTestCases in udc-dev and verified
targetSdkVersion is 34
Bug: 279507428

Change-Id: Ib79318febc0f6e771b3679c0281a97357930ec56
2023-04-28 16:23:53 +00:00
Spandan Das
ca70fc40bd Update target_sdk_version from SdkSpec to ApiLevel
target_sdk_version signifies device version and does not need an sdkKind to
describe it fully. Update the type and cleanup existing usages. As a
side benefit, we also get better error handling since users can no
longer enter something like `public_30` as a valid target_sdk_version in bp
files

Test: m nothing
Test: no change in ninja files (this should be a no-op)
Bug: 208456999

Change-Id: I3c19245e29184bd9e5660ad8981966f64dfa9424
2023-03-23 19:31:17 +00:00
Paul Duffin
aa2aad6d0f Stop ignoring the targetSdkVersion when it includes the API fingerprint SHA
Change https://r.android.com/1959021 introduced a regression in the
handling of the `targetSdkVersion` when using the API fingerprint.
Prior to that change, when `UseApiFingerprint(ctx)` returned true that
would cause all APKs (apart from `framework-res`) that were built to
use a `targetSdkVersion` that included the API fingerprint SHA. After
that change the `UseApiFingerprint(ctx)` had no effect on the setting
of `targetSdkVersion`.

This change corrects that.

Bug: 266899206
Test: UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true TARGET_BUILD_APPS="NetworkStack" m
      aapt2 dump badging out/target/product/generic/system/priv-app/NetworkStack/NetworkStack.apk
      # Run above before and after this change and see that the targetSdkVersion
      # has changed to `UpsideDownCake.<SHA>`.
Change-Id: Ic6e1da552c565cc4bd75cc734b3acb7faec67981
2023-02-01 00:03:09 +00:00
Harshit Mahajan
5b8b730cdd Enforce mainline modules to have latest target sdk version by default.
Due to GMS target SDK requirements (https://docs.partner.android.com/gms/policies/preview/mba#min-target-sdk)
we need to ensure all the  mainline packages to target latest API
level. Currently, the team chases each module to bump their target
API level.

Updating the build code to make sure that mainline modules
(i.e updatable modules) target the latest sdk version by default.
It would be by default set to 10000 before SDK finalization and updated to the new API level after finalization.

Effectively it would mean:
1. '10000' in aosp and internal master
2. Finalized number in development branches like "33" in "tm-dev"
3. As sdk hasn't been finalised in "udc-dev", it would be "10000"
which would be automatically updated to finalized version after sdk finalization.

For local development if the target sdk version is required to be set,
users would need to set Updatable flag to false.
Enforce_default_target_sdk_version flag needs to be used in bp file,
if this feature needs to be tested locally when updatable: false.

Bug: b/227460469
Test: m nothing
Change-Id: I05e0ae74ae44fd73df75e91b926bcc924446253f
2022-09-21 19:09:38 +00:00
Spandan Das
9f7ae7f565 Set targetSdkVersion to 10000 for MTS tests targeting current
MTS tests built on unstable branches (e.g. git_master) should be testable on
old system images (e.g. S). However, they run into an error during installation
on older images:
`Requires development platform $<current_codename>, but this is a
release platform`

This CL fixes this issue by updating the target_sdk_version of MTS test apps
targeting current to the magical sdk_version 10000

Bug: 227473065
Test: go build ./java
Test: TH
Change-Id: Ic0358a48a19dc239defbb4ee8ec99225cce75584
2022-08-04 21:23:14 +00:00
Alexei Nicoara
69cf0f3756 Overriding placeholder version in updatable apks
Test: presubmit, checked the app version after build locally
Bug: 231691162
Change-Id: Icd242432540ea424235b226a45aac839dbc995be
2022-08-03 12:05:14 +01:00
William Loh
5a082f9a33 Propagate max_sdk_version to manifest_fixer
If max_sdk_version is included in Android.bp that value will now be
propagated to manifest_fixer.py. This value will then be used to
override any maxSdkVersion attribute set on permission or
uses-permission tags in the android manifest if maxSdkVersion="-1".

Bug: 223902327
Test: add max_sdk_version to Android.bp for test app
Test: create permission in test app manifest with maxSdkVersion="-1"
Test: run test to check maxSdkVersion=max_sdk_version
Change-Id: Ic533ef2a41b9ecc9ee68c69399026df47ee945b7
2022-06-28 22:07:23 +00:00
Ulya Trafimovich
f5d91bb3b4 Revert "Don't add uses_libs/optional_uses_libs to the manifest_fixer."
This reverts commit 0b1c70efbc.

The reverted commit was based on the idea that uses-libraries that are
explicitly specified in build files should not be implicitly added to
the manifest, as that would mean that anything added to the build files
will flow to the manifest.

Although this logic is correct, it prevents propagation of
uses-libraries from dependencies, which is wrong: if a library has an
explicit uses-library property in Android.bp, this property is expected
to be propagated to the library's dependencies. Failing to do so would
mean that every user of that library has to add uses-library property to
their build files, which doesn't scale (see b/214255490 for example).

Bug: 214255490
Test: lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd \
    && adb wait-for-device && adb root \
    && adb logcat | grep -E 'ClassLoaderContext [a-z ]+ mismatch'
    # empty output, no errors at boot
Change-Id: I6f420e76a89aa2f37be99f877711736640f2c361
2022-05-04 12:10:06 +01:00
Pedro Loureiro
ea2f5eff5e Fix error message formatting
Test: m nothing

Fixes: 230086179
Change-Id: Ieb6a7de9dcf0c12184c868b5af9af52c7b4bfa5e
2022-04-22 13:53:16 +00:00
Gurpreet Singh
7deabfacd0 Manifest Fixer Params code refactor
This CL refactors the code related to ManifestFixer parameters.
The required parameters android.ModuleContext, manifest android.Path are
passed separately as the parameters and the optional parameters are
kept as part of the ManifestFixerParams struct.

By default, the member variable of struct have the zero (nil, false,
empty string) values. Hence, it is only required to pass the
parameters of interest at the time of function call to
ManifestFixer.

Manual testing done to check the working of the code.

Test: m nothing && m test_com.android.sdkext
Test: manually tested the generation of AndroidManifest in the out
directory with the testOnly attribute
Test: atest manifest_fixer_test --host
To test the existing unittests are not breaking.

Change-Id: I20cb6c06c57f8fe7811050288bcb03945dc0425b
2022-02-10 13:37:50 +00:00
Gurpreet Singh
75d65f360c Add testOnly attribute to AndroidManifest file of apex_test
If the build file contains the apex_test module, add the
testOnly attribute to the application element of the
corresponding AndroidManifest file and set its value to true.
If the testOnly attribute is already present and has value
false, then do nothing.

Tests added in manifest_fixer_test.py to check if the updated
AndroidManifest file has the testOnly attribute set to true or not.

Bug: 213310150
Test: atest --host manifest_fixer_test
Test: m nothing
Test: manually checked the AndroidManifest file generated
Change-Id: I36247dbe0261c342d451a4422c314fd8fe0c2369
2022-02-01 12:03:48 +00:00
Spandan Das
c8cb0c3eb5 Set targetSdkVersion to 10000 iff a module is targeting an unreleased
sdk

Previously in aosp/1907152, targetSdkVersion for all modules would be
10000 in release builds. This would cause sdk compatibility errors like
b/209301265#3 for modules that were targeting a released SDK

This CL adds an additional check to set targetSdkVersion to 10000 only
if a module's apilevel is in preview (i.e. unreleased SDK)

Bug: 209301265

Test: Built various apk combinations locally, and used aapt2 to check
targetSdkVersion
Test: TARGET_BUILD_APPS=xyz m CaptivePortalLoginTests #
targetSdkVersion: 30
Test: m CaptivePortalLoginTests #targetSdkVersion: 30
Test: (internal) TARGET_BUILD_APPS=xyz m MediaProviderGoogle #
targetSdkVersion: 10000
Test: (internal) m MediaProviderGoogle #targetSdkVersion: Tiramisu

Change-Id: Id2901f23d4e1b436f8906940e47edd606a93657d
2021-12-09 18:08:28 +00:00
Kun Niu
131a5a13fe Revert "Set targetsdkversion to future level if TARGET_BUILD_APPS is not empty"
This reverts commit e33e25b4a5.

Reason for revert: may causing b/209301265,
Test: https://android-build.googleplex.com/builds/abtd/run/L66400000952203490
Change-Id: Ifcccdcfbfc014d4172f4d9488ea699380d3f3ebe
2021-12-08 00:44:07 +00:00
Spandan Das
e33e25b4a5 Set targetsdkversion to future level if TARGET_BUILD_APPS is not empty
manifest_fixer transforms an AndroidManifest.xml file for use in aapt2.
For TARGET_BUILD_APPS builds, set targetSdkVersion to a FutureApiLevel

Test: In build/soong, go test ./java
Test: TH

Test: In internal, TARGET_BUILD_APPS=xyz m
out/soong/.intermediates/packages/providers/MediaProvider/MediaProvider/android_common_MediaProviderGoogle_apex30/package-res.apk
&& aapt2 dump badging
out/soong/.intermediates/packages/providers/MediaProvider/MediaProvider/android_common_MediaProviderGoogle_apex30/package-res.apk
| grep targetSdkVersion # targetSdkVersion:'10000'

Test: In internal, m
out/soong/.intermediates/packages/providers/MediaProvider/MediaProvider/android_common_MediaProviderGoogle_apex30/package-res.apk
&& aapt2 dump badging
out/soong/.intermediates/packages/providers/MediaProvider/MediaProvider/android_common_MediaProviderGoogle_apex30/package-res.apk
| grep targetSdkVersion # targetSdkVersion:'Tiramisu'

Bug: 204107787

Change-Id: Ic6f21111d5a8c61ae789a7a3a001f669257a39b2
2021-12-02 19:55:25 +00:00
Ulya Trafimovich
0b1c70efbc Don't add uses_libs/optional_uses_libs to the manifest_fixer.
These properties specify libraries that cannot be implicitly inferred by
Soong. If these properties are added to Android.bp, this can only be for
the reason that there is a <uses-library> tag in the manifest which is
unknown to the build system. Adding them to the manifest_fixer doesn't
make sense: if they are not in the manifest, they should be removed from
Android.bp as well.

Bug: 132357300
Test: $ lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd
      $ adb wait-for-device && adb root && adb logcat \
        | grep -E 'ClassLoaderContext [a-z ]+ mismatch'
        # empty grep output, no errors
Change-Id: Ic6eb5268a954ef3be7f06a181ec72af99000c547
2021-08-20 15:54:42 +01:00
Ulya Trafimovich
fc0f6e34ce Fix the way manifest fixer detects optional <uses-library> entries.
Previously manifest_fixer used a naive way to distiniguish optional libs
from required ones: it checked if a library is on the list of optional
compatibility libraries. This works for compatibility libs, but not for
other libs.

Now we properly track optionality through all stages of the build,
starting with the addition of the library as a dependency (here's where
the `uses_libs`/`optional_uses_libs` distinction kicks in), store it in
dependency tag and propagate to class loader context, and from there to
the manifest_fixer.

The tests have been updated accordingly.

Bug: 196377222
Test: lunch bertha_x86_64-userdebug && m droid dist cts mts
Change-Id: I3631ce59ebe47116ce7a9b3d33a86f636846ef0f
2021-08-13 16:10:42 +01:00
Jiyong Park
9231537fe2 SdkSpec is fully using ApiLevel
Previously, SdkSpec was constructed only from the user string. It didn't
make use of the Config struct where information about the latest stable
SDK version, etc. is recorded. As a result, the build system couldn't
check if the sdk version "current" is referring to the in-development
(i.e.  not-yet-frozen) SDK version or the latest stable version.
"current" was always assumed to be in-development (IsPreview() returns
true) even when Platform_sdk_final == true.

As the first step for fixing that, this change requires
android.EarlyModuleContext to be passed when constructing SdkSpec from
the user string.

In the following changes, "current" will be mapped to either
FutureApiLevel (10000) or one of the FinalApiLevels() depending on
whether the platform SDK was finalized or not.

Bug: 175678607
Test: m
Change-Id: Ifea12ebf147ecccf12e7266dd382819806571543
2021-04-08 11:27:24 +09:00
Jiyong Park
54105c48f4 SdkSpec = Scope + ApiLevel
SdkSpec.Version was an int type. Now it becomes ApiLevel type which
is a better abstraction of the version (or api level).

Bug: 1655587
Test: m

Change-Id: I4d67b9b9eae45f653b6af4f5b73da9e091b3dfab
2021-04-05 09:32:06 +09:00
Jiyong Park
f1691d2a2c Move java.sdkSpec to the android package
... in preparation for making the handling of sdk versions consistent
across java and cc modules.

Bug: 175678607
Test: m
Change-Id: I598f0454bce9b7320621022115412fbe97403945
2021-04-03 08:25:12 +09:00
Colin Cross
2669e7edf0 Exempt framework-res from UseApiFingerprint
Generating the API fingerpring depends on framework-res, so the
fingerprint cannot be embedded into framework-res.  Hardcode an
exemption to UseApiFingerprint.

Bug: 181978889
Test: TARGET_BUILD_VARIANT=user UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true vendor/google/build/build_mainline_modules.sh
Change-Id: I621f36d5eb157dd97baa132ff109b4df791eedcc
2021-03-05 19:54:31 +00:00
Ulya Trafimovich
b23d28c6e2 Rename fields and methods to reflect class loader context changes.
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Iebfbf2ffdac5ee48476d2aac312b3b8f4471fc85
2020-11-16 14:59:07 +00:00
Ulya Trafimovich
8cbc5d269b Rework class loader context implementation.
The old representation consisted of a list of libraries (UsesLibraries),
a list of optional libraries (OptionalUsesLibraries) and a mapping from
library name to its build/install paths (LibraryPaths). The separation
into lists and map was necessary because of special handling of
compatibility libraries, which is now unified with normal libraries.

The new representation is a mapping from target SDK version to a tree
structure ClassLoaderContext. Each node of the tree represents a library
and contains library name, build/install paths and a slice of
subcontexts for dependencies. The same library may occur in the tree
multiple times in case it is a dependency of multiple libraries. The
order in which libraries are added matters (the resulting tree shape may
be different).

Test results have to be updated, as the resulting <uses-library> list is
reodered (previously it was a sorted list of map keys, and now it is
formed by a depth-first preorder traversal of the class loader tree).

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Bug: 168686456
Change-Id: I11be8cd2967f004fd58753d7c5fb99fed179cd63
2020-11-03 15:15:46 +00:00
Ulya Trafimovich
663dc53c94 Consistently use default install path for compatibility <uses-library>.
Previously default install path was provided only for comatibility
libraries that are added explicitly via `uses_libs`/`optional_uses_libs`
properties. This didn't take into account compatibility libraries that
are added by Soong when it computes transitive closure of SDK library
dependencies. As a result, install path in such cases remained unknown,
and the corresponding compatibility library was omitted from class
loader context, which caused 'ClassLoaderContext shared library size
mismatch' errors at first boot on device.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: If661272f46803299c8640f7f5ef161c8217d07e4
2020-09-11 11:31:22 +01:00
Ulya Trafimovich
d2c7ddc82a Iterate <uses-library> in deterministic order in manifest_fixer.
Bug: 132357300
Test: lunch cf_x86_phone-userdebug && m
Change-Id: Ideb7e0f7beae8c80561f841b8ce9129003f1aa96
2020-09-03 15:52:01 +01:00
Ulya Trafimovich
31e444e101 Collect paths to transitive SDK Java library dependencies.
Previously only the names were collected, and later used in the
manifest_fixer to add missing <uses-library> entries to the manifest.
Now we also need to collect build-time and on-device paths, to be used
in class loader context for dexpreopt. This commit only collects paths,
but does not pass them to dexpreopt yet.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I34b229ee68f16ba215ba03770feadb4d890ec2bf
2020-08-19 13:51:21 +01:00
Colin Cross
8eebb135b3 Package robolectric tests for tradefed
Package a slightly modified copy of the robolectric tests with
the dependencies statically included into the testcases directory
and into a robolectric-tests.zip.

Test: m robolectric-tests
Change-Id: I73f51727695136d2a849d36af1683e93f7e156a3
2020-07-19 19:33:40 -07: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
Baligh Uddin
5b16dfb39a Allow for setting a logging_parent for an Android App.
Unit test: go test ./... -test.v -run TestOverrideAndroidApp
Unit test: python manifest_fixer_test.py

BUG: 148198056
Change-Id: Ib5ff235d2a93e88b86aec1c0b16327ea938a094d
2020-02-18 09:37:56 -08:00
Jiyong Park
6a927c4e6a Abstract sdk_version string using sdkSpec type
The value format that sdk_version (and min_sdk_version, etc.) can have
has consistently evolved and is quite complicated. Furthermore, with the
Mainline module effort, we are expected to have more sdk_versions like
'module-app-current', 'module-lib-current', etc.

The goal of this change is to abstract the various sdk versions, which
are currently represented in string and is parsed in various places,
into a type called sdkSpec, so that adding new sdk veresions becomes
easier than before.

The sdk_version string is now parsed in only one place 'SdkSpecFrom', in
which it is converted into the sdkSpec struct. The struct type provides
several methods that again converts sdkSpec into context-specific
information such as the effective version number, etc.

Bug: 146757305
Bug: 147879031
Test: m
Change-Id: I252f3706544f00ea71c61c23460f07561dd28ab0
2020-01-25 21:56:43 +09: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
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
Baligh Uddin
014a85712d Allow codename.fingerprint format for minSdkVersion
Use codename.fingerprint format for minSdkVersion if it is unset
in the manifest and
UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true.

Using a utility function in sdk.go to check whether to apply
api.fingerprint.

BUG: 130541924
Change-Id: I748a25c419033bf54b63171d334644fcd0ecc78f
2020-01-20 07:46:12 -08:00
Jaewoong Jung
c27ab6678b Touch up manifest if there's no source code.
The new package manager behavior requires packages without source code
to have an application element with hasCode attribute set to false in
their manifest. With this change, Soong can now automatically insert one
for codeless apps.

Test: app_test.go, manifest_fixer_test.py
Fixes: 124375490
Change-Id: Ied89a8d07c63805ab910859a4f7c45fc1c60bb73
2019-06-03 10:51:42 -07:00
Colin Cross
5446e88657 Add <uses-library> tags for SDK libraries to AndroidManifest.xml
Port I4e7a9bdc5bf845af85168abf55f8063900bacc72 and
Ieb7c1429077aaf6899e214a217d9455d95dbfea6 from Make to Soong to
support adding <uses-library> tags to AndroidManifest.xml for
transitive java_sdk_library dependencies and android.test.base
and android.test.mock.

Fixes: 133306356
Test: m checkbuild
Change-Id: I23763bb689c474d25d04a418df1c46e7f0d807af
2019-05-24 13:39:26 +00:00
Sasha Smundak
d2e5361c90 manifest_fixer argument should be --use-embedded-dex rather than --use-embedded-dex=true
Test: building soong tests, treehugger
Change-Id: Id0df92171a2e547794979fb473d8abc47f33d13c
2019-05-14 17:03:24 -07:00
Sasha Smundak
6ad772597d Fix use_embedded_native_libs handling for android_test
`use_embedded_native_libs: true` should cause
`--extract-native-libs=false` be added to the manifest_fixer invocation,
and it was not happening.
There are also minor naming improvements.

Bug: 117618214
Test: treehugger and 'atest CtsDynamicLinkerTestCases' after
cts/tests/tests/dynamic_linker has been converted to Android.bp.

Change-Id: I93ec2aed3f3b185d320e56b1b4eebb71339b81ee
2019-05-01 13:16:22 -07:00
Colin Cross
aa1c6f1f5a Pass --remove-tools-declarations to manifest merger
Manifest merger needs --remove-tools-declarations to match
Gradle behavior.

Bug: 112607039
Test: m checkbuild
Change-Id: Id93bcaeaf03770a4acd2e1fdf44e418f55540dd3
2019-04-24 14:41:04 -07:00
Colin Cross
90c25c6893 Don't use merged manifest for android_library modules
Don't use the merged manifest for android_library modules.  We
still have to run manifest merger for android_library modules
because Make can't handle transitive dependencies, so it will
continue to merge the manifests at each library, and then merge
the manifests of direct dependencies into the final application.

Bug: 113294940
Test: m checkbuild
Change-Id: Ia8f9f910bd0a134730ddf2d542460eeddbc0a075
2019-04-24 14:40:14 -07:00
Jiyong Park
71b519d6ce Set default target SDK version for APEX
Target SDK version is used for targeting an APEX to a specific set of
platform builds. Usually, the targeting is unrestricted (in case the
APEX can run on all platforms), or based on platform SDK version (e.g.
28 for P). However, when the platform is under development and SDK is
not finalized, the targeting should be much more fine-grained; the
APEX should be targeted to a very specific build that supports the same
set of APIs that the APEX was built against.

To support that, target sdk version is automatically set by the build
system. When the platform is released or SDK is finalized, the target sdk
version set to the SDK version number. If not, it is set to
<version_code>.<fingerprint> (e.g., Q.123456).
Note that the target sdk version set by the build system is used only
when the target sdk version is not explicitly set in
AndroidManifest.xml.

Bug: 130541924
Test: UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true \
UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true \
TARGET_BUILD_APPS=com.android.tzdata m
build.ninja has --target_sdk_version Q.$$(cat out/soong/api_fingerprint.txt)

Test: aapt dump badging out/dist/com.android.tzdata.apex | grep \
targetSdkVersion shows:
targetSdkVersion:'Q.6ee443d9ad5f0cca7a43cfa97b7fc62a'

Change-Id: I086230d787f01075c28fc3f0163550300fa00212
2019-04-19 14:45:41 +09:00
Colin Cross
109328714f Allow codename.fingerprint format for targetSdkVersion
Use codename.fingerprint format for targetSdkVersion if it is unset
in the manifest and UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true.

Test: manual
Bug: 130541924
Change-Id: I4e3b1274cc32038b00b292dc6d67559eb320e9e4
2019-04-18 16:05:37 -07:00
Colin Cross
87ecbfe107 Update manifest merger to use binary
Manifest merger is now a java_binary instead of a collection of jars,
it can use the single binary as the dependency.

Bug: 112607039
Test: m checkbuild
Change-Id: Iea6c97c99a3bb09952fed2b25437b644f4e863f8
2019-03-04 22:02:01 +00:00
David Brazdil
d25060aa2d Set usesNonSdkApi in manifest when Platform_apis=true
The Platform_apis field in CompilerDeviceProperties currently has no
effect. Unify the behaviour with make and run manifest_fixer.py to
encode the information in the manifest. This is used to exempt
bundled apps and platform tests from hidden API access checks without
having a fixed whitelist of packages.

Bug: 113315999
Bug: 124671117
Test: m UbSystemUiJankTests && \
      aapt d xmltree \
      target/product/taimen/data/app/UbSystemUiJankTests/UbSystemUiJankTests.apk \
      AndroidManifest.xml | grep usesNonSdkApi
Change-Id: I20c392d91ee6275ef8139fbeb5b9700385abbc80
2019-02-18 19:21:02 +00:00
Colin Cross
46abdad46a Add support for use_embedded_dex in Soong
When use_embedded_dex is set, store the dex uncompressed in the
APK and set the android:useEmbeddedDex="true" attribute in the
manifest.

Test: m checkbuild
Change-Id: Iea6e7ed19599830ac72392ef93f9c98957df1cce
2019-02-08 15:25:17 +00:00
Colin Cross
e4246abd7f Make manifest and APK agree on uncompressed native libs
Only put uncompressed native libs in an APK if the min_sdk_version
supports it (>= 23, Marshmallow), and set
android:extractNativeLibs="false" in the AndroidManifest.xml so
that the platform won't extract them anyways.

Bug: 117618214
Test: m checkbuild
Change-Id: I760017e48bf3c6b618aabde0982df45995765d48
2019-02-08 15:24:47 +00:00
Dan Willemsen
419290aba9 Support setting target_sdk_version separately from sdk_version
Before this change, if targetSdkVersion wasn't set in the
AndroidManifest.xml, we'd set it to the sdk_version from the Android.bp.

But there are cases where you want to compile against a later SDK, but
target an earlier one (especially if you depend on libraries that need
to be compiled against more recent SDKs, like androidx).

Test: build APK with different target_sdk_version.
Change-Id: Iaed36b522955a374a049ef331158cc8fc5798ad2
2018-10-31 21:37:34 -07:00
Colin Cross
7b59e7b2d0 Make manifest_fixer.py keep targetSdkVersion high with min_sdk_version
targetSdkVersion should stay as "current" when min_sdk_version
is set but sdk_version is not.

Bug: 112438448
Test: atest CtsTelecomTestCases
Change-Id: I11dc27eccd31200d1ce27c7e332106bb825651b4
2018-09-10 14:41:56 -07:00
Jason Monk
6f937a99e3 Fix manifest merging flags
library manifests were just being dropped on the ground.

Bug: 112467584
Test: build
Change-Id: I61c2efca37aa3fdb9c944260f4a276d1d3c26f6c
Merged-In: I61c2efca37aa3fdb9c944260f4a276d1d3c26f6c
(cherry picked from commit b7c147efec)
2018-08-28 14:10:03 -07:00