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
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index 42715f9..8d35eee 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -1038,6 +1038,13 @@
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,