diff options
author | 2017-05-30 20:42:00 +0000 | |
---|---|---|
committer | 2017-05-30 20:42:07 +0000 | |
commit | 8255ced3f5a2bff41b78e839d2d89d815a0bb3dd (patch) | |
tree | 9f756cc834eab813b6e1f94f54352b2493167933 /tools/aapt2/ResourceTable.cpp | |
parent | 1399d3abf51265915a3d6cbd2b04be2a3142c609 (diff) | |
parent | 4488f1c74a0f7df09f2b201f7caa228d729e8389 (diff) |
Merge "AAPT2: Fix <add-resource> tag for overlays" into oc-dev
Diffstat (limited to 'tools/aapt2/ResourceTable.cpp')
-rw-r--r-- | tools/aapt2/ResourceTable.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/aapt2/ResourceTable.cpp b/tools/aapt2/ResourceTable.cpp index 1947628e9267..168004f0b721 100644 --- a/tools/aapt2/ResourceTable.cpp +++ b/tools/aapt2/ResourceTable.cpp @@ -440,8 +440,7 @@ bool ResourceTable::AddResourceImpl(const ResourceNameRef& name, const ResourceI return true; } -bool ResourceTable::SetSymbolState(const ResourceNameRef& name, - const ResourceId& res_id, +bool ResourceTable::SetSymbolState(const ResourceNameRef& name, const ResourceId& res_id, const Symbol& symbol, IDiagnostics* diag) { return SetSymbolStateImpl(name, res_id, symbol, ValidateName, diag); } @@ -489,8 +488,7 @@ bool ResourceTable::SetSymbolStateImpl(const ResourceNameRef& name, const Resour diag->Error(DiagMessage(symbol.source) << "trying to add resource '" << name << "' with ID " << res_id << " but resource already has ID " - << ResourceId(package->id.value(), type->id.value(), - entry->id.value())); + << ResourceId(package->id.value(), type->id.value(), entry->id.value())); return false; } @@ -505,6 +503,11 @@ bool ResourceTable::SetSymbolStateImpl(const ResourceNameRef& name, const Resour type->symbol_status.state = SymbolState::kPublic; } + if (symbol.allow_new) { + // This symbol can be added as a new resource when merging (if it belongs to an overlay). + entry->symbol_status.allow_new = true; + } + if (symbol.state == SymbolState::kUndefined && entry->symbol_status.state != SymbolState::kUndefined) { // We can't undefine a symbol (remove its visibility). Ignore. @@ -517,7 +520,10 @@ bool ResourceTable::SetSymbolStateImpl(const ResourceNameRef& name, const Resour return true; } - entry->symbol_status = std::move(symbol); + // This symbol definition takes precedence, replace. + entry->symbol_status.state = symbol.state; + entry->symbol_status.source = symbol.source; + entry->symbol_status.comment = symbol.comment; return true; } |