summaryrefslogtreecommitdiff
path: root/tools/aapt2/optimize/MultiApkGenerator.cpp
AgeCommit message (Collapse)Author
2019-06-26Allows features to link to other feature splits without namespacing.Udam Saini
Add uses-split dependencies to AppInfo. At link time, this is used and allows features to reference other features, before resource namespacing is implemented in Android Studio. bug:135681292 Test: Link_test, ReferenceLinker_test, and integration tests. Change-Id: Ifdf0067e7370552b6b9d4d6d4713d4484b6ea154
2018-10-08libandroidfw: move ConfigDescription from aapt2 to libandroidfwMÃ¥rten Kongstad
This is to allow idmap2 to access ConfigDescription. Test: libandroidfw_tests Test: aapt2_tests Change-Id: I54210bbbd8dad5903cb7100807df977efa394ad5
2018-07-23Revert "AAPT2: Automatic Static Library Namespacing."Chris Warrington
This reverts commit 481f027ddc3e0ff0e1838a9375c1286e8ad70d70. Reason for revert: Not needed any more Bug: 111543815 Test: existing unit and integration tests Change-Id: I87b039192682636d81c2d33512495cb005c9504d
2018-07-13AAPT2: Fix long version code bugsRyan Mitchell
Refactoring areas in AAPT2 that use android:versionCode to also use abdroid:versionCodeMajor. Does not add versionCodeMajor command line flag yet. Bug: 109883459 Test: aapt2_tests Change-Id: I573fbea37491cf8c5742f9e385c66ee64c4e5166
2018-03-14AAPT2: Automatic Static Library Namespacing.Chris Warrington
Introduces a link flag --auto-namespace-static-lib for use when linking static libraries. When linking a static library with compiled sources that have references to resources in provided libraries without an explicit package name, the flag enables automatic inference of the package. If a resource is present in the package that is being compiled, that is used, otherwise the reference is rewritten to the highest precedence resource with matching name and type. Test: m out/host/linux-x86/nativetest64/aapt2_tests/aapt2_tests && \ $ANDROID_HOST_OUT/nativetest64/aapt2_tests/aapt2_tests Test: m frameworks/base/tools/aapt2/integration-tests Change-Id: I6c6017e054654d1f60782d0a428a7a2a47f8952b
2018-02-14AAPT2: Fix compatible-screens element in AndroidManifest.xmlShane Farmer
Fix an issue where the compatible-screens element was not being populated correctly. The previous version was missing the screenSize attribute which is mandatory. The attributes were also missing the resource ID from the framework library as these are a part of the public API. Change-Id: I2f594c2259831dbbd96c58db4ba55e8288d4231e Test: unit tests Test: manually split an APK and dumped with aapt
2017-12-19AAPT2: Sort artifacts based on the Play Store rules.Shane Farmer
Sort output artifacts so that the updated versionCode manifest entry will allow correct handling of updates from Play Store. The most important dimension is Android SDK version. It is important that a split based on min SDK version will allow a user to get a new APK if they upgrade the OS on their device to support a new split. ABI splits need to also be taken into consideration as it is possible for a device to run in ARM emulation mode and installing an ARM APK over a x86 APK could cause performance regressions. The XML file format was updated to give each of the configuration groups have their own section of the XML file. This allows the sort order to be determined by a groups ordering. Artifacts can now be added to the configuration file in an arbitrary order. Since this will be the common case for developers, it will help reduce errors from inserting a new artifact in the wrong spot. The implementation follows the rules outlined at: https://developer.android.com/google/play/publishing/multiple-apks.html Test: Unit tests Test: Manual process XML configuration Change-Id: I0face862c6d6b9d3cd2d99088afe5b9491be0120
2017-12-13AAPT2: Push more configuration code into the parserShane Farmer
When parsing is complete, we now have a list of output artifacts that have their referential integrity validated. This means that once the configuration file is parsed, the only errors that can occur are related to APK processing, and not the configuration itself. This reduces the number of errors that could cause a partial output of APK artifacts. It simplifies the public API and reduces the complexity of the code to generate multiple APKs. Test: Ran unit tests Test: manually ran the optimize command to ensure it still works Change-Id: I3f2d885b207a84c958f5348a4baa6718598184a4
2017-12-12AAPT2: Remove signatures from multi-APK artifacts.Shane Farmer
Remove signer files (.SF and public key) as well as the original manifest file from any output artifacts. Since the artifacts are not signed, we want to remove the original signature and manifest. The APK signer tool will add these back later. Updated the context wrapper to enable verbose mode to be cleared. This lets us have more specific log messages when splitting an APK as at this point the artifacts and filters are more interesting than the files removed. Test: Manually split an APK and verified the filles were removed while leaving the other META-INF entries. Test: Unit tests Change-Id: Ia59993b5570f802130c6e3ba42398a00821061ea
2017-12-05AAPT2: Allow output artifacts to be filtered.Shane Farmer
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
2017-11-30AAPT2: Specify the output APK in log messagesShane Farmer
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
2017-11-01AAPT2: Add convert commandAdam Lesinski
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
2017-10-04AAPT2: Move format related files under same directoryAdam Lesinski
Test: make aapt2_tests Change-Id: Id72cdfc12ba3add294048e60c55f2461344464bf
2017-10-03AAPT2: Set compatible-screens in manifest for multi-APKShane Farmer
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
2017-10-03AAPT2: Update versionCode in multi-APKs.Shane Farmer
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
2017-10-03AAPT2: Set the minSdkVersion when generating multiple APKs.Shane Farmer
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
2017-08-31AAPT2: Multi APK generator by versionShane Farmer
- 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
2017-08-31AAPT2: Add flag to print multi APK artifact names.Shane Farmer
- 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
2017-08-24AAPT2: Fix multi APK outputShane Farmer
- 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
2017-08-16AAPT2: Add a APK filtering.Shane Farmer
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