mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-06 10:05:54 +01:00
abstracted unknown files out of resources, to remove dependencies on ResTable
This commit is contained in:
parent
0736aac013
commit
b5dcce3738
@ -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) {
|
||||
|
||||
|
@ -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<String, Object> meta)
|
||||
throws AndrolibException {
|
||||
Map<String,String> info = getResTable().getUnknownFiles();
|
||||
Map<String,String> info = mAndrolib.mResUnknownFiles.getUnknownFiles();
|
||||
if (info.size() > 0) {
|
||||
meta.put("unknownFiles", info);
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ public class ResTable {
|
||||
|
||||
private Map<String, String> mSdkInfo = new LinkedHashMap<String, String>();
|
||||
private Map<String, String> mVersionInfo = new LinkedHashMap<String, String>();
|
||||
private Map<String, String> mUnknownFiles = new LinkedHashMap<String, String>();
|
||||
|
||||
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<String, String> getVersionInfo() {
|
||||
return mVersionInfo;
|
||||
}
|
||||
@ -182,10 +177,6 @@ public class ResTable {
|
||||
return mAnalysisMode;
|
||||
}
|
||||
|
||||
public Map<String, String> getUnknownFiles() {
|
||||
return mUnknownFiles;
|
||||
}
|
||||
|
||||
public String getPackageRenamed() {
|
||||
return mPackageRenamed;
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright 2011 Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||
*
|
||||
* 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 <connor.tumbleson@gmail.com>
|
||||
*/
|
||||
public class ResUnknownFiles {
|
||||
|
||||
private final Map<String, String> mUnknownFiles = new LinkedHashMap<String, String>();
|
||||
|
||||
public void addUnknownFileInfo(String file, String value) {
|
||||
mUnknownFiles.put(file,value);
|
||||
}
|
||||
|
||||
public Map<String, String> getUnknownFiles() {
|
||||
return mUnknownFiles;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user