fix: crash when decompiling framework-res.apk with a tag (regression) (#3193)

This commit is contained in:
Igor Eisberg 2023-07-22 16:21:19 +03:00 committed by GitHub
parent 79b2173b85
commit 24b0c3249d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 14 deletions

View File

@ -243,9 +243,6 @@ public class ResourcesDecoder {
break; break;
} }
mResTable.initApkInfo(mApkInfo, outDir); mResTable.initApkInfo(mApkInfo, outDir);
if (mConfig.frameworkTag != null) {
mApkInfo.usesFramework.tag = mConfig.frameworkTag;
}
} }
return mResTable; return mResTable;
} }

View File

@ -291,7 +291,7 @@ public class ResTable {
} }
private boolean isFrameworkApk() { private boolean isFrameworkApk() {
for (ResPackage pkg : listMainPackages()) { for (ResPackage pkg : mMainPackages) {
if (pkg.getId() > 0 && pkg.getId() < 64) { if (pkg.getId() > 0 && pkg.getId() < 64) {
return true; return true;
} }
@ -301,9 +301,7 @@ public class ResTable {
public void initApkInfo(ApkInfo apkInfo, File outDir) throws AndrolibException { public void initApkInfo(ApkInfo apkInfo, File outDir) throws AndrolibException {
apkInfo.isFrameworkApk = isFrameworkApk(); apkInfo.isFrameworkApk = isFrameworkApk();
if (!listFramePackages().isEmpty()) {
apkInfo.usesFramework = getUsesFramework(); apkInfo.usesFramework = getUsesFramework();
}
if (!mApkInfo.getSdkInfo().isEmpty()) { if (!mApkInfo.getSdkInfo().isEmpty()) {
updateSdkInfoFromResources(outDir); updateSdkInfoFromResources(outDir);
} }
@ -312,18 +310,15 @@ public class ResTable {
} }
private UsesFramework getUsesFramework() { private UsesFramework getUsesFramework() {
Set<ResPackage> pkgs = listFramePackages(); UsesFramework info = new UsesFramework();
Integer[] ids = new Integer[mFramePackages.size()];
Integer[] ids = new Integer[pkgs.size()];
int i = 0; int i = 0;
for (ResPackage pkg : pkgs) { for (ResPackage pkg : mFramePackages) {
ids[i++] = pkg.getId(); ids[i++] = pkg.getId();
} }
Arrays.sort(ids); Arrays.sort(ids);
UsesFramework info = new UsesFramework();
info.ids = Arrays.asList(ids); info.ids = Arrays.asList(ids);
info.tag = mConfig.frameworkTag;
return info; return info;
} }