From efa42b1e27efc2ff8cb39cf47141f9d59ca6d375 Mon Sep 17 00:00:00 2001 From: Jeremy Meyer Date: Wed, 17 Jul 2024 14:57:33 -0700 Subject: Dont parse resource values behind disabled flags This change makes it so that when we are parsing resources and there is one behind a disabled flag we don't parse the value. This is primarily to prevent disabled strings from ending up in the string pool. Test: automated Bug: 329436914 Flag: EXEMPT Aconfig not supported on host tools Change-Id: I4d8683ac820a3fd20cd92c223464f912b0ac422d --- tools/aapt2/ResourceParser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tools/aapt2/ResourceParser.cpp') diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp index 2df941834063..45bf8e38c5ce 100644 --- a/tools/aapt2/ResourceParser.cpp +++ b/tools/aapt2/ResourceParser.cpp @@ -690,7 +690,9 @@ bool ResourceParser::ParseResource(xml::XmlPullParser* parser, resource_format = item_iter->second.format; } - if (!ParseItem(parser, out_resource, resource_format)) { + // Don't bother parsing the item if it is behind a disabled flag + if (out_resource->flag_status != FlagStatus::Disabled && + !ParseItem(parser, out_resource, resource_format)) { return false; } return true; -- cgit v1.2.3-59-g8ed1b