AAPT2: Add a APK filtering.
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
diff --git a/tools/aapt2/configuration/ConfigurationParser.h b/tools/aapt2/configuration/ConfigurationParser.h
index 28c355e..6259ce8 100644
--- a/tools/aapt2/configuration/ConfigurationParser.h
+++ b/tools/aapt2/configuration/ConfigurationParser.h
@@ -36,7 +36,7 @@
/** Output artifact configuration options. */
struct Artifact {
/** Name to use for output of processing foo.apk -> foo.<name>.apk. */
- std::string name;
+ Maybe<std::string> name;
/** If present, uses the ABI group with this name. */
Maybe<std::string> abi_group;
/** If present, uses the screen density group with this name. */
@@ -51,7 +51,13 @@
Maybe<std::string> gl_texture_group;
/** Convert an artifact name template into a name string based on configuration contents. */
- Maybe<std::string> ToArtifactName(const std::string& format, IDiagnostics* diag) const;
+ Maybe<std::string> ToArtifactName(const android::StringPiece& format, IDiagnostics* diag,
+ const android::StringPiece& base_name = "",
+ const android::StringPiece& ext = "apk") const;
+
+ /** Convert an artifact name template into a name string based on configuration contents. */
+ Maybe<std::string> Name(const android::StringPiece& base_name, const android::StringPiece& ext,
+ IDiagnostics* diag) const;
};
/** Enumeration of currently supported ABIs. */
@@ -129,7 +135,7 @@
Group<Abi> abi_groups;
Group<ConfigDescription> screen_density_groups;
- Group<Locale> locale_groups;
+ Group<ConfigDescription> locale_groups;
Group<AndroidSdk> android_sdk_groups;
Group<DeviceFeature> device_feature_groups;
Group<GlTexture> gl_texture_groups;