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 95185606..a566e1b5 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 @@ -20,6 +20,8 @@ import brut.androlib.java.AndrolibJava; import brut.androlib.res.AndrolibResources; import brut.androlib.res.data.ResPackage; import brut.androlib.res.data.ResTable; +import brut.androlib.res.data.ResUnknownFiles; +import brut.androlib.res.decoder.ResFileDecoder; import brut.androlib.res.util.ExtFile; import brut.androlib.src.SmaliBuilder; import brut.androlib.src.SmaliDecoder; @@ -44,6 +46,7 @@ import org.yaml.snakeyaml.Yaml; */ public class Androlib { private final AndrolibResources mAndRes = new AndrolibResources(); + protected final ResUnknownFiles mResUnknownFiles = new ResUnknownFiles(); public ResTable getResTable(ExtFile apkFile) throws AndrolibException { return mAndRes.getResTable(apkFile, true); @@ -172,7 +175,7 @@ public class Androlib { // lets record the name of the file, and its compression type // so that we may re-include it the same way if (invZipFile != null) { - resTable.addUnknownFileInfo(invZipFile.getName(), String.valueOf(invZipFile.getMethod())); + mResUnknownFiles.addUnknownFileInfo(invZipFile.getName(), String.valueOf(invZipFile.getMethod())); } } catch (NullPointerException ignored) { diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java index f0a32f8b..b69bcaab 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java @@ -21,6 +21,7 @@ import brut.androlib.err.OutDirExistsException; import brut.androlib.res.AndrolibResources; import brut.androlib.res.data.ResPackage; import brut.androlib.res.data.ResTable; +import brut.androlib.res.data.ResUnknownFiles; import brut.androlib.res.util.ExtFile; import brut.common.BrutException; import brut.directory.DirectoryException; @@ -340,7 +341,7 @@ public class ApkDecoder { private void putUnknownInfo(Map meta) throws AndrolibException { - Map info = getResTable().getUnknownFiles(); + Map info = mAndrolib.mResUnknownFiles.getUnknownFiles(); if (info.size() > 0) { meta.put("unknownFiles", info); } diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java index e55ded7c..6d0eff3c 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResTable.java @@ -41,7 +41,6 @@ public class ResTable { private Map mSdkInfo = new LinkedHashMap(); private Map mVersionInfo = new LinkedHashMap(); - private Map mUnknownFiles = new LinkedHashMap(); public ResTable() { mAndRes = null; @@ -166,10 +165,6 @@ public class ResTable { mVersionInfo.put(key, value); } - public void addUnknownFileInfo(String file, String value) { - mUnknownFiles.put(file,value); - } - public Map getVersionInfo() { return mVersionInfo; } @@ -182,10 +177,6 @@ public class ResTable { return mAnalysisMode; } - public Map getUnknownFiles() { - return mUnknownFiles; - } - public String getPackageRenamed() { return mPackageRenamed; } diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResUnknownFiles.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResUnknownFiles.java new file mode 100644 index 00000000..7518c16a --- /dev/null +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResUnknownFiles.java @@ -0,0 +1,35 @@ +/** + * Copyright 2011 Ryszard Wiśniewski + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package brut.androlib.res.data; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @author Connor Tumbleson + */ +public class ResUnknownFiles { + + private final Map mUnknownFiles = new LinkedHashMap(); + + public void addUnknownFileInfo(String file, String value) { + mUnknownFiles.put(file,value); + } + + public Map getUnknownFiles() { + return mUnknownFiles; + } +}