From c8dc1917f47a3f9b4ef6026b912c2792b69e676a Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 27 Jan 2022 08:10:04 +0100 Subject: [PATCH] Do not restore power mode if --no-control This totally disables deferred cleanup when --no-control is passed. Refs f289d206ea0e10cc052137781c39da862ebe2f73 --- server/src/main/java/com/genymobile/scrcpy/Server.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index 68c6c02c..8cf289cd 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -19,6 +19,7 @@ public final class Server { private static void initAndCleanUp(Options options) { boolean mustDisableShowTouchesOnCleanUp = false; int restoreStayOn = -1; + boolean restoreNormalPowerMode = options.getControl(); // only restore power mode if control is enabled if (options.getShowTouches() || options.getStayAwake()) { Settings settings = Device.getSettings(); if (options.getShowTouches()) { @@ -51,7 +52,8 @@ public final class Server { } try { - CleanUp.configure(options.getDisplayId(), restoreStayOn, mustDisableShowTouchesOnCleanUp, true, options.getPowerOffScreenOnClose()); + CleanUp.configure(options.getDisplayId(), restoreStayOn, mustDisableShowTouchesOnCleanUp, restoreNormalPowerMode, + options.getPowerOffScreenOnClose()); } catch (IOException e) { Ln.e("Could not configure cleanup", e); }