Skip to content

Commit e0c45a4

Browse files
committed
Don't ask for ABI if we can reasonably infer CPU type
1 parent c7661f9 commit e0c45a4

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/processing/mode/android/SysImageDownloader.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public class SysImageDownloader extends JDialog implements PropertyChangeListene
7171
private static final String HAXM_INSTALL_TITLE = "Some words of caution...";
7272

7373
private static final String HAXM_INSTALL_MESSAGE =
74-
"You chose to run x86 images in the emulator. This is great but you need " +
75-
"to install the Intel Hardware Accelerated Execution Manager (Intel HAXM).<br><br>" +
74+
"Processing will install x86 images in the emulator. These images are fast, but " +
75+
"also need the Intel Hardware Accelerated Execution Manager (Intel HAXM).<br><br>" +
7676
"Processing will try to run the HAXM installer now, which may ask for your " +
7777
"administrator password or additional permissions.";
7878

@@ -417,7 +417,25 @@ public void run() {
417417
if (abi == null || askABI) {
418418
// Either there was no image architecture selected, or the default was set.
419419
// In this case, we give the user the option to choose between ARM and x86
420-
final int result = showSysImageMessage();
420+
421+
final int result;
422+
// PROCESSOR_IDENTIFIER is only defined on Windows. For cross-platform CPU
423+
// info, in the future we could use OSHI: https://github.com/oshi/oshi
424+
String procId = System.getenv("PROCESSOR_IDENTIFIER");
425+
if (procId != null) {
426+
if (-1 < procId.indexOf("Intel")) {
427+
// Intel CPU: we go for the x86 abi
428+
result = JOptionPane.YES_OPTION;
429+
} else {
430+
// Another CPU, can only be AMD, so we go for ARM abi
431+
result = JOptionPane.NO_OPTION;
432+
}
433+
} else if (Platform.isMacOS()) {
434+
// Macs only have Intel CPUs, so we also go for the x86 abi
435+
result = JOptionPane.YES_OPTION;
436+
} else {
437+
result = showSysImageMessage();
438+
}
421439
if (result == JOptionPane.YES_OPTION || result == JOptionPane.CLOSED_OPTION) {
422440
abi = "x86";
423441
installHAXM();

0 commit comments

Comments
 (0)