diff --git a/server/src/main/java/com/genymobile/scrcpy/CleanUp.java b/server/src/main/java/com/genymobile/scrcpy/CleanUp.java index d0ea141b19..b533fb1025 100644 --- a/server/src/main/java/com/genymobile/scrcpy/CleanUp.java +++ b/server/src/main/java/com/genymobile/scrcpy/CleanUp.java @@ -1,5 +1,7 @@ package com.genymobile.scrcpy; +import android.view.KeyEvent; + import com.genymobile.scrcpy.wrappers.ContentProvider; import com.genymobile.scrcpy.wrappers.ServiceManager; @@ -78,7 +80,10 @@ public static void main(String... args) { if (restoreNormalPowerMode) { Ln.i("Restoring normal power mode"); - Device.setScreenPowerMode(Device.POWER_MODE_NORMAL); + Device device = new Device(new Options()); + if(device.isScreenOn()){ + Device.setScreenPowerMode(Device.POWER_MODE_NORMAL); + } } } }