Use the correct versionCode for Split APKs

Insert the correct versionCode into the generated
Split AndroidManifest.xml.

Change-Id: I0aec797b5a4ff8bd70f9394b18aee5ad292b37c8
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 0a80805..869a6fc 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -770,7 +770,14 @@
     if (!addTagAttribute(root, RESOURCES_ANDROID_NAMESPACE, "versionCode",
             bundle->getVersionCode(), errorOnFailedInsert, replaceVersion)) {
         return UNKNOWN_ERROR;
+    } else {
+        const XMLNode::attribute_entry* attr = root->getAttribute(
+                String16(RESOURCES_ANDROID_NAMESPACE), String16("versionCode"));
+        if (attr != NULL) {
+            bundle->setVersionCode(strdup(String8(attr->string).string()));
+        }
     }
+
     if (!addTagAttribute(root, RESOURCES_ANDROID_NAMESPACE, "versionName",
             bundle->getVersionName(), errorOnFailedInsert, replaceVersion)) {
         return UNKNOWN_ERROR;