Permalink
Browse files

[FIXED JENKINS-34152] Fix NPE when trying to unlock named emulators.

  • Loading branch information...
orrc committed Apr 11, 2016
1 parent 044284e commit 13c40bb04725ac8d1d8bc11e10a0ce18acc6795a
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/main/java/hudson/plugins/android_emulator/AndroidEmulator.java
@@ -433,14 +433,14 @@ else if (!emulatorAlreadyExists || emuConfig.shouldWipeData() || snapshotState =
final long adbTimeout = BOOT_COMPLETE_TIMEOUT_MS / 16;
final String keyEventTemplate = String.format("-s %s shell input keyevent %%d", emu.serial());
final String unlockArgs;
if (emuConfig.getOsVersion().getSdkLevel() < 23) {
unlockArgs = String.format(keyEventTemplate, 82);
} else {
if (emuConfig.getOsVersion() != null && emuConfig.getOsVersion().getSdkLevel() >= 23) {
// Android 6.0 introduced a command to dismiss the keyguard on unsecured devices
unlockArgs = String.format("-s %s shell wm dismiss-keyguard", emu.serial());
} else {
unlockArgs = String.format(keyEventTemplate, 82);
}
ArgumentListBuilder menuCmd = emu.getToolCommand(Tool.ADB, unlockArgs);
Proc proc = emu.getProcStarter(menuCmd).start();
ArgumentListBuilder unlockCmd = emu.getToolCommand(Tool.ADB, unlockArgs);
Proc proc = emu.getProcStarter(unlockCmd).start();
proc.joinWithTimeout(adbTimeout, TimeUnit.MILLISECONDS, emu.launcher().getListener());

// If a named emulator already existed, it may not have been booted yet, so the screen

0 comments on commit 13c40bb

Please sign in to comment.