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
This commit is contained in:
Dave Ingram
2019-08-01 15:11:41 -07:00
parent b7daf7b6ef
commit 7e0e4c11f2

View File

@@ -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) {