From d3edfde51bd069a63e820282421d1a534fcf00ce Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Fri, 8 Aug 2014 17:32:44 -0700 Subject: Add FeatureGroup to PackageInfo FeatureGroups replace top-level FeatureInfo objects. FeatureGroups inherit top-level FeatureInfos but override them if the feature names are the same. Bug:16822121 Change-Id: I80b2cb778a0fbcb4521efce986fba641e0914290 --- tools/aapt/Command.cpp | 8 ++------ tools/aapt/Resource.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index 41102fe..3738a29 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -1676,12 +1676,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& assets, sp& assets, sp 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 can not have " + "android:required=\"false\" when inside a " + " 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. -- cgit v1.1