summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceParser.cpp
diff options
context:
space:
mode:
author Winson Chiu <chiuwinson@google.com> 2022-03-04 20:35:58 +0000
committer Winson Chiu <chiuwinson@google.com> 2022-03-04 21:36:27 +0000
commitc84829d2d49ff19af91e01c6ed12894ecb328d96 (patch)
tree88641776854135463c10d21e60f12a7dd74d2768 /tools/aapt2/ResourceParser.cpp
parent345a6bf30ad923581efacc1de91ca3418121e2fe (diff)
AAPT2: support removed_ entries in groups
Ignores and increments the ID if the entry contains removed_, to prevent shifting IDs by leaving a hole, allowing staging resources to be removed before finalization. This was broken out from the parent change to allow other CLs fixing the resource IDs to be merged without splitting public.xml. Bug: 222537368 Test: manual, see bug for other changes Change-Id: I56f4fd70824bd42ec62f4fa0a2f067e2a3c094b5
Diffstat (limited to 'tools/aapt2/ResourceParser.cpp')
-rw-r--r--tools/aapt2/ResourceParser.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index 42715f9c3592..8d35eeec2a93 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -1038,6 +1038,13 @@ bool static ParseGroupImpl(xml::XmlPullParser* parser, ParsedResource* out_resou
continue;
}
+ if (maybe_name.value().substr(0, std::strlen("removed_")) == "removed_") {
+ // Skip resources that have been removed from the framework, but leave a hole so that
+ // other staged resources don't shift and break apps previously compiled against them
+ next_id.id++;
+ continue;
+ }
+
ParsedResource& entry_res = out_resource->child_resources.emplace_back(ParsedResource{
.name = ResourceName{{}, *parsed_type, maybe_name.value().to_string()},
.source = item_source,