Badging should print compiled platform version

aapt2 saves space by compiling all raw xml strings to the Res_value
structure. This causes the platformBuildVersionCode and
platformBuildVersionCodename attributes on the <manifest> tag to be
compilled as integers. aapt2 and aapt dump badging assumed these values
would be strings and is failing to print the value for these attributes.

With this change, the value will be printed regardless if it is encoded
as an integer or string.

Bug: 130830770
Test: manualy build APK and run aapt2 dump badging
Change-Id: I89487db36c6bc4d0fde3a410b7a64debfec5021e
diff --git a/tools/aapt2/dump/DumpManifest.cpp b/tools/aapt2/dump/DumpManifest.cpp
index 92f1ddb..54f0816 100644
--- a/tools/aapt2/dump/DumpManifest.cpp
+++ b/tools/aapt2/dump/DumpManifest.cpp
@@ -291,7 +291,10 @@
             }
           }
         }
-        return &attr->value;
+
+        if (!attr->value.empty()) {
+          return &attr->value;
+        }
       }
       return nullptr;
     }
@@ -425,6 +428,8 @@
   const std::string* split = nullptr;
   const std::string* platformVersionName = nullptr;
   const std::string* platformVersionCode = nullptr;
+  const int32_t* platformVersionNameInt = nullptr;
+  const int32_t* platformVersionCodeInt = nullptr;
   const int32_t* compilesdkVersion = nullptr;
   const std::string* compilesdkVersionCodename = nullptr;
   const int32_t* installLocation = nullptr;
@@ -440,6 +445,10 @@
                                                            "platformBuildVersionName"));
     platformVersionCode = GetAttributeString(FindAttribute(manifest, {},
                                                            "platformBuildVersionCode"));
+    platformVersionNameInt = GetAttributeInteger(FindAttribute(manifest, {},
+                                                               "platformBuildVersionName"));
+    platformVersionCodeInt = GetAttributeInteger(FindAttribute(manifest, {},
+                                                               "platformBuildVersionCode"));
 
     // Extract the compile sdk info
     compilesdkVersion = GetAttributeInteger(FindAttribute(manifest, COMPILE_SDK_VERSION_ATTR));
@@ -460,9 +469,15 @@
     if (platformVersionName) {
       printer->Print(StringPrintf(" platformBuildVersionName='%s'", platformVersionName->data()));
     }
+    if (platformVersionNameInt) {
+      printer->Print(StringPrintf(" platformBuildVersionName='%d'", *platformVersionNameInt));
+    }
     if (platformVersionCode) {
       printer->Print(StringPrintf(" platformBuildVersionCode='%s'", platformVersionCode->data()));
     }
+    if (platformVersionCodeInt) {
+      printer->Print(StringPrintf(" platformBuildVersionCode='%d'", *platformVersionCodeInt));
+    }
     if (compilesdkVersion) {
       printer->Print(StringPrintf(" compileSdkVersion='%d'", *compilesdkVersion));
     }