]> git.saurik.com Git - android/aapt.git/blobdiff - ResourceTable.cpp
Implement compatibility support for WRITE_SDCARD permission.
[android/aapt.git] / ResourceTable.cpp
index 6e522a2c74c80a71b367e1f9a594e2897b1bf8b4..25ab1474d94863c3509dcc3da54f246f98954e24 100644 (file)
@@ -23,6 +23,16 @@ status_t compileXmlFile(const sp<AaptAssets>& assets,
     if (root == NULL) {
         return UNKNOWN_ERROR;
     }
+    
+    return compileXmlFile(assets, root, target, table, options);
+}
+
+status_t compileXmlFile(const sp<AaptAssets>& assets,
+                        const sp<XMLNode>& root,
+                        const sp<AaptFile>& target,
+                        ResourceTable* table,
+                        int options)
+{
     if ((options&XML_COMPILE_STRIP_WHITESPACE) != 0) {
         root->removeWhitespace(true, NULL);
     } else  if ((options&XML_COMPILE_COMPACT_WHITESPACE) != 0) {
@@ -1225,7 +1235,7 @@ status_t compileResourceFile(Bundle* bundle,
                         // pseudolocalize here
                         block.setPosition(parserPosition);
                         err = parseAndAddEntry(bundle, in, &block, pseudoParams, myPackage, curType,
-                                ident, *curTag, curIsStyled, curFormat, true, false, outTable);
+                                ident, *curTag, curIsStyled, curFormat, true, overwrite, outTable);
                         if (err != NO_ERROR) {
                             hasErrors = localHasErrors = true;
                         }
@@ -1307,7 +1317,7 @@ status_t ResourceTable::addIncludedResources(Bundle* bundle, const sp<AaptAssets
             } else if (id != 0) {
                 if (id == 127) {
                     if (mHaveAppPackage) {
-                        fprintf(stderr, "Included resource have two application packages!\n");
+                        fprintf(stderr, "Included resources have two application packages!\n");
                         return UNKNOWN_ERROR;
                     }
                     mHaveAppPackage = true;
@@ -1449,8 +1459,11 @@ status_t ResourceTable::startBag(const SourcePos& sourcePos,
     if ((result = e->makeItABag(sourcePos)) != NO_ERROR) {
         return result;
     }
-    return e->emptyBag(sourcePos);
+
+    if (replace) { 
+        return e->emptyBag(sourcePos);
+    }
+    return result;
 }
 
 status_t ResourceTable::addBag(const SourcePos& sourcePos,