diff options
author | Shane Farmer <safarmer@google.com> | 2017-09-01 14:34:22 -0700 |
---|---|---|
committer | Shane Farmer <safarmer@google.com> | 2017-10-03 16:02:38 +0000 |
commit | 3edd47264335cf609ac6e733db77522f7c959c3f (patch) | |
tree | bedc420b9d9f980ff1e2c349be4a2b39348a6209 /tools/aapt2/configuration/ConfigurationParser.cpp | |
parent | 2310403031f4bb6224cdd3aeefc80585c5b5f362 (diff) |
AAPT2: Set the minSdkVersion when generating multiple APKs.
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
Diffstat (limited to 'tools/aapt2/configuration/ConfigurationParser.cpp')
-rw-r--r-- | tools/aapt2/configuration/ConfigurationParser.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/aapt2/configuration/ConfigurationParser.cpp b/tools/aapt2/configuration/ConfigurationParser.cpp index 9d6d3286f0ef..d2b4d725c416 100644 --- a/tools/aapt2/configuration/ConfigurationParser.cpp +++ b/tools/aapt2/configuration/ConfigurationParser.cpp @@ -27,6 +27,7 @@ #include "ConfigDescription.h" #include "Diagnostics.h" +#include "ResourceUtils.h" #include "io/File.h" #include "io/FileSystem.h" #include "io/StringInputStream.h" @@ -499,11 +500,11 @@ ConfigurationParser::ActionHandler ConfigurationParser::android_sdk_group_handle AndroidSdk entry; for (const auto& attr : child->attributes) { if (attr.name == "minSdkVersion") { - entry.min_sdk_version = {attr.value}; + entry.min_sdk_version = ResourceUtils::ParseSdkVersion(attr.value); } else if (attr.name == "targetSdkVersion") { - entry.target_sdk_version = {attr.value}; + entry.target_sdk_version = ResourceUtils::ParseSdkVersion(attr.value); } else if (attr.name == "maxSdkVersion") { - entry.max_sdk_version = {attr.value}; + entry.max_sdk_version = ResourceUtils::ParseSdkVersion(attr.value); } else { diag->Warn(DiagMessage() << "Unknown attribute: " << attr.name << " = " << attr.value); } |