summaryrefslogtreecommitdiff
path: root/libs/androidfw/AttributeResolution.cpp
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2020-11-13 18:06:15 -0800
committerRyan Mitchell <rtmitchell@google.com>2020-11-17 23:02:00 +0000
commit43d2f21d628504de69a5cb75e0f837169c029899 (patch)
treebeac6fe514645dbfe8a20f019071c24bb46329bc /libs/androidfw/AttributeResolution.cpp
parentdb21f09a8e02bcfd3fefea68084667688268f1fa (diff)
Set resource id correctly when resolve fails
If for some reason the resource id cannot be resolved to a value (there is no configuration that matches the AssetManager configuration or some error occurs), set the resource id of the SelectedValue to the resource id that could not be resolved. This was the behavior before the AssetManager IncFs hardening refactor. Bug: 173203252 Test: atest com.google.android.config.pts.PreinstalledAppsTestCase Test: Chrome icon appears on launcher Change-Id: Iad1760c0e246da1a4bf64d1c2ec60bb08da32d06
Diffstat (limited to 'libs/androidfw/AttributeResolution.cpp')
-rw-r--r--libs/androidfw/AttributeResolution.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/androidfw/AttributeResolution.cpp b/libs/androidfw/AttributeResolution.cpp
index 71919fdbb736..d07b452ad40e 100644
--- a/libs/androidfw/AttributeResolution.cpp
+++ b/libs/androidfw/AttributeResolution.cpp
@@ -265,7 +265,7 @@ base::expected<std::monostate, IOError> ApplyStyle(Theme* theme, ResXMLParser* x
const size_t xml_attr_idx = xml_attr_finder.Find(cur_ident);
if (xml_attr_idx != xml_attr_finder.end()) {
// We found the attribute we were looking for.
- Res_value attribute_value;
+ Res_value attribute_value{};
xml_parser->getAttributeValue(xml_attr_idx, &attribute_value);
value.type = attribute_value.dataType;
value.data = attribute_value.data;
@@ -377,7 +377,7 @@ base::expected<std::monostate, IOError> RetrieveAttributes(AssetManager2* assetm
// Retrieve the current XML attribute if it matches, and step to next.
if (ix < xml_attr_count && cur_ident == cur_xml_attr) {
- Res_value attribute_value;
+ Res_value attribute_value{};
xml_parser->getAttributeValue(ix, &attribute_value);
value.type = attribute_value.dataType;
value.data = attribute_value.data;