AAPT2: Fix <add-resource> tag for overlays
Bug: 38355988
Test: make aapt2_tests
Change-Id: Iea8887f55f8ceb2c15bd963405fd132916173c0c
diff --git a/tools/aapt2/proto/TableProtoDeserializer.cpp b/tools/aapt2/proto/TableProtoDeserializer.cpp
index d93d495..1d0041b 100644
--- a/tools/aapt2/proto/TableProtoDeserializer.cpp
+++ b/tools/aapt2/proto/TableProtoDeserializer.cpp
@@ -32,8 +32,7 @@
public:
using ValueVisitor::Visit;
- explicit ReferenceIdToNameVisitor(
- const std::map<ResourceId, ResourceNameRef>* mapping)
+ explicit ReferenceIdToNameVisitor(const std::map<ResourceId, ResourceNameRef>* mapping)
: mapping_(mapping) {
CHECK(mapping_ != nullptr);
}
@@ -75,13 +74,11 @@
std::map<ResourceId, ResourceNameRef> idIndex;
- ResourceTablePackage* pkg =
- table->CreatePackage(pbPackage.package_name(), id);
+ ResourceTablePackage* pkg = table->CreatePackage(pbPackage.package_name(), id);
for (const pb::Type& pbType : pbPackage.types()) {
const ResourceType* resType = ParseResourceType(pbType.name());
if (!resType) {
- diag_->Error(DiagMessage(source_) << "unknown type '" << pbType.name()
- << "'");
+ diag_->Error(DiagMessage(source_) << "unknown type '" << pbType.name() << "'");
return {};
}
@@ -95,21 +92,20 @@
if (pbEntry.has_symbol_status()) {
const pb::SymbolStatus& pbStatus = pbEntry.symbol_status();
if (pbStatus.has_source()) {
- DeserializeSourceFromPb(pbStatus.source(), *source_pool_,
- &entry->symbol_status.source);
+ DeserializeSourceFromPb(pbStatus.source(), *source_pool_, &entry->symbol_status.source);
}
if (pbStatus.has_comment()) {
entry->symbol_status.comment = pbStatus.comment();
}
- SymbolState visibility =
- DeserializeVisibilityFromPb(pbStatus.visibility());
+ entry->symbol_status.allow_new = pbStatus.allow_new();
+
+ SymbolState visibility = DeserializeVisibilityFromPb(pbStatus.visibility());
entry->symbol_status.state = visibility;
if (visibility == SymbolState::kPublic) {
- // This is a public symbol, we must encode the ID now if there is
- // one.
+ // This is a public symbol, we must encode the ID now if there is one.
if (pbEntry.has_id()) {
entry->id = static_cast<uint16_t>(pbEntry.id());
}
@@ -142,16 +138,15 @@
return {};
}
- ResourceConfigValue* configValue =
- entry->FindOrCreateValue(config, pbConfig.product());
+ ResourceConfigValue* configValue = entry->FindOrCreateValue(config, pbConfig.product());
if (configValue->value) {
// Duplicate config.
diag_->Error(DiagMessage(source_) << "duplicate configuration");
return {};
}
- configValue->value = DeserializeValueFromPb(
- pbConfigValue.value(), config, &table->string_pool);
+ configValue->value =
+ DeserializeValueFromPb(pbConfigValue.value(), config, &table->string_pool);
if (!configValue->value) {
return {};
}