X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/4fe30939112f0413ba1140050d4a1e665ba3376b..636d3b70caa1904345685a8cdd4ae06cef7da2df:/ResourceTable.cpp diff --git a/ResourceTable.cpp b/ResourceTable.cpp index 19b9b01..b682702 100644 --- a/ResourceTable.cpp +++ b/ResourceTable.cpp @@ -39,6 +39,10 @@ status_t compileXmlFile(const sp& assets, root->removeWhitespace(false, NULL); } + if ((options&XML_COMPILE_UTF8) != 0) { + root->setUTF8(true); + } + bool hasErrors = false; if ((options&XML_COMPILE_ASSIGN_ATTRIBUTE_IDS) != 0) { @@ -1587,7 +1591,7 @@ status_t ResourceTable::startBag(const SourcePos& sourcePos, sourcePos.file.striing(), sourcePos.line, String8(type).string()); } #endif - if (overlay && !hasBagOrEntry(package, type, name)) { + if (overlay && !mBundle->getAutoAddOverlay() && !hasBagOrEntry(package, type, name)) { bool canAdd = false; sp p = mPackages.valueFor(package); if (p != NULL) { @@ -2505,7 +2509,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp& dest) // Iterate through all data, collecting all values (strings, // references, etc). - StringPool valueStrings; + StringPool valueStrings = StringPool(false, bundle->getUTF8()); for (pi=0; pi p = mOrderedPackages.itemAt(pi); if (p->getTypes().size() == 0) { @@ -2513,8 +2517,8 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp& dest) continue; } - StringPool typeStrings; - StringPool keyStrings; + StringPool typeStrings = StringPool(false, bundle->getUTF8()); + StringPool keyStrings = StringPool(false, bundle->getUTF8()); const size_t N = p->getOrderedTypes().size(); for (size_t ti=0; ti ResourceTable::Type::getEntry(const String16& entry, const SourcePos& sourcePos, const ResTable_config* config, bool doSetIndex, - bool overlay) + bool overlay, + bool autoAddOverlay) { int pos = -1; sp c = mConfigs.valueFor(entry); if (c == NULL) { - if (overlay == true && mCanAddEntries.indexOf(entry) < 0) { + if (overlay && !autoAddOverlay && mCanAddEntries.indexOf(entry) < 0) { sourcePos.error("Resource at %s appears in overlay but not" " in the base package; use to add.\n", String8(entry).string()); @@ -3592,7 +3597,7 @@ sp ResourceTable::getEntry(const String16& package, if (t == NULL) { return NULL; } - return t->getEntry(name, sourcePos, config, doSetIndex, overlay); + return t->getEntry(name, sourcePos, config, doSetIndex, overlay, mBundle->getAutoAddOverlay()); } sp ResourceTable::getEntry(uint32_t resID,