diff options
author | Bill Peckham <bpeckham@google.com> | 2018-09-08 10:06:40 -0700 |
---|---|---|
committer | Bill Peckham <bpeckham@google.com> | 2018-09-08 10:06:40 -0700 |
commit | a74879d25eb0e4ef53855b57181b038bca75d05f (patch) | |
tree | 2a1ef83944343e547bebeae9998b098557225070 /tools/aapt2/format/binary/BinaryResourceParser.cpp | |
parent | b00720941bf751117cf02da40add144683ab51f1 (diff) |
Merge QP1A.180823.001
Change-Id: Ia2d6fa811b3c57185c1975db603d59e6eaef73fc
Diffstat (limited to 'tools/aapt2/format/binary/BinaryResourceParser.cpp')
-rw-r--r-- | tools/aapt2/format/binary/BinaryResourceParser.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/aapt2/format/binary/BinaryResourceParser.cpp b/tools/aapt2/format/binary/BinaryResourceParser.cpp index 8215ddf0461c..3a39a6baeeeb 100644 --- a/tools/aapt2/format/binary/BinaryResourceParser.cpp +++ b/tools/aapt2/format/binary/BinaryResourceParser.cpp @@ -338,10 +338,13 @@ bool BinaryResourceParser::ParseType(const ResourceTablePackage* package, const std::string type_str = util::GetString(type_pool_, type->id - 1); - const ResourceType* parsed_type = ParseResourceType(type_str); - if (!parsed_type) { - diag_->Error(DiagMessage(source_) - << "invalid type name '" << type_str << "' for type with ID " << (int)type->id); + // Be lenient on the name of the type if the table is lenient on resource validation. + auto parsed_type = ResourceType::kUnknown; + if (const ResourceType* parsed = ParseResourceType(type_str)) { + parsed_type = *parsed; + } else if (table_->GetValidateResources()) { + diag_->Error(DiagMessage(source_) << "invalid type name '" << type_str << "' for type with ID " + << (int) type->id); return false; } @@ -352,7 +355,7 @@ bool BinaryResourceParser::ParseType(const ResourceTablePackage* package, continue; } - const ResourceName name(package->name, *parsed_type, + const ResourceName name(package->name, parsed_type, util::GetString(key_pool_, util::DeviceToHost32(entry->key.index))); const ResourceId res_id(package->id.value(), type->id, static_cast<uint16_t>(it.index())); |