diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResConfigFlags.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResConfigFlags.java index de7e89bc..8f95ae03 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResConfigFlags.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResConfigFlags.java @@ -359,7 +359,7 @@ public class ResConfigFlags { ret.append(String.format("-%dx%d", screenHeight, screenWidth)); } } - if (sdkVersion > getNaturalSdkVersionRequirement()) { + if (sdkVersion > 0 && sdkVersion >= getNaturalSdkVersionRequirement()) { ret.append("-v").append(sdkVersion); } if (isInvalid) { diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java index ea86d2d4..9260900f 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/BuildAndDecodeTest.java @@ -277,6 +277,11 @@ public class BuildAndDecodeTest { compareResFolder("drawable-xxhdpi"); } + @Test + public void drawableQualifierXxhdpiTest() throws BrutException, IOException { + compareResFolder("drawable-xxhdpi-v4"); + } + @Test public void drawableXxxhdpiTest() throws BrutException, IOException { compareResFolder("drawable-xxxhdpi"); @@ -308,8 +313,7 @@ public class BuildAndDecodeTest { } @SuppressWarnings("unchecked") - private void compareUnknownFiles() - throws BrutException, IOException { + private void compareUnknownFiles() throws BrutException, IOException { Map control = new Androlib().readMetaFile(sTestOrigDir); Map test = new Androlib().readMetaFile(sTestNewDir); assertTrue(control.containsKey("unknownFiles")); @@ -320,13 +324,12 @@ public class BuildAndDecodeTest { assertTrue(control_files.size() == test_files.size()); // Make sure that the compression methods are still the same - for(Map.Entry controlEntry : control_files.entrySet()) { + for (Map.Entry controlEntry : control_files.entrySet()) { assertTrue(controlEntry.getValue().equals(test_files.get(controlEntry.getKey()))); } } - private void compareBinaryFolder(String path, boolean res) - throws BrutException, IOException { + private void compareBinaryFolder(String path, boolean res) throws BrutException, IOException { Boolean exists = true; String tmp = ""; @@ -374,8 +377,7 @@ public class BuildAndDecodeTest { assertTrue(f.isDirectory()); } - private void compareXmlFiles(String path, ElementQualifier qualifier) - throws BrutException { + private void compareXmlFiles(String path, ElementQualifier qualifier) throws BrutException { DetailedDiff diff; try { Reader control = new FileReader(new File(sTestOrigDir, path)); diff --git a/brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/drawable-xxhdpi-v4/ic_launcher.png b/brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/drawable-xxhdpi-v4/ic_launcher.png new file mode 100644 index 00000000..359047df Binary files /dev/null and b/brut.apktool/apktool-lib/src/test/resources/brut/apktool/testapp/res/drawable-xxhdpi-v4/ic_launcher.png differ