diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java index de053d7f..005143a5 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/Androlib.java @@ -284,21 +284,7 @@ public class Androlib { if (meta.sdkInfo != null && meta.sdkInfo.get("minSdkVersion") != null) { String minSdkVersion = meta.sdkInfo.get("minSdkVersion"); - - // Preview builds use short letter for API versions - switch (minSdkVersion) { - case "M": - mMinSdkVersion = ResConfigFlags.SDK_MNC; - break; - case "N": - mMinSdkVersion = ResConfigFlags.SDK_NOUGAT; - break; - case "O": - mMinSdkVersion = ResConfigFlags.SDK_O; - break; - default: - mMinSdkVersion = Integer.parseInt(meta.sdkInfo.get("minSdkVersion")); - } + mMinSdkVersion = getMinSdkVersionFromAndroidCodename(meta, minSdkVersion); } if (outFile == null) { @@ -739,6 +725,19 @@ public class Androlib { return files; } + private int getMinSdkVersionFromAndroidCodename(MetaInfo meta, String sdkVersion) { + switch (sdkVersion) { + case "M": + return ResConfigFlags.SDK_MNC; + case "N": + return ResConfigFlags.SDK_NOUGAT; + case "O": + return ResConfigFlags.SDK_O; + default: + return Integer.parseInt(meta.sdkInfo.get("minSdkVersion")); + } + } + private boolean isModified(File working, File stored) { return ! stored.exists() || BrutIO.recursiveModifiedTime(working) > BrutIO .recursiveModifiedTime(stored); }