Added checking if array has string item.

This will resolve Contacts.apk and Camera.apk FC issue.
This commit is contained in:
Daehan Kim 2012-08-27 12:27:27 +09:00
parent cc2e973ba4
commit 67af608286

View File

@ -66,11 +66,24 @@ public class ResArrayValue extends ResBagValue implements ResValuesXmlSerializab
if (! "string".equals(type) && ! "integer".equals(type)) { if (! "string".equals(type) && ! "integer".equals(type)) {
return null; return null;
} }
boolean hasDifferentTypeItem = false;
for (int i = 1; i < mItems.length; i++) { for (int i = 1; i < mItems.length; i++) {
if (! type.equals(mItems[i].getType())) { String itemType = mItems[i].getType();
if (itemType.equals("string")) {
//If there is at least one string item in mixed bag, it must be string-array.
return "string";
} else if (!type.equals(itemType)) {
hasDifferentTypeItem = true;
}
}
if (hasDifferentTypeItem) {
return null; return null;
} }
}
return type; return type;
} }