summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceParser.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-05-26 17:33:38 -0700
committerAdam Lesinski <adamlesinski@google.com>2017-05-26 17:38:34 -0700
commit4488f1c74a0f7df09f2b201f7caa228d729e8389 (patch)
tree84b28ff7c770f906f0a58cf280ec28ecc3a58f68 /tools/aapt2/ResourceParser.cpp
parent2354b568379fe31ba4e774f7a92d4c685a60a2ab (diff)
AAPT2: Fix <add-resource> tag for overlays
Bug: 38355988 Test: make aapt2_tests Change-Id: Iea8887f55f8ceb2c15bd963405fd132916173c0c
Diffstat (limited to 'tools/aapt2/ResourceParser.cpp')
-rw-r--r--tools/aapt2/ResourceParser.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index 0d1850fed26a..57ae2700127c 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -92,14 +92,14 @@ struct ParsedResource {
Source source;
ResourceId id;
Maybe<SymbolState> symbol_state;
+ bool allow_new = false;
std::string comment;
std::unique_ptr<Value> value;
std::list<ParsedResource> child_resources;
};
// Recursively adds resources to the ResourceTable.
-static bool AddResourcesToTable(ResourceTable* table, IDiagnostics* diag,
- ParsedResource* res) {
+static bool AddResourcesToTable(ResourceTable* table, IDiagnostics* diag, ParsedResource* res) {
StringPiece trimmed_comment = util::TrimWhitespace(res->comment);
if (trimmed_comment.size() != res->comment.size()) {
// Only if there was a change do we re-assign.
@@ -111,6 +111,7 @@ static bool AddResourcesToTable(ResourceTable* table, IDiagnostics* diag,
symbol.state = res->symbol_state.value();
symbol.source = res->source;
symbol.comment = res->comment;
+ symbol.allow_new = res->allow_new;
if (!table->SetSymbolState(res->name, res->id, symbol, diag)) {
return false;
}
@@ -121,8 +122,8 @@ static bool AddResourcesToTable(ResourceTable* table, IDiagnostics* diag,
res->value->SetComment(std::move(res->comment));
res->value->SetSource(std::move(res->source));
- if (!table->AddResource(res->name, res->id, res->config, res->product,
- std::move(res->value), diag)) {
+ if (!table->AddResource(res->name, res->id, res->config, res->product, std::move(res->value),
+ diag)) {
return false;
}
}
@@ -849,6 +850,7 @@ bool ResourceParser::ParseAddResource(xml::XmlPullParser* parser,
ParsedResource* out_resource) {
if (ParseSymbolImpl(parser, out_resource)) {
out_resource->symbol_state = SymbolState::kUndefined;
+ out_resource->allow_new = true;
return true;
}
return false;