Do not restore power mode if --no-control

This totally disables deferred cleanup when --no-control is passed.

Refs f289d206ea
This commit is contained in:
Romain Vimont 2022-01-27 08:10:04 +01:00
parent 9d2e00697e
commit c8dc1917f4
1 changed files with 3 additions and 1 deletions

View File

@ -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);
}