summaryrefslogtreecommitdiff
path: root/libs/androidfw/AttributeResolution.cpp
diff options
context:
space:
mode:
authorAurimas Liutikas <aurimas@google.com>2018-12-18 16:20:49 -0800
committerAurimas Liutikas <aurimas@google.com>2019-01-15 16:11:23 -0800
commitce7c99c6617bd8a577126386a37060d356b5d1d4 (patch)
treee162e77267c28dcabc0c9621cf88105deb4db06f /libs/androidfw/AttributeResolution.cpp
parentde784fbf3d4b5544ccfd7e7a9162fb4af2ae8f10 (diff)
Add source style for each TypedValue.
This API will be used by Android Studio layout inspector to query where a given resource attribute originated from to allow developers to have an easier way to find what needs to be changed to affect a given resource attribute. Test: CTS added in the topic Bug: 111439551 Change-Id: Ifbb52b39912ed0444030a86164290a1cd4155250
Diffstat (limited to 'libs/androidfw/AttributeResolution.cpp')
-rw-r--r--libs/androidfw/AttributeResolution.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/androidfw/AttributeResolution.cpp b/libs/androidfw/AttributeResolution.cpp
index 3dc1f2cd56c5..18d74efdbacf 100644
--- a/libs/androidfw/AttributeResolution.cpp
+++ b/libs/androidfw/AttributeResolution.cpp
@@ -286,6 +286,7 @@ void ApplyStyle(Theme* theme, ResXMLParser* xml_parser, uint32_t def_style_attr,
value.dataType = Res_value::TYPE_NULL;
value.data = Res_value::DATA_NULL_UNDEFINED;
config.density = 0;
+ uint32_t source_style_resid = 0;
// Try to find a value for this attribute... we prioritize values
// coming from, first XML attributes, then XML style, then default
@@ -309,6 +310,7 @@ void ApplyStyle(Theme* theme, ResXMLParser* xml_parser, uint32_t def_style_attr,
cookie = entry->cookie;
type_set_flags = style_flags;
value = entry->value;
+ source_style_resid = entry->style;
if (kDebugStyles) {
ALOGI("-> From style: type=0x%x, data=0x%08x, style=0x%08x", value.dataType, value.data,
entry->style);
@@ -325,8 +327,10 @@ void ApplyStyle(Theme* theme, ResXMLParser* xml_parser, uint32_t def_style_attr,
type_set_flags = def_style_flags;
value = entry->value;
if (kDebugStyles) {
- ALOGI("-> From def style: type=0x%x, data=0x%08x", value.dataType, value.data);
+ ALOGI("-> From def style: type=0x%x, data=0x%08x, style=0x%08x", value.dataType, value.data,
+ entry->style);
}
+ source_style_resid = entry->style;
}
}
@@ -382,6 +386,7 @@ void ApplyStyle(Theme* theme, ResXMLParser* xml_parser, uint32_t def_style_attr,
out_values[STYLE_RESOURCE_ID] = resid;
out_values[STYLE_CHANGING_CONFIGURATIONS] = type_set_flags;
out_values[STYLE_DENSITY] = config.density;
+ out_values[SYTLE_SOURCE_STYLE] = source_style_resid;
if (value.dataType != Res_value::TYPE_NULL || value.data == Res_value::DATA_NULL_EMPTY) {
indices_idx++;