mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-10 18:18:51 +00:00
Add --no-cleanup option
It might be useful not to cleanup on exit, for example to leave the screen turned off, or keep the server binary on the device (via the server option "cleanup=false"). Fixes #1764 <https://github.com/Genymobile/scrcpy/issues/1764> PR #3020 <https://github.com/Genymobile/scrcpy/pull/3020>
This commit is contained in:
parent
bb991f829c
commit
ccbe370cc5
9 changed files with 46 additions and 5 deletions
|
@ -21,6 +21,7 @@ public class Options {
|
|||
private boolean powerOffScreenOnClose;
|
||||
private boolean clipboardAutosync = true;
|
||||
private boolean downsizeOnError = true;
|
||||
private boolean cleanup = true;
|
||||
|
||||
// Options not used by the scrcpy client, but useful to use scrcpy-server directly
|
||||
private boolean sendDeviceMeta = true; // send device name and size
|
||||
|
@ -155,6 +156,14 @@ public class Options {
|
|||
this.downsizeOnError = downsizeOnError;
|
||||
}
|
||||
|
||||
public boolean getCleanup() {
|
||||
return cleanup;
|
||||
}
|
||||
|
||||
public void setCleanup(boolean cleanup) {
|
||||
this.cleanup = cleanup;
|
||||
}
|
||||
|
||||
public boolean getSendDeviceMeta() {
|
||||
return sendDeviceMeta;
|
||||
}
|
||||
|
|
|
@ -51,11 +51,13 @@ public final class Server {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
CleanUp.configure(options.getDisplayId(), restoreStayOn, mustDisableShowTouchesOnCleanUp, restoreNormalPowerMode,
|
||||
options.getPowerOffScreenOnClose());
|
||||
} catch (IOException e) {
|
||||
Ln.e("Could not configure cleanup", e);
|
||||
if (options.getCleanup()) {
|
||||
try {
|
||||
CleanUp.configure(options.getDisplayId(), restoreStayOn, mustDisableShowTouchesOnCleanUp, restoreNormalPowerMode,
|
||||
options.getPowerOffScreenOnClose());
|
||||
} catch (IOException e) {
|
||||
Ln.e("Could not configure cleanup", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,6 +245,10 @@ public final class Server {
|
|||
boolean downsizeOnError = Boolean.parseBoolean(value);
|
||||
options.setDownsizeOnError(downsizeOnError);
|
||||
break;
|
||||
case "cleanup":
|
||||
boolean cleanup = Boolean.parseBoolean(value);
|
||||
options.setCleanup(cleanup);
|
||||
break;
|
||||
case "send_device_meta":
|
||||
boolean sendDeviceMeta = Boolean.parseBoolean(value);
|
||||
options.setSendDeviceMeta(sendDeviceMeta);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue