From f0e495d83f3b454ee6ec9fbf8368d4f9070a3877 Mon Sep 17 00:00:00 2001 From: Jeremy Meyer Date: Fri, 14 Feb 2025 11:04:21 -0800 Subject: Only have featureFlag attr in xml when v>baklava This makes it so that if there are xml files that use the featureFlag attribute they are split into a pre-B file where all flags are assumed false and a B version that is the file as is. Test: Automation Bug: 377974898 Flag: android.content.res.layout_readwrite_flags Change-Id: Iab1a69a6d0b3e7efd7033887c351430fb2aabd19 --- tools/aapt2/ResourceParser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tools/aapt2/ResourceParser.cpp') diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp index fb576df248be..9e2a4c1b1cc2 100644 --- a/tools/aapt2/ResourceParser.cpp +++ b/tools/aapt2/ResourceParser.cpp @@ -547,7 +547,8 @@ bool ResourceParser::ParseResource(xml::XmlPullParser* parser, }); std::string_view resource_type = parser->element_name(); - if (auto flag = ParseFlag(xml::FindAttribute(parser, xml::kSchemaAndroid, "featureFlag"))) { + if (auto flag = + ParseFlag(xml::FindAttribute(parser, xml::kSchemaAndroid, xml::kAttrFeatureFlag))) { if (options_.flag) { diag_->Error(android::DiagMessage(source_.WithLine(parser->line_number())) << "Resource flag are not allowed both in the path and in the file"); @@ -1529,7 +1530,7 @@ bool ResourceParser::ParseStyleItem(xml::XmlPullParser* parser, Style* style) { ResolvePackage(parser, &maybe_key.value()); maybe_key.value().SetSource(source); - auto flag = ParseFlag(xml::FindAttribute(parser, xml::kSchemaAndroid, "featureFlag")); + auto flag = ParseFlag(xml::FindAttribute(parser, xml::kSchemaAndroid, xml::kAttrFeatureFlag)); std::unique_ptr value = ParseXml(parser, 0, kAllowRawString); if (!value) { @@ -1674,7 +1675,7 @@ bool ResourceParser::ParseArrayImpl(xml::XmlPullParser* parser, const std::string& element_namespace = parser->element_namespace(); const std::string& element_name = parser->element_name(); if (element_namespace.empty() && element_name == "item") { - auto flag = ParseFlag(xml::FindAttribute(parser, xml::kSchemaAndroid, "featureFlag")); + auto flag = ParseFlag(xml::FindAttribute(parser, xml::kSchemaAndroid, xml::kAttrFeatureFlag)); std::unique_ptr item = ParseXml(parser, typeMask, kNoRawString); if (!item) { diag_->Error(android::DiagMessage(item_source) << "could not parse array item"); -- cgit v1.2.3-59-g8ed1b