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
This commit is contained in:
Winson Chiu
2022-03-04 20:35:58 +00:00
parent 345a6bf30a
commit c84829d2d4

View File

@@ -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,