Skip to content

Commit

Permalink
fix: crash when decompiling framework-res.apk with a tag (regression) (
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorEisberg authored Jul 22, 2023
1 parent 79b2173 commit 24b0c32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@ public ResTable decodeResources(File outDir) throws AndrolibException {
break;
}
mResTable.initApkInfo(mApkInfo, outDir);
if (mConfig.frameworkTag != null) {
mApkInfo.usesFramework.tag = mConfig.frameworkTag;
}
}
return mResTable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public boolean getSparseResources() {
}

private boolean isFrameworkApk() {
for (ResPackage pkg : listMainPackages()) {
for (ResPackage pkg : mMainPackages) {
if (pkg.getId() > 0 && pkg.getId() < 64) {
return true;
}
Expand All @@ -301,9 +301,7 @@ private boolean isFrameworkApk() {

public void initApkInfo(ApkInfo apkInfo, File outDir) throws AndrolibException {
apkInfo.isFrameworkApk = isFrameworkApk();
if (!listFramePackages().isEmpty()) {
apkInfo.usesFramework = getUsesFramework();
}
apkInfo.usesFramework = getUsesFramework();
if (!mApkInfo.getSdkInfo().isEmpty()) {
updateSdkInfoFromResources(outDir);
}
Expand All @@ -312,18 +310,15 @@ public void initApkInfo(ApkInfo apkInfo, File outDir) throws AndrolibException {
}

private UsesFramework getUsesFramework() {
Set<ResPackage> pkgs = listFramePackages();

Integer[] ids = new Integer[pkgs.size()];
UsesFramework info = new UsesFramework();
Integer[] ids = new Integer[mFramePackages.size()];
int i = 0;
for (ResPackage pkg : pkgs) {
for (ResPackage pkg : mFramePackages) {
ids[i++] = pkg.getId();
}
Arrays.sort(ids);

UsesFramework info = new UsesFramework();
info.ids = Arrays.asList(ids);

info.tag = mConfig.frameworkTag;
return info;
}

Expand Down

0 comments on commit 24b0c32

Please sign in to comment.