Skip to content

Commit

Permalink
[FIXED JENKINS-34152] Fix NPE when trying to unlock named emulators.
Browse files Browse the repository at this point in the history
  • Loading branch information
orrc committed Apr 11, 2016
1 parent 044284e commit 13c40bb
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -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
Expand Down

0 comments on commit 13c40bb

Please sign in to comment.