Handle setAnalysisMode properly

This commit is contained in:
IgorEisberg 2021-07-03 22:17:00 +03:00
parent bb42159880
commit 992de66bac
2 changed files with 4 additions and 9 deletions

View File

@ -149,7 +149,7 @@ public class Main {
decoder.setFrameworkDir(cli.getOptionValue("p"));
}
if (cli.hasOption("m") || cli.hasOption("match-original")) {
decoder.setAnalysisMode(true, false);
decoder.setAnalysisMode(true);
}
if (cli.hasOption("api") || cli.hasOption("api-level")) {
decoder.setApiLevel(Integer.parseInt(cli.getOptionValue("api")));

View File

@ -103,7 +103,6 @@ public class ApkDecoder {
mAndrolib.decodeResourcesRaw(mApkFile, outDir);
if (mForceDecodeManifest == FORCE_DECODE_MANIFEST_FULL) {
setTargetSdkVersion();
setAnalysisMode(mAnalysisMode, true);
// done after raw decoding of resources because copyToDir overwrites dest files
if (hasManifest()) {
@ -113,7 +112,6 @@ public class ApkDecoder {
break;
case DECODE_RESOURCES_FULL:
setTargetSdkVersion();
setAnalysisMode(mAnalysisMode, true);
if (hasManifest()) {
mAndrolib.decodeManifestWithResources(mApkFile, outDir, getResTable());
@ -216,14 +214,10 @@ public class ApkDecoder {
mDecodeAssets = mode;
}
public void setAnalysisMode(boolean mode, boolean pass) throws AndrolibException{
public void setAnalysisMode(boolean mode) {
mAnalysisMode = mode;
// only set mResTable, once it exists
if (pass) {
if (mResTable == null) {
mResTable = getResTable();
}
if (mResTable != null) {
mResTable.setAnalysisMode(mode);
}
}
@ -268,6 +262,7 @@ public class ApkDecoder {
"Apk doesn't contain either AndroidManifest.xml file or resources.arsc file");
}
mResTable = mAndrolib.getResTable(mApkFile, hasResources);
mResTable.setAnalysisMode(mAnalysisMode);
}
return mResTable;
}