[androiddebugbridge] Fix screen state channel on android 12 (#14663)

Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>
This commit is contained in:
GiviMAD 2023-03-24 23:25:21 +01:00 committed by GitHub
parent fbcb412353
commit b9751dced3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -244,6 +244,10 @@ public class AndroidDebugBridgeDevice {
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 {