From c1676807f45a862256fb5b2804f15dbf4a90a11e Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Mon, 20 May 2019 16:47:08 -0700 Subject: Retain parsed attribute type If the value of an attribute enum is defined as a hexadecimal integer, flatten uses of the attribute as with the android::Res_value::TYPE_INT_HEX type. This change adds a "type" field to pb::Attribute::Symbol, which if left unset, will have a default value of android::Res_value::TYPE_INT_DEC when deserialized by aapt2. Bug: 124474141 Test: aapt2_tests and manual compilation of files and inspection using `aapt2 dump chunks` Change-Id: Ibf12394284fdbe3a8047f7ecf4fe68517dfc3abb --- tools/aapt2/ResourceUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/aapt2/ResourceUtils.cpp') diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp index e0040e486a23..bd2ab5377311 100644 --- a/tools/aapt2/ResourceUtils.cpp +++ b/tools/aapt2/ResourceUtils.cpp @@ -378,7 +378,7 @@ std::unique_ptr TryParseEnumSymbol(const Attribute* enum_attr, const ResourceName& enum_symbol_resource_name = symbol.symbol.name.value(); if (trimmed_str == enum_symbol_resource_name.entry) { android::Res_value value = {}; - value.dataType = android::Res_value::TYPE_INT_DEC; + value.dataType = symbol.type; value.data = symbol.value; return util::make_unique(value); } -- cgit v1.2.3-59-g8ed1b