From 8f51d6b876644765f86c82d45fb363db60b3ced1 Mon Sep 17 00:00:00 2001 From: Clark DuVall Date: Wed, 22 Apr 2020 13:19:28 -0700 Subject: Reorder styleable attributes in shared libraries This is a similar fix to https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/10109386 but deals with styleable attributes instead of style items. Bug: 147674078 Test: JavaClassGeneratorTest.SortsDynamicAttributesAfterFrameworkAttributes Change-Id: Ida6572cf07e2b5987e9d8941cf169a37c43578c4 --- tools/aapt2/java/JavaClassGenerator.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'tools/aapt2/java/JavaClassGenerator.cpp') diff --git a/tools/aapt2/java/JavaClassGenerator.cpp b/tools/aapt2/java/JavaClassGenerator.cpp index bb541fe2490b..0869c570f5d6 100644 --- a/tools/aapt2/java/JavaClassGenerator.cpp +++ b/tools/aapt2/java/JavaClassGenerator.cpp @@ -218,13 +218,10 @@ struct StyleableAttr { static bool operator<(const StyleableAttr& lhs, const StyleableAttr& rhs) { const ResourceId lhs_id = lhs.attr_ref->id.value_or_default(ResourceId(0)); const ResourceId rhs_id = rhs.attr_ref->id.value_or_default(ResourceId(0)); - if (lhs_id < rhs_id) { - return true; - } else if (lhs_id > rhs_id) { - return false; - } else { + if (lhs_id == rhs_id) { return lhs.attr_ref->name.value() < rhs.attr_ref->name.value(); } + return cmp_ids_dynamic_after_framework(lhs_id, rhs_id); } void JavaClassGenerator::ProcessStyleable(const ResourceNameRef& name, const ResourceId& id, -- cgit v1.2.3