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].
Original author: rgreenwalt
Automated import of CL 144413
if (!localHasErrors) {
err = outTable->startBag(SourcePos(in->getPrintableSource(), block.getLineNumber()),
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;
}
if (err != NO_ERROR) {
hasErrors = localHasErrors = true;
}
const ResTable_config* params,
bool replace, bool isId)
{
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()
// 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()
}
e->setParent(bagParent);
}
}
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,
}
status_t ResourceTable::addBag(const SourcePos& sourcePos,
+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)
{
status_t ResourceTable::Entry::generateAttributes(ResourceTable* table,
const String16& package)
{
String16 getParent() const { return mParent; }
status_t makeItABag(const SourcePos& sourcePos);
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,
status_t setItem(const SourcePos& pos,
const String16& value,
const Vector<StringPool::entry_style_span>* style = NULL,