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 f967f54ec8..88cded092d 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 @@ -18,7 +18,6 @@ import brut.androlib.AndrolibException; import brut.androlib.err.UndefinedResObjectException; -import brut.androlib.res.decoder.ARSCDecoder; import org.apache.commons.lang3.StringUtils; import java.util.LinkedHashMap; @@ -29,13 +28,11 @@ public class ResResSpec { private final ResID mId; private final String mName; - private final int mFlags; private final ResPackage mPackage; private final ResTypeSpec mType; private final Map mResources = new LinkedHashMap<>(); - public ResResSpec(ResID id, String name, int flags, ResPackage pkg, ResTypeSpec type) { - this.mFlags = flags; + public ResResSpec(ResID id, String name, ResPackage pkg, ResTypeSpec type) { this.mId = id; String cleanName; @@ -75,19 +72,13 @@ public boolean hasDefaultResource() { return mResources.containsKey(new ResConfigFlags()); } - public boolean isPublicResource() { - return (getFlags() & ARSCDecoder.ENTRY_FLAG_PUBLIC) != 0; - } - public String getFullName(ResPackage relativeToPackage, boolean excludeType) { return getFullName(getPackage().equals(relativeToPackage), excludeType); } public String getFullName(boolean excludePackage, boolean excludeType) { - String privateSuffix = isPublicResource() ? "" : "*"; - String packageName = excludePackage ? "" : getPackage().getName() + ":"; - return (packageName.isEmpty() ? "" : privateSuffix + packageName) - + (excludeType ? "" : getType().getName() + "/") + getName(); + return (excludePackage ? "" : getPackage().getName() + ":") + + (excludeType ? "" : getType().getName() + "/") + getName(); } public ResID getId() { @@ -106,10 +97,6 @@ public ResTypeSpec getType() { return mType; } - public int getFlags() { - return mFlags; - } - public boolean isDummyResSpec() { return getName().startsWith("APKTOOL_DUMMY_"); } diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java index 4ec0853e66..0b11dd5157 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java @@ -336,12 +336,12 @@ private void readEntry(EntryData entryData) throws AndrolibException { if (spec.isDummyResSpec()) { removeResSpec(spec); - spec = new ResResSpec(resId, mSpecNames.getString(specNamesId), entryData.mFlags, mPkg, mTypeSpec); + spec = new ResResSpec(resId, mSpecNames.getString(specNamesId), mPkg, mTypeSpec); mPkg.addResSpec(spec); mTypeSpec.addResSpec(spec); } } else { - spec = new ResResSpec(resId, mSpecNames.getString(specNamesId), entryData.mFlags, mPkg, mTypeSpec); + spec = new ResResSpec(resId, mSpecNames.getString(specNamesId), mPkg, mTypeSpec); mPkg.addResSpec(spec); mTypeSpec.addResSpec(spec); } @@ -538,7 +538,7 @@ private void addMissingResSpecs() throws AndrolibException { continue; } - ResResSpec spec = new ResResSpec(new ResID(resId | i), "APKTOOL_DUMMY_" + Integer.toHexString(i), ENTRY_FLAG_PUBLIC, mPkg, mTypeSpec); + ResResSpec spec = new ResResSpec(new ResID(resId | i), "APKTOOL_DUMMY_" + Integer.toHexString(i), mPkg, mTypeSpec); // If we already have this resID dont add it again. if (! mPkg.hasResSpec(new ResID(resId | i))) { @@ -602,7 +602,7 @@ private void nextChunkCheckType(int expectedType) throws IOException, AndrolibEx private final HashMap mResTypeSpecs = new HashMap<>(); private final static short ENTRY_FLAG_COMPLEX = 0x0001; - public final static short ENTRY_FLAG_PUBLIC = 0x0002; + private final static short ENTRY_FLAG_PUBLIC = 0x0002; private final static short ENTRY_FLAG_WEAK = 0x0004; public static class Header { diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/BuildAndDecodeTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/BuildAndDecodeTest.java index 214c6f97f2..f94462dfe3 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/BuildAndDecodeTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/BuildAndDecodeTest.java @@ -72,16 +72,6 @@ public void valuesStringsTest() throws BrutException { compareValuesFiles("values/strings.xml"); } - @Test - public void valuesColorsTest() throws BrutException { - compareValuesFiles("values/colors.xml"); - } - - @Test - public void valuesBoolsTest() throws BrutException { - compareValuesFiles("values/bools.xml"); - } - @Test public void valuesMaxLengthTest() throws BrutException { compareValuesFiles("values-es/strings.xml"); diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/res/values/bools.xml b/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/res/values/bools.xml deleted file mode 100644 index b36f3954aa..0000000000 --- a/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/res/values/bools.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - @*android:bool/config_enableActivityRecognitionHardwareOverlay - diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/res/values/colors.xml b/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/res/values/colors.xml deleted file mode 100644 index eb11a5b2b3..0000000000 --- a/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/res/values/colors.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - @*android:color/Indigo_700 -