From 38940ffe892cab44a05d727be26b7a71e725bdba Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 9 Aug 2020 17:09:32 +0200 Subject: [PATCH] Revert "Inject WAKEUP instead of POWER" WAKEUP does not work on some devices. Fixes #1655 This reverts commit 322f1512ea806611eb37f508cd952bbbc050f853. --- .../src/main/java/com/genymobile/scrcpy/Controller.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Controller.java b/server/src/main/java/com/genymobile/scrcpy/Controller.java index 2ad26a95..9100a9db 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Controller.java +++ b/server/src/main/java/com/genymobile/scrcpy/Controller.java @@ -55,10 +55,10 @@ public class Controller { public void control() throws IOException { // on start, power on the device if (!device.isScreenOn()) { - device.injectKeycode(KeyEvent.KEYCODE_WAKEUP); + device.injectKeycode(KeyEvent.KEYCODE_POWER); // dirty hack - // After the keycode is injected, the device is powered on asynchronously. + // After POWER is injected, the device is powered on asynchronously. // To turn the device screen off while mirroring, the client will send a message that // would be handled before the device is actually powered on, so its effect would // be "canceled" once the device is turned back on. @@ -248,8 +248,8 @@ public class Controller { } private boolean pressBackOrTurnScreenOn() { - int keycode = device.isScreenOn() ? KeyEvent.KEYCODE_BACK : KeyEvent.KEYCODE_WAKEUP; - if (keepPowerModeOff && keycode == KeyEvent.KEYCODE_WAKEUP) { + int keycode = device.isScreenOn() ? KeyEvent.KEYCODE_BACK : KeyEvent.KEYCODE_POWER; + if (keepPowerModeOff && keycode == KeyEvent.KEYCODE_POWER) { schedulePowerModeOff(); } return device.injectKeycode(keycode);