Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class ResEntrySpec {

public static final String DUMMY_PREFIX = "APKTOOL_DUMMY_";
public static final String MISSING_PREFIX = "APKTOOL_MISSING_";
public static final String RENAMED_PREFIX = "APKTOOL_RENAMED_";

private final ResTypeSpec mTypeSpec;
private final ResId mId;
Expand All @@ -40,10 +39,22 @@ public ResEntrySpec(ResTypeSpec typeSpec, ResId id, String name) {
assert typeSpec.getId() == id.getTypeId();
mTypeSpec = typeSpec;
mId = id;

// Some apps had their entry names collapsed to a single value in
// the key string pool. Rename to avoid duplicates.
if (name == null || name.isEmpty() || INVALID_ENTRY_NAMES.contains(name)) {
mName = RENAMED_PREFIX + id;
// || getTypeName().startsWith("^attr-private"))

if (name == null
|| name.isEmpty()
|| INVALID_ENTRY_NAMES.contains(name)) {

mName = getTypeName() + "_" + id;

} else if ("attr".equals(getTypeName())
&& Character.isDigit(name.charAt(0))) {

mName = getTypeName() + "_" + id; // attr_id

} else {
mName = name;
}
Expand Down Expand Up @@ -86,10 +97,6 @@ public boolean isMissing() {
return mName.startsWith(MISSING_PREFIX);
}

public boolean isRenamed() {
return mName.startsWith(RENAMED_PREFIX);
}

@Override
public String toString() {
return String.format("ResEntrySpec{typeSpec=%s, id=%s, name=%s}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public void serializeToValuesXml(XmlSerializer serial, ResEntry entry)
if (entry.getType().isBagType()) {
asItem = true;
}
if (asItem && "attr".equals(type)) {
asItem = false;
}

String tagName = asItem ? "item" : type;
serial.startTag(null, tagName);
Expand Down