A new optional flag has been added to allow a list of artifacts that
should be written as output to be provided. If the flag is provided,
only artifacts that have an output name matching an entry in the list
will be processed.
Test: manually ran against an APK with multiple artifacts in the
configuration and confirmed that only the specified artifacts were
written.
Test: Ran all unit tests.
Change-Id: Ia32b19acf1b2ef3711abf13df08dc7b1aa0cf161
Extend the context wrapper to allow it to also know the current artifact
that is being generated and to use that as a source for diagnostics
messages.
Test: ran unit tests
Test: manually ran optimize to split and APK and verified log messages
Change-Id: I1d66dacb38db58d57d2fffaa19f5fdaff9f908df
This command allows a developer to convert their proto APK
(generated from the link phase using --proto-format) into
a binary APK suitable for use on device.
aapt2 convert -o output.apk input.apk
Test: manual + make aapt2_tests
Change-Id: I10a7c33bb4b57006d01fe00a8bf92f78e04e7e50
If an artifact in a multi-apk set is for a scpecific set of screen
densities then update the manifest to set the compatible-screens element
to match.
Test: ran unit tests
Test: manually ran optimize command
Change-Id: I07e90850ab2f4647a8623acbeaccbebbe81c3a6a
Set versionCode in the AndroidManifest.xml so each artifact has a unique
version code. This will allow the play store to serve up the correct
APKs.
The versionCode is determined by taking the versionCode from the input
APK and adding the configured version to that. If an artifact does not
have a version, the next version is used based on the order in the
configuration file. If the firs artifact does not have a version, it
starts at 1, so that all artifacts have a different version code to the
base APK.
Bug: 64972562
Test: unit tests
Test: manually optimized an APK into multiple APKs and confirmed versions:
aapt dump badging ${apk} | grep versionCode
Change-Id: Ie12b3e42bbd8ce9a2819712c2c56b24c0a901e6b
When generating multiple APKs from a configuration file, check to see if
we have filtered resource by minSdkVersion and update the manifest to
reflect this. We only want to inflate and modify the manifest file if
there is an update to be applied.
Bug: 37944703
Bug: 67005138
Test: Ran unit tests
Test: Manually split an APK and verified the manifest by dumping with
AAPT (both xmltree and badging).
Change-Id: I64a0e4889d7d9e57373369b044a091287b06cc35
- Added an additional axis for generating a multi-apk split by minimum
Android SDK version. This removes any resources that will not be used
for the desired minimum SDK version. If there are multiple resources
that would be valid for any version newer than the requested minimum,
then all would be kept so that the best match can be found.
- Added a context wrapper to set the appropriate Android SDK version for
each generated artifact.
- Split out the FilterTable method to allow it to be directly tested
without the need to mock the APK writing steps.
Test: Unit tests
Test: manually run optimize command
Change-Id: I7e6018df081af9ed5d9e8aaf40ed216c1275f138
- Added new flag that exits after printing the list of artifact names
that would be generated from the combination of the configuration file
and input APK.
- Cleaned up the code to generate the artifact names which also involved
adding some more test cases for corner cases.
Test: Unit tests
Test: Manually ran new command
Test: Manually ran old command
Change-Id: I8d30e7a4a070af26945b8f544a13f23bdf1ba169
- Ensure that the output directory exists before generating APKs
- Only use the file name (and not the path) for creating output
file names
Test: manually ran optimize command
Change-Id: I5f5ecb5dcec4d17cdbca5709f2dd17e6d53df986
Allow resource files to be removed from the final artifact based on the
density and locale configuration in the config file. The APK is split
along the density, locale and ABI axis. Each split is generated from the
original APK without modifying the original. The new resource table is
written back to the file system with unneeded assets etc removed.
Test: Unit tests
Test: Manually run optimize command against an APK and inspect results
Test: Installed split searchlite APK (after resigning) and ran on N6
Change-Id: If73597dcfd88c02d2616518585d0e25a5c6a84d1
Locale deduping isn't straightforward, as parenting rules
change between platform versions and the selection
preference of a specific locale variant over the default
configuration lead to incorrect results at runtime.
Bug: 62409213
Test: make aapt2_tests
Change-Id: Iec8f1cfba7ae43c847d163529891fdc15f3db826
Generating splits should be possible to do from the optimize command.
This means that a lot of infrastructure around split APKs can be
shared by both the optimize and link phase.
Bug: 35925830
Change-Id: Ia88b9e4bff300a56353b2f7a4a2547c8eb43a299
Test: manual