AAPT: Dump badging should pickup strings from the right package
A bug in the dump badging command caused strings to be looked up in the first loaded package only. Bug: 64948230 Bug: 65645766 Test: none Change-Id: Ia804777fe3f963004a5c053129ef6e0c94b7f6a3 Merged-In: Ia804777fe3f963004a5c053129ef6e0c94b7f6a3
This commit is contained in:
@@ -99,24 +99,40 @@ String8 getResolvedAttribute(const ResTable& resTable, const ResXMLTree& tree,
|
||||
if (idx < 0) {
|
||||
return String8();
|
||||
}
|
||||
|
||||
Res_value value;
|
||||
if (tree.getAttributeValue(idx, &value) != NO_ERROR) {
|
||||
if (value.dataType == Res_value::TYPE_STRING) {
|
||||
size_t len;
|
||||
const char16_t* str = tree.getAttributeStringValue(idx, &len);
|
||||
return str ? String8(str, len) : String8();
|
||||
}
|
||||
resTable.resolveReference(&value, 0);
|
||||
if (value.dataType != Res_value::TYPE_STRING) {
|
||||
if (outError != NULL) {
|
||||
*outError = "attribute is not a string value";
|
||||
}
|
||||
return String8();
|
||||
if (tree.getAttributeValue(idx, &value) == BAD_TYPE) {
|
||||
if (outError != NULL) {
|
||||
*outError = "attribute value is corrupt";
|
||||
}
|
||||
return String8();
|
||||
}
|
||||
|
||||
// Check if the string is inline in the XML.
|
||||
if (value.dataType == Res_value::TYPE_STRING) {
|
||||
size_t len;
|
||||
const char16_t* str = tree.getAttributeStringValue(idx, &len);
|
||||
return str ? String8(str, len) : String8();
|
||||
}
|
||||
|
||||
// Resolve the reference if there is one.
|
||||
ssize_t block = resTable.resolveReference(&value, 0);
|
||||
if (block < 0) {
|
||||
if (outError != NULL) {
|
||||
*outError = "attribute value reference does not exist";
|
||||
}
|
||||
return String8();
|
||||
}
|
||||
|
||||
if (value.dataType != Res_value::TYPE_STRING) {
|
||||
if (outError != NULL) {
|
||||
*outError = "attribute is not a string value";
|
||||
}
|
||||
return String8();
|
||||
}
|
||||
|
||||
size_t len;
|
||||
const Res_value* value2 = &value;
|
||||
const char16_t* str = resTable.valueToString(value2, 0, NULL, &len);
|
||||
const char16_t* str = resTable.valueToString(&value, static_cast<size_t>(block), NULL, &len);
|
||||
return str ? String8(str, len) : String8();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user