From e572c011feabf6319ba836cf5bc4c3baa0ba6a85 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Fri, 19 Sep 2014 15:10:04 -0700 Subject: AAPT: Continuation of public/private attribute fix XML files like layouts are now scanned and checked for v21 attributes. If those kinds of attributes are found, then we remove them in the original version and synthesize a new xml file under the v21 configuration. Bug:17520380 Change-Id: Icf984cb96134180a2e35349c1dbf2cef9a8f0bda --- tools/aapt/Resource.cpp | 50 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) (limited to 'tools/aapt/Resource.cpp') diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index d60520284fa2..a4c9dabb6be9 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -50,7 +50,7 @@ public: // ========================================================================== // ========================================================================== -static String8 parseResourceName(const String8& leaf) +String8 parseResourceName(const String8& leaf) { const char* firstDot = strchr(leaf.string(), '.'); const char* str = leaf.string(); @@ -1088,7 +1088,7 @@ status_t generateAndroidManifestForSplit(Bundle* bundle, const sp& a manifest->addChild(app); root->addChild(manifest); - int err = compileXmlFile(assets, root, outFile, table); + int err = compileXmlFile(bundle, assets, String16(), root, outFile, table); if (err < NO_ERROR) { return err; } @@ -1336,7 +1336,8 @@ status_t buildResources(Bundle* bundle, const sp& assets, spgetPrintableSource(); - err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); + err = compileXmlFile(bundle, assets, String16(it.getBaseName()), + it.getFile(), &table, xmlFlags); if (err == NO_ERROR) { ResXMLTree block; block.setTo(it.getFile()->getData(), it.getFile()->getSize(), true); @@ -1355,7 +1356,8 @@ status_t buildResources(Bundle* bundle, const sp& assets, sp& assets, sp& assets, sp& assets, sp& assets, sp& assets, sp& assets, sp& assets, spgetPrintableSource(); - err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); + err = compileXmlFile(bundle, assets, String16(it.getBaseName()), + it.getFile(), &table, xmlFlags); if (err == NO_ERROR) { ResXMLTree block; block.setTo(it.getFile()->getData(), it.getFile()->getSize(), true); @@ -1477,6 +1485,22 @@ status_t buildResources(Bundle* bundle, const sp& assets, sp& workQueue = table.getWorkQueue(); + while (!workQueue.empty()) { + CompileResourceWorkItem& workItem = workQueue.front(); + err = compileXmlFile(bundle, assets, workItem.resourceName, workItem.file, &table, xmlFlags); + if (err == NO_ERROR) { + assets->addResource(workItem.resPath.getPathLeaf(), + workItem.resPath, + workItem.file, + workItem.file->getResourceType()); + } else { + hasErrors = true; + } + workQueue.pop(); + } + if (table.validateLocalizations()) { hasErrors = true; } @@ -1509,7 +1533,7 @@ status_t buildResources(Bundle* bundle, const sp& assets, sp& assets, sp outManifestFile = new AaptFile(manifestFile->getSourceFile(), manifestFile->getGroupEntry(), manifestFile->getResourceType()); - err = compileXmlFile(assets, manifestFile, + err = compileXmlFile(bundle, assets, String16(), manifestFile, outManifestFile, &table, XML_COMPILE_ASSIGN_ATTRIBUTE_IDS | XML_COMPILE_STRIP_WHITESPACE | XML_COMPILE_STRIP_RAW_VALUES); -- cgit v1.2.3-59-g8ed1b