diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/aapt/Command.cpp | 8 | ||||
-rw-r--r-- | tools/aapt/Resource.cpp | 35 |
2 files changed, 37 insertions, 6 deletions
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index c74a373..fe0a601 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -1673,12 +1673,8 @@ int doDump(Bundle* bundle) String8 name = getResolvedAttribute(&res, tree, NAME_ATTR, &error); if (name != "" && error == "") { - int required = getIntegerAttribute(tree, REQUIRED_ATTR, NULL, 1); - top.features.add(name, required); - if (required) { - addParentFeatures(&top, name); - } - + top.features.add(name, true); + addParentFeatures(&top, name); } else { int vers = getIntegerAttribute(tree, GL_ES_VERSION_ATTR, &error); if (error == "") { diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 010d59b..0a80805 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -1470,6 +1470,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil String16 action16("action"); String16 category16("category"); String16 data16("scheme"); + String16 feature_group16("feature-group"); + String16 uses_feature16("uses-feature"); const char* packageIdentChars = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ._0123456789"; const char* packageIdentCharsWithTheStupid = "abcdefghijklmnopqrstuvwxyz" @@ -1680,10 +1682,43 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil schemeIdentChars, true) != ATTR_OKAY) { hasErrors = true; } + } else if (strcmp16(block.getElementName(&len), feature_group16.string()) == 0) { + int depth = 1; + while ((code=block.next()) != ResXMLTree::END_DOCUMENT + && code > ResXMLTree::BAD_DOCUMENT) { + if (code == ResXMLTree::START_TAG) { + depth++; + if (strcmp16(block.getElementName(&len), uses_feature16.string()) == 0) { + ssize_t idx = block.indexOfAttribute( + RESOURCES_ANDROID_NAMESPACE, "required"); + if (idx < 0) { + continue; + } + + int32_t data = block.getAttributeData(idx); + if (data == 0) { + fprintf(stderr, "%s:%d: Tag <uses-feature> can not have " + "android:required=\"false\" when inside a " + "<feature-group> tag.\n", + manifestPath.string(), block.getLineNumber()); + hasErrors = true; + } + } + } else if (code == ResXMLTree::END_TAG) { + depth--; + if (depth == 0) { + break; + } + } + } } } } + if (hasErrors) { + return UNKNOWN_ERROR; + } + if (resFile != NULL) { // These resources are now considered to be a part of the included // resources, for others to reference. |