From 5924d8c9ab7bd8614e8bd99864903ce9d50f3bf7 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Tue, 30 May 2017 15:15:58 -0700 Subject: AAPT2: Allow merging of Style attributes from overlays Previously style overlays would completely override an existing style. To be compatible with AAPT, styles now merge with the overlay, allowing the overlay's attributes and parent to take precedence. Bug: 38355988 Test: make aapt2_tests Change-Id: Id25c7240050a43e6a4a177c6e3d51e048d0cceb5 --- tools/aapt2/ResourceUtils.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'tools/aapt2/ResourceUtils.cpp') diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp index 1bb7d9beee45..818c8cec30f9 100644 --- a/tools/aapt2/ResourceUtils.cpp +++ b/tools/aapt2/ResourceUtils.cpp @@ -496,19 +496,17 @@ Maybe ParseSdkVersion(const StringPiece& str) { std::unique_ptr TryParseBool(const StringPiece& str) { if (Maybe maybe_result = ParseBool(str)) { - android::Res_value value = {}; - value.dataType = android::Res_value::TYPE_INT_BOOLEAN; - - if (maybe_result.value()) { - value.data = 0xffffffffu; - } else { - value.data = 0; - } - return util::make_unique(value); + const uint32_t data = maybe_result.value() ? 0xffffffffu : 0u; + return util::make_unique(android::Res_value::TYPE_INT_BOOLEAN, data); } return {}; } +std::unique_ptr MakeBool(bool val) { + return util::make_unique(android::Res_value::TYPE_INT_BOOLEAN, + val ? 0xffffffffu : 0u); +} + std::unique_ptr TryParseInt(const StringPiece& str) { std::u16string str16 = util::Utf8ToUtf16(str); android::Res_value value; -- cgit v1.2.3-59-g8ed1b