Loading tools/aapt/AaptAssets.h +3 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,9 @@ private: struct AaptGroupEntry { public: AaptGroupEntry() {} AaptGroupEntry(const ConfigDescription& config) : mParams(config) {} bool initFromDirName(const char* dir, String8* resType); inline const ConfigDescription& toParams() const { return mParams; } Loading tools/aapt/Images.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -1483,7 +1483,7 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con return NO_ERROR; } status_t postProcessImage(const sp<AaptAssets>& assets, status_t postProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets, ResourceTable* table, const sp<AaptFile>& file) { String8 ext(file->getPath().getPathExtension()); Loading @@ -1491,7 +1491,8 @@ status_t postProcessImage(const sp<AaptAssets>& assets, // At this point, now that we have all the resource data, all we need to // do is compile XML files. if (strcmp(ext.string(), ".xml") == 0) { return compileXmlFile(assets, file, table); String16 resourceName(parseResourceName(file->getPath().getPathLeaf())); return compileXmlFile(bundle, assets, resourceName, file, table); } return NO_ERROR; Loading tools/aapt/Images.h +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets, status_t preProcessImageToCache(const Bundle* bundle, const String8& source, const String8& dest); status_t postProcessImage(const sp<AaptAssets>& assets, status_t postProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets, ResourceTable* table, const sp<AaptFile>& file); #endif tools/aapt/Main.h +3 −0 Original line number Diff line number Diff line Loading @@ -62,4 +62,7 @@ int dumpResources(Bundle* bundle); status_t writeDependencyPreReqs(Bundle* bundle, const sp<AaptAssets>& assets, FILE* fp, bool includeRaw); android::String8 parseResourceName(const String8& pathLeaf); #endif // __MAIN_H tools/aapt/Resource.cpp +37 −13 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -1088,7 +1088,7 @@ status_t generateAndroidManifestForSplit(Bundle* bundle, const sp<AaptAssets>& 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; } Loading Loading @@ -1336,7 +1336,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil ResourceDirIterator it(layouts, String8("layout")); while ((err=it.next()) == NO_ERROR) { String8 src = it.getFile()->getPrintableSource(); 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); Loading @@ -1355,7 +1356,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (anims != NULL) { ResourceDirIterator it(anims, String8("anim")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1370,7 +1372,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (animators != NULL) { ResourceDirIterator it(animators, String8("animator")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1385,7 +1388,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (interpolators != NULL) { ResourceDirIterator it(interpolators, String8("interpolator")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1400,7 +1404,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (transitions != NULL) { ResourceDirIterator it(transitions, String8("transition")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1415,7 +1420,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (xmls != NULL) { ResourceDirIterator it(xmls, String8("xml")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1430,7 +1436,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (drawables != NULL) { ResourceDirIterator it(drawables, String8("drawable")); while ((err=it.next()) == NO_ERROR) { err = postProcessImage(assets, &table, it.getFile()); err = postProcessImage(bundle, assets, &table, it.getFile()); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1445,7 +1451,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (colors != NULL) { ResourceDirIterator it(colors, String8("color")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1461,7 +1468,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil ResourceDirIterator it(menus, String8("menu")); while ((err=it.next()) == NO_ERROR) { String8 src = it.getFile()->getPrintableSource(); 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); Loading @@ -1477,6 +1485,22 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil err = NO_ERROR; } // Now compile any generated resources. std::queue<CompileResourceWorkItem>& 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; } Loading Loading @@ -1509,7 +1533,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (err < NO_ERROR) { return err; } err = compileXmlFile(assets, manifestTree, manifestFile, &table); err = compileXmlFile(bundle, assets, String16(), manifestTree, manifestFile, &table); if (err < NO_ERROR) { return err; } Loading Loading @@ -1599,7 +1623,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil sp<AaptFile> 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); Loading Loading
tools/aapt/AaptAssets.h +3 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,9 @@ private: struct AaptGroupEntry { public: AaptGroupEntry() {} AaptGroupEntry(const ConfigDescription& config) : mParams(config) {} bool initFromDirName(const char* dir, String8* resType); inline const ConfigDescription& toParams() const { return mParams; } Loading
tools/aapt/Images.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -1483,7 +1483,7 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con return NO_ERROR; } status_t postProcessImage(const sp<AaptAssets>& assets, status_t postProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets, ResourceTable* table, const sp<AaptFile>& file) { String8 ext(file->getPath().getPathExtension()); Loading @@ -1491,7 +1491,8 @@ status_t postProcessImage(const sp<AaptAssets>& assets, // At this point, now that we have all the resource data, all we need to // do is compile XML files. if (strcmp(ext.string(), ".xml") == 0) { return compileXmlFile(assets, file, table); String16 resourceName(parseResourceName(file->getPath().getPathLeaf())); return compileXmlFile(bundle, assets, resourceName, file, table); } return NO_ERROR; Loading
tools/aapt/Images.h +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets, status_t preProcessImageToCache(const Bundle* bundle, const String8& source, const String8& dest); status_t postProcessImage(const sp<AaptAssets>& assets, status_t postProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets, ResourceTable* table, const sp<AaptFile>& file); #endif
tools/aapt/Main.h +3 −0 Original line number Diff line number Diff line Loading @@ -62,4 +62,7 @@ int dumpResources(Bundle* bundle); status_t writeDependencyPreReqs(Bundle* bundle, const sp<AaptAssets>& assets, FILE* fp, bool includeRaw); android::String8 parseResourceName(const String8& pathLeaf); #endif // __MAIN_H
tools/aapt/Resource.cpp +37 −13 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -1088,7 +1088,7 @@ status_t generateAndroidManifestForSplit(Bundle* bundle, const sp<AaptAssets>& 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; } Loading Loading @@ -1336,7 +1336,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil ResourceDirIterator it(layouts, String8("layout")); while ((err=it.next()) == NO_ERROR) { String8 src = it.getFile()->getPrintableSource(); 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); Loading @@ -1355,7 +1356,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (anims != NULL) { ResourceDirIterator it(anims, String8("anim")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1370,7 +1372,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (animators != NULL) { ResourceDirIterator it(animators, String8("animator")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1385,7 +1388,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (interpolators != NULL) { ResourceDirIterator it(interpolators, String8("interpolator")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1400,7 +1404,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (transitions != NULL) { ResourceDirIterator it(transitions, String8("transition")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1415,7 +1420,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (xmls != NULL) { ResourceDirIterator it(xmls, String8("xml")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1430,7 +1436,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (drawables != NULL) { ResourceDirIterator it(drawables, String8("drawable")); while ((err=it.next()) == NO_ERROR) { err = postProcessImage(assets, &table, it.getFile()); err = postProcessImage(bundle, assets, &table, it.getFile()); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1445,7 +1451,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (colors != NULL) { ResourceDirIterator it(colors, String8("color")); while ((err=it.next()) == NO_ERROR) { err = compileXmlFile(assets, it.getFile(), &table, xmlFlags); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); if (err != NO_ERROR) { hasErrors = true; } Loading @@ -1461,7 +1468,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil ResourceDirIterator it(menus, String8("menu")); while ((err=it.next()) == NO_ERROR) { String8 src = it.getFile()->getPrintableSource(); 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); Loading @@ -1477,6 +1485,22 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil err = NO_ERROR; } // Now compile any generated resources. std::queue<CompileResourceWorkItem>& 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; } Loading Loading @@ -1509,7 +1533,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil if (err < NO_ERROR) { return err; } err = compileXmlFile(assets, manifestTree, manifestFile, &table); err = compileXmlFile(bundle, assets, String16(), manifestTree, manifestFile, &table); if (err < NO_ERROR) { return err; } Loading Loading @@ -1599,7 +1623,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil sp<AaptFile> 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); Loading