fix: improve resource type detection and remove deprecated method
This commit is contained in:
@@ -143,11 +143,6 @@ public class JadxWrapper {
|
||||
return decompiler.getResources();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public File getOpenFile() {
|
||||
return openPaths.get(0).toFile();
|
||||
}
|
||||
|
||||
public List<Path> getOpenPaths() {
|
||||
return openPaths;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.android.apksig.ApkVerifier;
|
||||
|
||||
import jadx.api.ResourceFile;
|
||||
import jadx.api.ResourceType;
|
||||
import jadx.gui.JadxWrapper;
|
||||
import jadx.gui.utils.CertificateManager;
|
||||
import jadx.gui.utils.NLS;
|
||||
@@ -33,11 +35,20 @@ public class ApkSignature extends JNode {
|
||||
public static ApkSignature getApkSignature(JadxWrapper wrapper) {
|
||||
// Only show the ApkSignature node if an AndroidManifest.xml is present.
|
||||
// Without a manifest the Google ApkVerifier refuses to work.
|
||||
if (wrapper.getResources().stream().noneMatch(r -> "AndroidManifest.xml".equals(r.getOriginalName()))) {
|
||||
File apkFile = null;
|
||||
for (ResourceFile resFile : wrapper.getResources()) {
|
||||
if (resFile.getType() == ResourceType.MANIFEST) {
|
||||
ResourceFile.ZipRef zipRef = resFile.getZipRef();
|
||||
if (zipRef != null) {
|
||||
apkFile = zipRef.getZipFile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (apkFile == null) {
|
||||
return null;
|
||||
}
|
||||
File openFile = wrapper.getOpenFile();
|
||||
return new ApkSignature(openFile);
|
||||
return new ApkSignature(apkFile);
|
||||
}
|
||||
|
||||
public ApkSignature(File openFile) {
|
||||
|
||||
Reference in New Issue
Block a user