提交 5f0dbf85 编写于 作者: T tRuNKator 提交者: skylot

fix: don't rename R class fields alias (PR #492)

* fix: R class fields alias
* implemented with clearer approach
上级 2e9039da
......@@ -11,6 +11,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import jadx.core.dex.attributes.AFlag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
......@@ -225,6 +226,8 @@ public class Deobfuscator {
clsInfo.rename(cls.dex().root(), fullName);
}
for (FieldNode field : cls.getFields()) {
if (field.contains(AFlag.DONT_RENAME))
continue;
renameField(field);
}
for (MethodNode mth : cls.getMethods()) {
......
......@@ -19,6 +19,7 @@ public enum AFlag {
DONT_SHRINK,
DONT_INLINE,
DONT_GENERATE,
DONT_RENAME, // do not rename during deobfuscation
SKIP,
REMOVE,
......
......@@ -6,6 +6,7 @@ import java.util.Map;
import java.util.TreeMap;
import com.android.dx.rop.code.AccessFlags;
import jadx.core.dex.attributes.AFlag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
......@@ -124,6 +125,7 @@ public class AndroidResourcesUtils {
if (fieldNode != null
&& !fieldNode.getName().equals(resName)
&& NameMapper.isValidIdentifier(resName)) {
fieldNode.add(AFlag.DONT_RENAME);
fieldNode.getFieldInfo().setAlias(resName);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册