Skip to content

Commit

Permalink
Use getPhysicalDisplayToken if getBuiltInDisplay is not found
Browse files Browse the repository at this point in the history
This makes the -S (screen off) parameter work on Android Q beta 4

Closes Genymobile#586
  • Loading branch information
schwabe committed Jun 12, 2019
1 parent 8ca3640 commit 09384e9
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,14 @@ public static IBinder createDisplay(String name, boolean secure) {
}

public static IBinder getBuiltInDisplay(int builtInDisplayId) {
try {
try {
return (IBinder) CLASS.getMethod("getBuiltInDisplay", int.class).invoke(null, builtInDisplayId);
} catch (NoSuchMethodException nsme) {
// Android Q does not have this method anymore but has a
// replacement.
return (IBinder) CLASS.getMethod("getPhysicalDisplayToken", long.class).invoke(null, builtInDisplayId);
}
} catch (Exception e) {
throw new AssertionError(e);
}
Expand Down

0 comments on commit 09384e9

Please sign in to comment.