From c84829d2d49ff19af91e01c6ed12894ecb328d96 Mon Sep 17 00:00:00 2001 From: Winson Chiu Date: Fri, 4 Mar 2022 20:35:58 +0000 Subject: 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 --- tools/aapt2/ResourceParser.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tools/aapt2/ResourceParser.cpp') 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, -- cgit v1.2.3-59-g8ed1b