summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dave Ingram <dmi@google.com> 2019-08-01 15:11:41 -0700
committer Dave Ingram <dmi@google.com> 2019-08-01 16:10:33 -0700
commit7e0e4c11f2d3206948973bbd85e14c5bf3bbedcb (patch)
tree16e6a07a5f86bb9ba8ad08d380b4b267c2bba036
parentb7daf7b6efed9b4d973252658151aab7772ba32f (diff)
Badging should print package attributes at most once
Following up to change 7938786; if an APK had platformBuildVersionCode compiled as *both* integer and string, it would be output twice. This then confuses anything that tries to parse the output. With this change, the value will be printed at most once, with the string version taking priority. Bug: 138666693 Test: manually built SDK28 APK and ran aapt2 dump badging Change-Id: Icf6eb656ac0cb263969bb2f0c5ca03139985f6ca
-rw-r--r--tools/aapt2/dump/DumpManifest.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/aapt2/dump/DumpManifest.cpp b/tools/aapt2/dump/DumpManifest.cpp
index 54f0816f0398..31aa2494052c 100644
--- a/tools/aapt2/dump/DumpManifest.cpp
+++ b/tools/aapt2/dump/DumpManifest.cpp
@@ -468,14 +468,12 @@ class Manifest : public ManifestExtractor::Element {
}
if (platformVersionName) {
printer->Print(StringPrintf(" platformBuildVersionName='%s'", platformVersionName->data()));
- }
- if (platformVersionNameInt) {
+ } else if (platformVersionNameInt) {
printer->Print(StringPrintf(" platformBuildVersionName='%d'", *platformVersionNameInt));
}
if (platformVersionCode) {
printer->Print(StringPrintf(" platformBuildVersionCode='%s'", platformVersionCode->data()));
- }
- if (platformVersionCodeInt) {
+ } else if (platformVersionCodeInt) {
printer->Print(StringPrintf(" platformBuildVersionCode='%d'", *platformVersionCodeInt));
}
if (compilesdkVersion) {