Skip to content

Commit

Permalink
[androiddebugbridge] Fix screen state channel on android 12 (openhab#…
Browse files Browse the repository at this point in the history
…14663)

Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>
  • Loading branch information
GiviMAD authored and FordPrfkt committed Apr 19, 2023
1 parent e3b9cd1 commit 66171ca
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ public boolean isAwake()

public boolean isScreenOn() throws InterruptedException, AndroidDebugBridgeDeviceException,
AndroidDebugBridgeDeviceReadException, TimeoutException, ExecutionException {
if (isAtLeastVersion(12)) {
String devicesResp = runAdbShell("getprop", "debug.tracing.screen_state");
return devicesResp.replace("\n", "").equals("2");
}
String devicesResp = runAdbShell("dumpsys", "power", "|", "grep", "'Display Power'");
if (devicesResp.contains("=")) {
try {
Expand Down

0 comments on commit 66171ca

Please sign in to comment.