[androiddebugbridge] Fix screen state channel on android 12 (#14663)
Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>
This commit is contained in:
parent
fbcb412353
commit
b9751dced3
|
@ -244,6 +244,10 @@ public class AndroidDebugBridgeDevice {
|
||||||
|
|
||||||
public boolean isScreenOn() throws InterruptedException, AndroidDebugBridgeDeviceException,
|
public boolean isScreenOn() throws InterruptedException, AndroidDebugBridgeDeviceException,
|
||||||
AndroidDebugBridgeDeviceReadException, TimeoutException, ExecutionException {
|
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'");
|
String devicesResp = runAdbShell("dumpsys", "power", "|", "grep", "'Display Power'");
|
||||||
if (devicesResp.contains("=")) {
|
if (devicesResp.contains("=")) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue