From deb9dcf089ee184e30d22ba6537520c3f6316264 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Sat, 20 May 2023 15:06:36 -0400 Subject: [PATCH] fix: support `0_resource_name_obfuscated` (#3067) * fix: support `0_resource_name_obfuscated` * refactor: drop jdk9 for jdk8 logic --- .../main/java/brut/androlib/res/data/ResResSpec.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java index 32b4065f..e2441f2d 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResResSpec.java @@ -20,6 +20,9 @@ import brut.androlib.AndrolibException; import brut.androlib.err.UndefinedResObjectException; import org.apache.commons.lang3.StringUtils; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; @@ -31,12 +34,15 @@ public class ResResSpec { private final ResPackage mPackage; private final ResTypeSpec mType; private final Map mResources = new LinkedHashMap<>(); + private static final Set EMPTY_RESOURCE_NAMES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( + "0_resource_name_obfuscated", + "(name removed)" + ))); public ResResSpec(ResID id, String name, ResPackage pkg, ResTypeSpec type) { this.mId = id; String cleanName; - - name = (("(name removed)".equals(name)) ? null : name); + name = EMPTY_RESOURCE_NAMES.contains(name) ? null : name; ResResSpec resResSpec = type.getResSpecUnsafe(name); if (resResSpec != null) {