-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0002-aapt2-unrestrict-item-tag-value-format.patch
More file actions
34 lines (31 loc) · 1.55 KB
/
Copy path0002-aapt2-unrestrict-item-tag-value-format.patch
File metadata and controls
34 lines (31 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From a6d241f261b565303987ca59c6080c0c28879991 Mon Sep 17 00:00:00 2001
From: Igor Eisberg <8811086+IgorEisberg@users.noreply.github.com>
Date: Thu, 26 Feb 2026 16:19:07 +0200
Subject: [PATCH] aapt2: unrestrict value format for item tags
---
tools/aapt2/ResourceParser.cpp | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index 9e2a4c1b1cc2e..941bfcb74f018 100644
--- a/ResourceParser.cpp
+++ b/ResourceParser.cpp
@@ -732,10 +732,16 @@ bool ResourceParser::ParseResource(xml::XmlPullParser* parser,
out_resource->name.type = parsed_type->ToResourceNamedType();
out_resource->name.entry = std::string(maybe_name.value());
- out_resource->value = ParseXml(parser, android::ResTable_map::TYPE_REFERENCE, kNoRawString);
- if (!out_resource->value) {
- diag_->Error(android::DiagMessage(out_resource->source)
- << "invalid value for type '" << *parsed_type << "'. Expected a reference");
+
+ // Only enforce a reference when there is no explicit format.
+ if (resource_format == 0u) {
+ out_resource->value = ParseXml(parser, android::ResTable_map::TYPE_REFERENCE, kNoRawString);
+ if (!out_resource->value) {
+ diag_->Error(DiagMessage(out_resource->source)
+ << "invalid value for type '" << *parsed_type << "'. Expected a reference");
+ return false;
+ }
+ } else if (!ParseItem(parser, out_resource, resource_format)) {
return false;
}
return true;