summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRobert Greenwalt <>2009-04-02 16:55:50 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-02 16:55:50 -0700
commit4b4f4a908895bc0ba63f929bfdc02eec22c0f6e5 (patch)
tree27ad907b6d1999c14bf04f4d2adb3c2b8ff85e90 /tools
parent2a3ce2825182aab7c6e555f69b77e2c3d42bd660 (diff)
downloadframeworks_base-4b4f4a908895bc0ba63f929bfdc02eec22c0f6e5.zip
frameworks_base-4b4f4a908895bc0ba63f929bfdc02eec22c0f6e5.tar.gz
frameworks_base-4b4f4a908895bc0ba63f929bfdc02eec22c0f6e5.tar.bz2
AI 144342: 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 array. Ex: [A,B,C] and overlay [D] should give [D] but used to give [D,B,C]. BUG=1754390 Automated import of CL 144342
Diffstat (limited to 'tools')
-rw-r--r--tools/aapt/ResourceTable.cpp24
-rw-r--r--tools/aapt/ResourceTable.h4
2 files changed, 24 insertions, 4 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 6f71a1e..6e522a2 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,12 @@ status_t ResourceTable::startBag(const SourcePos& sourcePos,
}
e->setParent(bagParent);
}
-
- return e->makeItABag(sourcePos);
+
+ if ((result = e->makeItABag(sourcePos)) != NO_ERROR) {
+ return result;
+ }
+
+ return e->emptyBag(sourcePos);
}
status_t ResourceTable::addBag(const SourcePos& sourcePos,
@@ -2798,6 +2805,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)
{
diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h
index e8fbd9b..74ba326 100644
--- a/tools/aapt/ResourceTable.h
+++ b/tools/aapt/ResourceTable.h
@@ -254,7 +254,9 @@ public:
String16 getParent() const { return mParent; }
status_t makeItABag(const SourcePos& sourcePos);
-
+
+ status_t emptyBag(const SourcePos& sourcePos);
+
status_t setItem(const SourcePos& pos,
const String16& value,
const Vector<StringPool::entry_style_span>* style = NULL,