From b435101ec8aa827375e837c4843f6444145e1f4c Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Tue, 26 Mar 2019 16:07:23 -0700 Subject: DO NOT MERGE: Do not allow overlaying of attributes with conflicting formats aapt(1) does not allow for attributes to be redefined with a different format. Also, attributes declared with enums or flags are never allowed to be redefined. This change will not allow attributes to be redefined with a conflicting format in aapt2. Bug: 129146717 Test: aapt2_tests Change-Id: Idc43d6d689199ba2cdc672d009ede22eaa75a10c --- tools/aapt2/ResourceValues.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/aapt2/ResourceValues.cpp') diff --git a/tools/aapt2/ResourceValues.cpp b/tools/aapt2/ResourceValues.cpp index 34b46c552e0c..696012786e6d 100644 --- a/tools/aapt2/ResourceValues.cpp +++ b/tools/aapt2/ResourceValues.cpp @@ -574,6 +574,10 @@ bool Attribute::Equals(const Value* value) const { } bool Attribute::IsCompatibleWith(const Attribute& attr) const { + if (Equals(&attr)) { + return true; + } + // If the high bits are set on any of these attribute type masks, then they are incompatible. // We don't check that flags and enums are identical. if ((type_mask & ~android::ResTable_map::TYPE_ANY) != 0 || -- cgit v1.2.3-59-g8ed1b