summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceParser.cpp
diff options
context:
space:
mode:
author Jeremy Meyer <jakmcbane@google.com> 2025-02-14 11:04:21 -0800
committer Jeremy Meyer <jakmcbane@google.com> 2025-02-25 11:20:43 -0800
commitf0e495d83f3b454ee6ec9fbf8368d4f9070a3877 (patch)
tree5983f1ba5e45f70de90ffde40e9732f19130372e /tools/aapt2/ResourceParser.cpp
parente4acd96aa312f706d157c29ff33fe16cdafb5e3f (diff)
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
Diffstat (limited to 'tools/aapt2/ResourceParser.cpp')
-rw-r--r--tools/aapt2/ResourceParser.cpp7
1 files changed, 4 insertions, 3 deletions
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<Item> 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> item = ParseXml(parser, typeMask, kNoRawString);
if (!item) {
diag_->Error(android::DiagMessage(item_source) << "could not parse array item");