summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceValues.h
diff options
context:
space:
mode:
author Jeremy Meyer <jakmcbane@google.com> 2024-08-23 17:29:03 -0700
committer Jeremy Meyer <jakmcbane@google.com> 2024-09-25 14:50:54 -0700
commit3d8d4a18c2bd4d697692ea30471852c90e7a3775 (patch)
tree19f6ae00972e306ed53d18712bc3893f2b973b42 /tools/aapt2/ResourceValues.h
parentb7ab38e10e1f0d3088153f070e681e34263d393c (diff)
Error on duplicate resource with same disabled flag
Also realized I hadn't handled flag negation so added that as well. Test: Automated Bug: 329436914 Flag: EXEMPT Aconfig not supported on host tools Change-Id: If90ae71070306f8e0c367be7e652da9c7bd0bb22
Diffstat (limited to 'tools/aapt2/ResourceValues.h')
-rw-r--r--tools/aapt2/ResourceValues.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/aapt2/ResourceValues.h b/tools/aapt2/ResourceValues.h
index a1b1839b19ef..e000c653b87a 100644
--- a/tools/aapt2/ResourceValues.h
+++ b/tools/aapt2/ResourceValues.h
@@ -65,10 +65,21 @@ class Value {
return translatable_;
}
+ void SetFlag(std::optional<FeatureFlagAttribute> val) {
+ flag_ = val;
+ }
+
+ std::optional<FeatureFlagAttribute> GetFlag() const {
+ return flag_;
+ }
+
void SetFlagStatus(FlagStatus val) {
flag_status_ = val;
}
+ // If the value is behind a flag this returns whether that flag was enabled when the value was
+ // parsed by comparing it to the flags passed on the command line to aapt2 (taking into account
+ // negation if necessary). If there was no flag, FlagStatus::NoFlag is returned instead.
FlagStatus GetFlagStatus() const {
return flag_status_;
}
@@ -128,6 +139,7 @@ class Value {
std::string comment_;
bool weak_ = false;
bool translatable_ = true;
+ std::optional<FeatureFlagAttribute> flag_;
FlagStatus flag_status_ = FlagStatus::NoFlag;
private: