summaryrefslogtreecommitdiff
path: root/tools/aapt2/link/XmlReferenceLinker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aapt2/link/XmlReferenceLinker.cpp')
-rw-r--r--tools/aapt2/link/XmlReferenceLinker.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/aapt2/link/XmlReferenceLinker.cpp b/tools/aapt2/link/XmlReferenceLinker.cpp
index d68f7dd44c9f..c3c16b92f712 100644
--- a/tools/aapt2/link/XmlReferenceLinker.cpp
+++ b/tools/aapt2/link/XmlReferenceLinker.cpp
@@ -83,6 +83,15 @@ class XmlVisitor : public xml::PackageAwareVisitor {
Attribute default_attribute(android::ResTable_map::TYPE_ANY);
default_attribute.SetWeak(true);
+ // The default orientation of gradients in android Q is different than previous android
+ // versions. Set the android:angle attribute to "0" to ensure that the default gradient
+ // orientation will remain left-to-right in android Q.
+ if (el->name == "gradient" && context_->GetMinSdkVersion() <= SDK_Q) {
+ if (!el->FindAttribute(xml::kSchemaAndroid, "angle")) {
+ el->attributes.push_back(xml::Attribute{xml::kSchemaAndroid, "angle", "0"});
+ }
+ }
+
const Source source = source_.WithLine(el->line_number);
for (xml::Attribute& attr : el->attributes) {
// If the attribute has no namespace, interpret values as if
@@ -99,7 +108,7 @@ class XmlVisitor : public xml::PackageAwareVisitor {
std::string err_str;
attr.compiled_attribute =
- ReferenceLinker::CompileXmlAttribute(attr_ref, callsite_, symbols_, &err_str);
+ ReferenceLinker::CompileXmlAttribute(attr_ref, callsite_, context_, symbols_, &err_str);
if (!attr.compiled_attribute) {
DiagMessage error_msg(source);