summaryrefslogtreecommitdiff
path: root/tools/aapt/Resource.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-09-19 19:08:50 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-19 19:08:50 +0000
commit0fa7511db2ec1e2326938f92262d00f23876307e (patch)
tree79fe6be8c92ccf3acef647bbaa3ee85e6f890890 /tools/aapt/Resource.cpp
parente83bc5932eba4af67e2cd7b76648ae26740b9b01 (diff)
parenta7d1a111c7176fdf853e53e74f6c7c7843c3c81c (diff)
am 9ee3ba23: am e7e9ad6d: am 863b1a90: am 19f9d54f: Merge "Fix backwards compat problem with AAPT public attrs" into lmp-dev
* commit '9ee3ba23395bd1a13bbfd3fe523ee611a5ca001b': Fix backwards compat problem with AAPT public attrs
Diffstat (limited to 'tools/aapt/Resource.cpp')
-rw-r--r--tools/aapt/Resource.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 3ab3d592061b..1e6ba7430c46 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -781,12 +781,18 @@ status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
if (!addTagAttribute(root, RESOURCES_ANDROID_NAMESPACE, "versionName",
bundle->getVersionName(), errorOnFailedInsert, replaceVersion)) {
return UNKNOWN_ERROR;
+ } else {
+ const XMLNode::attribute_entry* attr = root->getAttribute(
+ String16(RESOURCES_ANDROID_NAMESPACE), String16("versionName"));
+ if (attr != NULL) {
+ bundle->setVersionName(strdup(String8(attr->string).string()));
+ }
}
+ sp<XMLNode> vers = root->getChildElement(String16(), String16("uses-sdk"));
if (bundle->getMinSdkVersion() != NULL
|| bundle->getTargetSdkVersion() != NULL
|| bundle->getMaxSdkVersion() != NULL) {
- sp<XMLNode> vers = root->getChildElement(String16(), String16("uses-sdk"));
if (vers == NULL) {
vers = XMLNode::newElement(root->getFilename(), String16(), String16("uses-sdk"));
root->insertChildAt(vers, 0);
@@ -806,6 +812,14 @@ status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
}
}
+ if (vers != NULL) {
+ const XMLNode::attribute_entry* attr = vers->getAttribute(
+ String16(RESOURCES_ANDROID_NAMESPACE), String16("minSdkVersion"));
+ if (attr != NULL) {
+ bundle->setMinSdkVersion(strdup(String8(attr->string).string()));
+ }
+ }
+
if (bundle->getPlatformBuildVersionCode() != "") {
if (!addTagAttribute(root, "", "platformBuildVersionCode",
bundle->getPlatformBuildVersionCode(), errorOnFailedInsert, true)) {
@@ -973,8 +987,8 @@ static ssize_t extractPlatformBuildVersion(ResXMLTree& tree, Bundle* bundle) {
static ssize_t extractPlatformBuildVersion(AssetManager& assets, Bundle* bundle) {
int32_t cookie = getPlatformAssetCookie(assets);
if (cookie == 0) {
- fprintf(stderr, "ERROR: Platform package not found\n");
- return UNKNOWN_ERROR;
+ // No platform was loaded.
+ return NO_ERROR;
}
ResXMLTree tree;
@@ -1500,6 +1514,10 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
return err;
}
+ if (table.modifyForCompat(bundle) != NO_ERROR) {
+ return UNKNOWN_ERROR;
+ }
+
//block.restart();
//printXMLBlock(&block);