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

…lines 1–91 unchanged (91 lines)
92 Ln.e("Could not get display info from \"dumpsys display\" output", e);
93 return null;
94 }
95 }
96
97 private static int parseDisplayFlags(String text) {
98 Pattern regex = Pattern.compile("FLAG_[A-Z_]+");
99 if (text == null) {
100 return 0;
101 }
102
103 int flags = 0;
104 Matcher m = regex.matcher(text);
…lines 105–234 unchanged (130 lines)

After

…lines 1–96 unchanged (96 lines)
97 private static int parseDisplayFlags(String text) {
98 if (text == null) {
99 return 0;
100 }
101
102 int flags = 0;
103 Pattern regex = Pattern.compile("FLAG_[A-Z_]+");
104 Matcher m = regex.matcher(text);
105 while (m.find()) {
106 String flagString = m.group();
107 try {
108 Field filed = Display.class.getDeclaredField(flagString);
109 flags |= filed.getInt(null);
…lines 110–234 unchanged (125 lines)

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "wrappers"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "AndroidVersions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "FakeContext"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "device"
. "."
identifier "DisplayInfo"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "device"
. "."
identifier "Size"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "util"
. "."
identifier "Command"
; ";"
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
identifier "android"
. "."
identifier "annotation"
. "."
identifier "SuppressLint"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "annotation"
. "."
identifier "TargetApi"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "content"
. "."
identifier "Context"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "hardware"
. "."
identifier "display"
. "."
identifier "VirtualDisplay"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "os"
. "."
identifier "Handler"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "view"
. "."
identifier "Display"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "view"
. "."
identifier "Surface"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Constructor"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Field"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Method"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Proxy"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "regex"
. "."
identifier "Matcher"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "regex"
. "."
identifier "Pattern"
; ";"
class_declaration
modifiers
annotation
@ "@"
identifier "SuppressLint"
annotation_argument_list
( "("
string_literal
" "\""
string_fragment "PrivateApi,DiscouragedPrivateApi"
" "\""
) ")"
public "public"
final "final"
class "class"
identifier "DisplayManager"
class_body
{ "{"
line_comment "// android.hardware.display.DisplayManager.EVENT_FLAG_DISPLA"...
field_declaration
modifiers
public "public"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "EVENT_FLAG_DISPLAY_CHANGED"
= "="
binary_expression
decimal_integer_literal "1L"
<< "<<"
decimal_integer_literal "2"
; ";"
interface_declaration
modifiers
public "public"
interface "interface"
identifier "DisplayListener"
interface_body
{ "{"
block_comment "/**\n * Called whenever the properties of a logical {"...
method_declaration
void_type "void"
identifier "onDisplayChanged"
formal_parameters
( "("
formal_parameter
integral_type
int "int"
identifier "displayId"
) ")"
; ";"
} "}"
class_declaration (+40 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "Object"
variable_declarator
identifier "manager"
; ";"
line_comment "// instance of hidden class android.hardware.display.Display"...
field_declaration
modifiers
private "private"
type_identifier "Method"
variable_declarator
identifier "createVirtualDisplayMethod"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Method"
variable_declarator
identifier "requestDisplayPowerMethod"
; ";"
method_declaration (+101 nodes collapsed)
constructor_declaration (+22 nodes collapsed)
line_comment "// public to call it from unit tests"
method_declaration (+254 nodes collapsed)
method_declaration (+88 nodes collapsed)
method_declaration
modifiers
private "private"
static "static"
integral_type
int "int"
identifier "parseDisplayFlags"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "text"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Pattern"
variable_declarator
identifier "regex"
= "="
method_invocation
identifier "Pattern"
. "."
identifier "compile"
argument_list
( "("
string_literal
" "\""
string_fragment "FLAG_[A-Z_]+"
" "\""
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "text"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
decimal_integer_literal "0"
; ";"
} "}"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "flags"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration
type_identifier "Matcher"
variable_declarator
identifier "m"
= "="
method_invocation
identifier "regex"
. "."
identifier "matcher"
argument_list
( "("
identifier "text"
) ")"
; ";"
while_statement (+75 nodes collapsed)
return_statement
return "return"
identifier "flags"
; ";"
} "}"
method_declaration (+299 nodes collapsed)
method_declaration (+78 nodes collapsed)
method_declaration (+86 nodes collapsed)
method_declaration (+72 nodes collapsed)
method_declaration (+144 nodes collapsed)
method_declaration (+63 nodes collapsed)
method_declaration (+94 nodes collapsed)
method_declaration (+381 nodes collapsed)
method_declaration (+101 nodes collapsed)
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "wrappers"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "AndroidVersions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "FakeContext"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "device"
. "."
identifier "DisplayInfo"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "device"
. "."
identifier "Size"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "genymobile"
. "."
identifier "scrcpy"
. "."
identifier "util"
. "."
identifier "Command"
; ";"
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
identifier "android"
. "."
identifier "annotation"
. "."
identifier "SuppressLint"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "annotation"
. "."
identifier "TargetApi"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "content"
. "."
identifier "Context"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "hardware"
. "."
identifier "display"
. "."
identifier "VirtualDisplay"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "os"
. "."
identifier "Handler"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "view"
. "."
identifier "Display"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "android"
. "."
identifier "view"
. "."
identifier "Surface"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Constructor"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Field"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Method"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "lang"
. "."
identifier "reflect"
. "."
identifier "Proxy"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "regex"
. "."
identifier "Matcher"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "regex"
. "."
identifier "Pattern"
; ";"
class_declaration
modifiers
annotation
@ "@"
identifier "SuppressLint"
annotation_argument_list
( "("
string_literal
" "\""
string_fragment "PrivateApi,DiscouragedPrivateApi"
" "\""
) ")"
public "public"
final "final"
class "class"
identifier "DisplayManager"
class_body
{ "{"
line_comment "// android.hardware.display.DisplayManager.EVENT_FLAG_DISPLA"...
field_declaration
modifiers
public "public"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "EVENT_FLAG_DISPLAY_CHANGED"
= "="
binary_expression
decimal_integer_literal "1L"
<< "<<"
decimal_integer_literal "2"
; ";"
interface_declaration
modifiers
public "public"
interface "interface"
identifier "DisplayListener"
interface_body
{ "{"
block_comment "/**\n * Called whenever the properties of a logical {"...
method_declaration
void_type "void"
identifier "onDisplayChanged"
formal_parameters
( "("
formal_parameter
integral_type
int "int"
identifier "displayId"
) ")"
; ";"
} "}"
class_declaration (+40 nodes collapsed)
field_declaration
modifiers
private "private"
final "final"
type_identifier "Object"
variable_declarator
identifier "manager"
; ";"
line_comment "// instance of hidden class android.hardware.display.Display"...
field_declaration
modifiers
private "private"
type_identifier "Method"
variable_declarator
identifier "createVirtualDisplayMethod"
; ";"
field_declaration
modifiers
private "private"
type_identifier "Method"
variable_declarator
identifier "requestDisplayPowerMethod"
; ";"
method_declaration (+101 nodes collapsed)
constructor_declaration (+22 nodes collapsed)
line_comment "// public to call it from unit tests"
method_declaration (+254 nodes collapsed)
method_declaration (+88 nodes collapsed)
method_declaration
modifiers
private "private"
static "static"
integral_type
int "int"
identifier "parseDisplayFlags"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "text"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "text"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
decimal_integer_literal "0"
; ";"
} "}"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "flags"
= "="
decimal_integer_literal "0"
; ";"
local_variable_declaration
type_identifier "Pattern"
variable_declarator
identifier "regex"
= "="
method_invocation
identifier "Pattern"
. "."
identifier "compile"
argument_list
( "("
string_literal
" "\""
string_fragment "FLAG_[A-Z_]+"
" "\""
) ")"
; ";"
local_variable_declaration
type_identifier "Matcher"
variable_declarator
identifier "m"
= "="
method_invocation
identifier "regex"
. "."
identifier "matcher"
argument_list
( "("
identifier "text"
) ")"
; ";"
while_statement (+75 nodes collapsed)
return_statement
return "return"
identifier "flags"
; ";"
} "}"
method_declaration (+299 nodes collapsed)
method_declaration (+78 nodes collapsed)
method_declaration (+86 nodes collapsed)
method_declaration (+72 nodes collapsed)
method_declaration (+144 nodes collapsed)
method_declaration (+63 nodes collapsed)
method_declaration (+94 nodes collapsed)
method_declaration (+381 nodes collapsed)
method_declaration (+101 nodes collapsed)
} "}"