Skip to content

Commit

Permalink
Move init and cleanup to a separate method
Browse files Browse the repository at this point in the history
  • Loading branch information
rom1v committed Nov 17, 2021
1 parent d8358ce commit 3cc0921
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions server/src/main/java/com/genymobile/scrcpy/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ private Server() {
// not instantiable
}

private static void scrcpy(Options options) throws IOException {
Ln.i("Device: " + Build.MANUFACTURER + " " + Build.MODEL + " (Android " + Build.VERSION.RELEASE + ")");
final Device device = new Device(options);
List<CodecOption> codecOptions = CodecOption.parse(options.getCodecOptions());

private static void initAndCleanUp(Options options) throws IOException {
boolean mustDisableShowTouchesOnCleanUp = false;
int restoreStayOn = -1;
if (options.getShowTouches() || options.getStayAwake()) {
Expand Down Expand Up @@ -56,6 +52,14 @@ private static void scrcpy(Options options) throws IOException {
}

CleanUp.configure(options.getDisplayId(), restoreStayOn, mustDisableShowTouchesOnCleanUp, true, options.getPowerOffScreenOnClose());
}

private static void scrcpy(Options options) throws IOException {
Ln.i("Device: " + Build.MANUFACTURER + " " + Build.MODEL + " (Android " + Build.VERSION.RELEASE + ")");
final Device device = new Device(options);
List<CodecOption> codecOptions = CodecOption.parse(options.getCodecOptions());

initAndCleanUp(options);

boolean tunnelForward = options.isTunnelForward();

Expand Down

0 comments on commit 3cc0921

Please sign in to comment.