fix(res): update android resources to API 30
This commit is contained in:
@@ -4,7 +4,6 @@ plugins {
|
||||
|
||||
dependencies {
|
||||
runtimeOnly files('clsp-data/android-29-clst.jar')
|
||||
runtimeOnly files('clsp-data/android-29-res.jar')
|
||||
|
||||
api(project(':jadx-plugins:jadx-plugins-api'))
|
||||
|
||||
|
||||
Binary file not shown.
@@ -2,7 +2,6 @@ package jadx.core.xmlgen;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@@ -35,12 +34,10 @@ import jadx.core.xmlgen.entry.ValuesParser;
|
||||
*/
|
||||
|
||||
public class BinaryXMLParser extends CommonBinaryParser {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(BinaryXMLParser.class);
|
||||
private static final String ANDROID_R_STYLE_CLS = "android.R$style";
|
||||
|
||||
private static final boolean ATTR_NEW_LINE = false;
|
||||
|
||||
private final Map<Integer, String> styleMap = new HashMap<>();
|
||||
private final Map<Integer, String> resNames;
|
||||
private Map<String, String> nsMap;
|
||||
private Set<String> nsMapGenerated;
|
||||
@@ -62,7 +59,6 @@ public class BinaryXMLParser extends CommonBinaryParser {
|
||||
public BinaryXMLParser(RootNode rootNode) {
|
||||
this.rootNode = rootNode;
|
||||
try {
|
||||
readAndroidRStyleClass();
|
||||
ConstStorage constStorage = rootNode.getConstValues();
|
||||
resNames = constStorage.getResourcesNames();
|
||||
} catch (Exception e) {
|
||||
@@ -70,17 +66,6 @@ public class BinaryXMLParser extends CommonBinaryParser {
|
||||
}
|
||||
}
|
||||
|
||||
private void readAndroidRStyleClass() {
|
||||
try {
|
||||
Class<?> rStyleCls = Class.forName(ANDROID_R_STYLE_CLS);
|
||||
for (Field f : rStyleCls.getFields()) {
|
||||
styleMap.put(f.getInt(f.getType()), f.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Android R class loading failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized ICodeInfo parse(InputStream inputStream) throws IOException {
|
||||
is = new ParserStream(inputStream);
|
||||
if (!isBinaryXml()) {
|
||||
@@ -370,26 +355,21 @@ public class BinaryXMLParser extends CommonBinaryParser {
|
||||
String shortNsName, String attrName) {
|
||||
if (attrValDataType == TYPE_REFERENCE) {
|
||||
// reference custom processing
|
||||
String name = styleMap.get(attrValData);
|
||||
if (name != null) {
|
||||
writer.add("@style/").add(name.replace('_', '.'));
|
||||
String resName = resNames.get(attrValData);
|
||||
if (resName != null) {
|
||||
writer.add('@');
|
||||
if (resName.startsWith("id/")) {
|
||||
writer.add('+');
|
||||
}
|
||||
writer.add(resName);
|
||||
} else {
|
||||
String resName = resNames.get(attrValData);
|
||||
if (resName != null) {
|
||||
writer.add('@');
|
||||
if (resName.startsWith("id/")) {
|
||||
writer.add('+');
|
||||
}
|
||||
writer.add(resName);
|
||||
String androidResName = ValuesParser.getAndroidResMap().get(attrValData);
|
||||
if (androidResName != null) {
|
||||
writer.add("@android:").add(androidResName);
|
||||
} else if (attrValData == 0) {
|
||||
writer.add("@null");
|
||||
} else {
|
||||
resName = ValuesParser.getAndroidResMap().get(attrValData);
|
||||
if (resName != null) {
|
||||
writer.add("@android:").add(resName);
|
||||
} else if (attrValData == 0) {
|
||||
writer.add("@null");
|
||||
} else {
|
||||
writer.add("0x").add(Integer.toHexString(attrValData));
|
||||
}
|
||||
writer.add("0x").add(Integer.toHexString(attrValData));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user