Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1package com.genymobile.scrcpy;
2
3import com.genymobile.scrcpy.device.Device;
4import com.genymobile.scrcpy.util.Ln;
5import com.genymobile.scrcpy.util.Settings;
6import com.genymobile.scrcpy.util.SettingsException;
7
8import android.os.BatteryManager;
9
10import java.io.File;
11import java.io.IOException;
12import java.io.OutputStream;
13
14/**
15 * Handle the cleanup of scrcpy, even if the main process is killed.
…lines 16–159 unchanged (144 lines)
160 } catch (Exception e) {
161 Ln.e("Could not unlink server", e);
162 }
163 }
164
165 public static void main(String... args) {
166 unlinkSelf();
167
168 int displayId = Integer.parseInt(args[0]);
169 int restoreStayOn = Integer.parseInt(args[1]);
170 boolean disableShowTouches = Boolean.parseBoolean(args[2]);
171 boolean powerOffScreen = Boolean.parseBoolean(args[3]);
172 int restoreScreenOffTimeout = Integer.parseInt(args[4]);
…lines 173–233 unchanged (61 lines)

After

1package com.genymobile.scrcpy;
2
3import com.genymobile.scrcpy.device.Device;
4import com.genymobile.scrcpy.util.Ln;
5import com.genymobile.scrcpy.util.Settings;
6import com.genymobile.scrcpy.util.SettingsException;
7
8import android.os.BatteryManager;
9import android.system.ErrnoException;
10import android.system.Os;
11
12import java.io.File;
13import java.io.IOException;
14import java.io.OutputStream;
15
16/**
…lines 17–161 unchanged (145 lines)
162 } catch (Exception e) {
163 Ln.e("Could not unlink server", e);
164 }
165 }
166
167 public static void main(String... args) {
168 try {
169 // Start a new session to avoid being terminated along with the server process on some devices
170 Os.setsid();
171 } catch (ErrnoException e) {
172 Ln.e("setsid() failed", e);
173 }
174 unlinkSelf();
175
176 int displayId = Integer.parseInt(args[0]);
177 int restoreStayOn = Integer.parseInt(args[1]);
178 boolean disableShowTouches = Boolean.parseBoolean(args[2]);
179 boolean powerOffScreen = Boolean.parseBoolean(args[3]);
…lines 180–241 unchanged (62 lines)

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "device"
. "."
identifier "Device"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "util"
. "."
identifier "Ln"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "util"
. "."
identifier "Settings"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "util"
. "."
identifier "SettingsException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "os"
. "."
identifier "BatteryManager"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "File"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "OutputStream"
; ";"
block_comment "/**\n * Handle the cleanup of scrcpy, even if the main proces"...
class_declaration
modifiers
public "public"
final "final"
class "class"
identifier "CleanUp"
class_body
{ "{"
line_comment "// Dynamic options"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
int "int"
variable_declarator
identifier "PENDING_CHANGE_DISPLAY_POWER"
= "="
binary_expression
decimal_integer_literal "1"
<< "<<"
decimal_integer_literal "0"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "pendingChanges"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "pendingRestoreDisplayPower"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Thread"
variable_declarator
identifier "thread"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "interrupted"
; ";"
constructor_declaration (+49 nodes collapsed)
method_declaration (+25 nodes collapsed)
method_declaration (+26 nodes collapsed)
method_declaration (+23 nodes collapsed)
method_declaration (+508 nodes collapsed)
method_declaration (+332 nodes collapsed)
method_declaration (+34 nodes collapsed)
method_declaration (+61 nodes collapsed)
method_declaration
modifiers
public "public"
static "static"
void_type "void"
identifier "main"
formal_parameters
( "("
spread_parameter
type_identifier "String"
... "..."
variable_declarator
identifier "args"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "unlinkSelf"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "displayId"
= "="
method_invocation
identifier "Integer"
. "."
identifier "parseInt"
argument_list
( "("
array_access
identifier "args"
[ "["
decimal_integer_literal "0"
] "]"
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "restoreStayOn"
= "="
method_invocation
identifier "Integer"
. "."
identifier "parseInt"
argument_list
( "("
array_access
identifier "args"
[ "["
decimal_integer_literal "1"
] "]"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "disableShowTouches"
= "="
method_invocation
identifier "Boolean"
. "."
identifier "parseBoolean"
argument_list
( "("
array_access
identifier "args"
[ "["
decimal_integer_literal "2"
] "]"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "powerOffScreen"
= "="
method_invocation
identifier "Boolean"
. "."
identifier "parseBoolean"
argument_list
( "("
array_access
identifier "args"
[ "["
decimal_integer_literal "3"
] "]"
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "restoreScreenOffTimeout"
= "="
method_invocation
identifier "Integer"
. "."
identifier "parseInt"
argument_list
( "("
array_access
identifier "args"
[ "["
decimal_integer_literal "4"
] "]"
) ")"
; ";"
line_comment "// Dynamic option"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "restoreDisplayPower"
= "="
false "false"
; ";"
try_statement (+76 nodes collapsed)
expression_statement
method_invocation
identifier "Ln"
. "."
identifier "i"
argument_list
( "("
string_literal
" "\""
string_fragment "Cleaning up"
" "\""
) ")"
; ";"
if_statement (+82 nodes collapsed)
if_statement (+91 nodes collapsed)
if_statement (+91 nodes collapsed)
line_comment "// Change the power of the main display when mirroring a vir"...
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "targetDisplayId"
= "="
ternary_expression
binary_expression
identifier "displayId"
!= "!="
field_access
identifier "Device"
. "."
identifier "DISPLAY_ID_NONE"
? "?"
identifier "displayId"
: ":"
decimal_integer_literal "0"
; ";"
if_statement (+83 nodes collapsed)
expression_statement
method_invocation
identifier "System"
. "."
identifier "exit"
argument_list
( "("
decimal_integer_literal "0"
) ")"
; ";"
} "}"
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "device"
. "."
identifier "Device"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "util"
. "."
identifier "Ln"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "util"
. "."
identifier "Settings"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "util"
. "."
identifier "SettingsException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "os"
. "."
identifier "BatteryManager"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "system"
. "."
identifier "ErrnoException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "system"
. "."
identifier "Os"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "File"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "IOException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "OutputStream"
; ";"
block_comment "/**\n * Handle the cleanup of scrcpy, even if the main proces"...
class_declaration
modifiers
public "public"
final "final"
class "class"
identifier "CleanUp"
class_body
{ "{"
line_comment "// Dynamic options"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
int "int"
variable_declarator
identifier "PENDING_CHANGE_DISPLAY_POWER"
= "="
binary_expression
decimal_integer_literal "1"
<< "<<"
decimal_integer_literal "0"
; ";"
field_declaration
modifiers
private "private"
integral_type
int "int"
variable_declarator
identifier "pendingChanges"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "pendingRestoreDisplayPower"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Thread"
variable_declarator
identifier "thread"
; ";"
field_declaration
modifiers
private "private"
boolean_type "boolean"
variable_declarator
identifier "interrupted"
; ";"
constructor_declaration (+49 nodes collapsed)
method_declaration (+25 nodes collapsed)
method_declaration (+26 nodes collapsed)
method_declaration (+23 nodes collapsed)
method_declaration (+508 nodes collapsed)
method_declaration (+332 nodes collapsed)
method_declaration (+34 nodes collapsed)
method_declaration (+61 nodes collapsed)
method_declaration
modifiers
public "public"
static "static"
void_type "void"
identifier "main"
formal_parameters
( "("
spread_parameter
type_identifier "String"
... "..."
variable_declarator
identifier "args"
) ")"
block
{ "{"
try_statement
try "try"
block
{ "{"
line_comment "// Start a new session to avoid being terminated along with "...
expression_statement
method_invocation
identifier "Os"
. "."
identifier "setsid"
argument_list
( "("
) ")"
; ";"
} "}"
catch_clause
catch "catch"
( "("
catch_formal_parameter
catch_type
type_identifier "ErrnoException"
identifier "e"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "Ln"
. "."
identifier "e"
argument_list
( "("
string_literal
" "\""
string_fragment "setsid() failed"
" "\""
, ","
identifier "e"
) ")"
; ";"
} "}"
expression_statement
method_invocation
identifier "unlinkSelf"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "displayId"
= "="
method_invocation
identifier "Integer"
. "."
identifier "parseInt"
argument_list
( "("
array_access
identifier "args"
[ "["
decimal_integer_literal "0"
] "]"
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "restoreStayOn"
= "="
method_invocation
identifier "Integer"
. "."
identifier "parseInt"
argument_list
( "("
array_access
identifier "args"
[ "["
decimal_integer_literal "1"
] "]"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "disableShowTouches"
= "="
method_invocation
identifier "Boolean"
. "."
identifier "parseBoolean"
argument_list
( "("
array_access
identifier "args"
[ "["
decimal_integer_literal "2"
] "]"
) ")"
; ";"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "powerOffScreen"
= "="
method_invocation
identifier "Boolean"
. "."
identifier "parseBoolean"
argument_list
( "("
array_access
identifier "args"
[ "["
decimal_integer_literal "3"
] "]"
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "restoreScreenOffTimeout"
= "="
method_invocation
identifier "Integer"
. "."
identifier "parseInt"
argument_list
( "("
array_access
identifier "args"
[ "["
decimal_integer_literal "4"
] "]"
) ")"
; ";"
line_comment "// Dynamic option"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "restoreDisplayPower"
= "="
false "false"
; ";"
try_statement (+76 nodes collapsed)
expression_statement
method_invocation
identifier "Ln"
. "."
identifier "i"
argument_list
( "("
string_literal
" "\""
string_fragment "Cleaning up"
" "\""
) ")"
; ";"
if_statement (+82 nodes collapsed)
if_statement (+91 nodes collapsed)
if_statement (+91 nodes collapsed)
line_comment "// Change the power of the main display when mirroring a vir"...
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "targetDisplayId"
= "="
ternary_expression
binary_expression
identifier "displayId"
!= "!="
field_access
identifier "Device"
. "."
identifier "DISPLAY_ID_NONE"
? "?"
identifier "displayId"
: ":"
decimal_integer_literal "0"
; ";"
if_statement (+83 nodes collapsed)
expression_statement
method_invocation
identifier "System"
. "."
identifier "exit"
argument_list
( "("
decimal_integer_literal "0"
) ")"
; ";"
} "}"
} "}"