summaryrefslogtreecommitdiffstats
path: root/tools/aapt/ResourceTable.cpp
diff options
context:
space:
mode:
authorRobert Greenwalt <>2009-04-07 17:19:28 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-07 17:19:28 -0700
commitae5728d67a2a705b6c5187e10751fa64a63967e8 (patch)
treebe67e0a2402afaa370ce8fd9b623d505b0c7d8a3 /tools/aapt/ResourceTable.cpp
parentf845cd4f23802b286bf24618f8caa397e25ec0d3 (diff)
downloadframeworks_base-ae5728d67a2a705b6c5187e10751fa64a63967e8.zip
frameworks_base-ae5728d67a2a705b6c5187e10751fa64a63967e8.tar.gz
frameworks_base-ae5728d67a2a705b6c5187e10751fa64a63967e8.tar.bz2
AI 144950: Manual integration of 144342 and 144547 from donutburger to cupcake.
Fix bag (string-array, etc) behavior with overlays. We used to replace elements in the default with elements from the overlay. This change causes us to empty the array first so if the overlay array is smaller we don't end up with elements from the default array showing through at the end of the final result. Ex: [A,B,C] default with [D] overlay should give [D] but used to give [D,B,C] BUG=1754390 Automated import of CL 144950
Diffstat (limited to 'tools/aapt/ResourceTable.cpp')
-rw-r--r--tools/aapt/ResourceTable.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 6f71a1e..a09b1a6 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -1109,7 +1109,8 @@ status_t compileResourceFile(Bundle* bundle,
if (!localHasErrors) {
err = outTable->startBag(SourcePos(in->getPrintableSource(), block.getLineNumber()),
- myPackage, curType, ident, parentIdent, &curParams);
+ myPackage, curType, ident, parentIdent, &curParams,
+ overwrite);
if (err != NO_ERROR) {
hasErrors = localHasErrors = true;
}
@@ -1409,6 +1410,8 @@ status_t ResourceTable::startBag(const SourcePos& sourcePos,
const ResTable_config* params,
bool replace, bool isId)
{
+ status_t result = NO_ERROR;
+
// Check for adding entries in other packages... for now we do
// nothing. We need to do the right thing here to support skinning.
uint32_t rid = mAssets->getIncludedResources()
@@ -1442,8 +1445,15 @@ status_t ResourceTable::startBag(const SourcePos& sourcePos,
}
e->setParent(bagParent);
}
-
- return e->makeItABag(sourcePos);
+
+ if ((result = e->makeItABag(sourcePos)) != NO_ERROR) {
+ return result;
+ }
+
+ if (replace) {
+ return e->emptyBag(sourcePos);
+ }
+ return result;
}
status_t ResourceTable::addBag(const SourcePos& sourcePos,
@@ -2798,6 +2808,17 @@ status_t ResourceTable::Entry::addToBag(const SourcePos& sourcePos,
return NO_ERROR;
}
+status_t ResourceTable::Entry::emptyBag(const SourcePos& sourcePos)
+{
+ status_t err = makeItABag(sourcePos);
+ if (err != NO_ERROR) {
+ return err;
+ }
+
+ mBag.clear();
+ return NO_ERROR;
+}
+
status_t ResourceTable::Entry::generateAttributes(ResourceTable* table,
const String16& package)
{