Skip to content

Commit 58d859d

Browse files
committed
don't ask AVD arch if already installed
1 parent c7b1139 commit 58d859d

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

src/processing/mode/android/AVD.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,12 @@ static public boolean ensureProperAVD(final Frame window, final AndroidMode mode
477477
return false;
478478
}
479479
if (!avd.hasImages(sdk)) {
480-
boolean res = AndroidSDK.locateSysImage(window, mode, wear);
480+
// Check that the AVD for the other kind of device has been already
481+
// downloaded, and if so, the downloader should not ask for an
482+
// ABI again.
483+
AVD other = wear ? phoneAVD : watchAVD;
484+
boolean ask = !other.hasImages(sdk);
485+
boolean res = AndroidSDK.locateSysImage(window, mode, wear, ask);
481486
if (!res) {
482487
return false;
483488
} else {

src/processing/mode/android/AndroidBuild.java

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
import processing.app.Sketch;
3232
import processing.app.SketchException;
3333
import processing.app.Util;
34-
import processing.app.exec.ProcessHelper;
35-
import processing.app.exec.ProcessResult;
3634
import processing.core.PApplet;
3735
import processing.mode.java.JavaBuild;
3836
import processing.mode.java.preproc.SurfaceInfo;

src/processing/mode/android/AndroidSDK.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,11 @@ static public AndroidSDK locate(final Frame window, final AndroidMode androidMod
478478
}
479479

480480
static public boolean locateSysImage(final Frame window,
481-
final AndroidMode androidMode, boolean wear)
481+
final AndroidMode androidMode, final boolean wear, final boolean ask)
482482
throws BadSDKException, CancelException, IOException {
483483
final int result = showDownloadSysImageDialog(window, wear);
484484
if (result == JOptionPane.YES_OPTION) {
485-
return downloadSysImage(window, androidMode, wear);
485+
return downloadSysImage(window, androidMode, wear, ask);
486486
} else if (result == JOptionPane.NO_OPTION) {
487487
return false;
488488
} else {
@@ -514,9 +514,9 @@ static public AndroidSDK download(final Frame editor, final AndroidMode androidM
514514
}
515515

516516
static public boolean downloadSysImage(final Frame editor,
517-
final AndroidMode androidMode, final boolean wear)
517+
final AndroidMode androidMode, final boolean wear, final boolean ask)
518518
throws BadSDKException, CancelException {
519-
final SysImageDownloader downloader = new SysImageDownloader(editor, wear);
519+
final SysImageDownloader downloader = new SysImageDownloader(editor, wear, ask);
520520
downloader.run(); // This call blocks until the SDK download complete, or user cancels.
521521

522522
if (downloader.cancelled()) {
@@ -704,9 +704,9 @@ public ProcessResult runADB(final String... cmd)
704704
adbCmd = cmd;
705705
}
706706
// printing this here to see if anyone else is killing the adb server
707-
// if (processing.app.Base.DEBUG) {
707+
if (processing.app.Base.DEBUG) {
708708
PApplet.printArray(adbCmd);
709-
// }
709+
}
710710
try {
711711
ProcessResult adbResult = new ProcessHelper(adbCmd).execute();
712712
// Ignore messages about starting up an adb daemon

src/processing/mode/android/SysImageDownloader.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public class SysImageDownloader extends JDialog implements PropertyChangeListene
112112
private Frame editor;
113113
private boolean result;
114114
private boolean wear;
115+
private boolean askABI;
115116
private String abi;
116117
private boolean cancelled;
117118

@@ -400,10 +401,11 @@ public void hyperlinkUpdate(HyperlinkEvent e) {
400401
}
401402
}
402403

403-
public SysImageDownloader(Frame editor, boolean wear) {
404+
public SysImageDownloader(Frame editor, boolean wear, boolean ask) {
404405
super(editor, "System image download", true);
405406
this.editor = editor;
406407
this.wear = wear;
408+
this.askABI = ask;
407409
this.result = false;
408410
createLayout();
409411
}
@@ -412,7 +414,7 @@ public void run() {
412414
cancelled = false;
413415

414416
abi = Preferences.get("android.emulator.image.abi");
415-
if (abi == null || abi.equals(AVD.DEFAULT_ABI)) {
417+
if (abi == null || askABI) {
416418
// Either there was no image architecture selected, or the default was set.
417419
// In this case, we give the user the option to choose between ARM and x86
418420
final int result = showSysImageMessage();

0 commit comments

Comments
 (0)