Allow change of minSdkVersion via settings

This commit is contained in:
Nico Mexis 2021-08-11 22:42:09 +02:00
parent 63df81e378
commit 68383dca5e
No known key found for this signature in database
GPG key ID: 27D6E17CE092AB78
6 changed files with 33 additions and 11 deletions

View file

@ -163,7 +163,7 @@ public class SettingsSerializer
save("deprecated");
save("deprecated");
save("deprecated");
save(BytecodeViewer.viewer.fontSpinner.getValue());
save(BytecodeViewer.viewer.getFontSize());
save(Configuration.deleteForeignLibraries);
if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel()))
@ -200,6 +200,7 @@ public class SettingsSerializer
save(Configuration.lastPluginDirectory);
save(Configuration.python2Extra);
save(Configuration.python3Extra);
save(BytecodeViewer.viewer.getMinSdkVersion());
} catch (Exception e) {
BytecodeViewer.handleException(e);
}
@ -396,6 +397,7 @@ public class SettingsSerializer
Configuration.lastPluginDirectory = asString(138);
Configuration.python2Extra = asBoolean(139);
Configuration.python3Extra = asBoolean(140);
BytecodeViewer.viewer.minSdkVersionSpinner.setValue(asInt(141));
}
catch (IndexOutOfBoundsException e)
{
@ -426,4 +428,4 @@ public class SettingsSerializer
{
return Integer.parseInt(DiskReader.loadString(settingsName, lineNumber, false));
}
}
}

View file

@ -266,7 +266,11 @@ public class MainViewerGUI extends JFrame
public final JCheckBoxMenuItem recoveryTypehInts = new TranslatedJCheckBoxMenuItem("Recover Type Hints", TranslatedComponents.RECOVER_TYPE__HINTS);
public final JCheckBoxMenuItem forceTurningIFs = new TranslatedJCheckBoxMenuItem("Force Returning IFs", TranslatedComponents.FORCE_RETURNING_IFS);
public final JCheckBoxMenuItem forLoopAGGCapture = new TranslatedJCheckBoxMenuItem("For Loop AGG Capture", TranslatedComponents.FOR_LOOP_AGG_CAPTURE);
//Smali/D2Jar
public final JMenu minSdkVersionMenu = new TranslatedJMenu("Minimum SDK version", TranslatedComponents.MIN_SDK_VERSION);
public final JSpinner minSdkVersionSpinner = new JSpinner();
//obfuscation
public final JMenu obfuscate = new JMenu("Obfuscate");
public final JMenuItem renameFields = new JMenuItem("Rename Fields");
@ -611,6 +615,13 @@ public class MainViewerGUI extends JFrame
bytecodeDecompilerSettingsSecondaryMenu.add(appendBracketsToLabels);
bytecodeDecompilerSettingsDialog = new SettingsDialog(bytecodeDecompilerSettingsSecondaryMenu, new JPanel());
bytecodeDecompilerSettings.addActionListener((e)-> bytecodeDecompilerSettingsDialog.showDialog());
//Smali minSdkVersion
minSdkVersionSpinner.setPreferredSize(new Dimension(60, 24));
minSdkVersionSpinner.setMinimumSize(new Dimension(60, 24));
minSdkVersionSpinner.setModel(new SpinnerNumberModel(26, 1, null, 1));
minSdkVersionMenu.add(minSdkVersionSpinner);
settingsMainMenu.add(minSdkVersionMenu);
deleteForeignOutdatedLibs.addActionListener(arg0 -> showForeignLibraryWarning());
forcePureAsciiAsText.addActionListener(arg0 -> SettingsSerializer.saveSettingsAsync());
@ -798,6 +809,11 @@ public class MainViewerGUI extends JFrame
{
return (int) fontSpinner.getValue();
}
public int getMinSdkVersion()
{
return (int) minSdkVersionSpinner.getValue();
}
public synchronized void clearBusyStatus()
{
@ -968,4 +984,4 @@ public class MainViewerGUI extends JFrame
}
public static final long serialVersionUID = 1851409230530948543L;
}
}

View file

@ -250,6 +250,7 @@ public enum TranslatedComponents
DESC,
RESULTS,
REFRESH,
MIN_SDK_VERSION,
;
@ -265,4 +266,4 @@ public enum TranslatedComponents
{
return componentReference;
}
}
}

View file

@ -1,9 +1,8 @@
package the.bytecode.club.bytecodeviewer.util;
import com.googlecode.d2j.dex.Dex2jar;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import java.io.File;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -60,7 +59,9 @@ public class Dex2Jar {
public static synchronized void saveAsDex(File input, File output, boolean delete) {
try {
com.googlecode.dex2jar.tools.Jar2Dex.main(input.getAbsolutePath(), "-o", output.getAbsolutePath());
com.googlecode.dex2jar.tools.Jar2Dex.main(input.getAbsolutePath(),
"-o", output.getAbsolutePath(),
"-s", BytecodeViewer.viewer.getMinSdkVersion() + "");
if (delete)
input.delete();
} catch (Exception e) {

View file

@ -279,5 +279,6 @@
"SAVE": "Save...",
"SAVE_AS": "Save As...",
"RESULTS": "Results",
"REFRESH": "Refresh"
}
"REFRESH": "Refresh",
"MIN_SDK_VERSION": "Minimum SDK version"
}

View file

@ -254,5 +254,6 @@
"CLOSE_ALL_BUT_THIS": "Alle außer diesen schließen",
"CLOSE_TAB": "Tab schließen",
"PLEASE_SEND_THIS_ERROR_LOG_TO": "Bitte senden Sie dieses Fehlerprotokoll an",
"PLEASE_SEND_RESOURCES": "Wenn Sie entsprechende gesetzliche Rechte an der jeweiligen Klasse besitzen"
"PLEASE_SEND_RESOURCES": "Wenn Sie entsprechende gesetzliche Rechte an der jeweiligen Klasse besitzen",
"MIN_SDK_VERSION": "Minimale SDK-Version"
}