fix: don't rename R class fields alias (PR #492)
* fix: R class fields alias * implemented with clearer approach
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user