From 4488f1c74a0f7df09f2b201f7caa228d729e8389 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Fri, 26 May 2017 17:33:38 -0700 Subject: AAPT2: Fix tag for overlays Bug: 38355988 Test: make aapt2_tests Change-Id: Iea8887f55f8ceb2c15bd963405fd132916173c0c --- tools/aapt2/ResourceParser.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tools/aapt2/ResourceParser.cpp') 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 symbol_state; + bool allow_new = false; std::string comment; std::unique_ptr value; std::list 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; -- cgit v1.2.3-59-g8ed1b