device-api/src/main/java/com/github/cosysoft/device/android/impl/AbstractDevice.java
@Override
  public boolean isScreenOn() {
    CommandLine command = adbCommand("shell", "dumpsys power");
    try {
      String powerState = ShellCommand.exec(command).toLowerCase();
      if (powerState.indexOf("mscreenon=true") > -1
          || powerState.indexOf("mpowerstate=0") == -1) {
        return true;
      }
    } catch (ShellCommandException e) {
      log.info("Could not get property init.svc.bootanim", e);
    }
    return false;
  }
@Override
  public boolean isScreenOn() {
    CommandLine command = adbCommand("shell", "dumpsys power");
    try {
      String powerState = ShellCommand.exec(command).toLowerCase();
      if (powerState.indexOf("mscreenon=true") > -1
          || powerState.indexOf("mpowerstate=0") == -1) {
        return true;
      }
    } catch (ShellCommandException e) {
      log.info("Could not get property init.svc.bootanim", e);
    }
    return false;
  }
@ Override public boolean isScreenOn ( ) { CommandLine command = adbCommand ( "shell" , "dumpsys power" ) ; try { String powerState = ShellCommand . exec ( command ) . toLowerCase ( ) ; if ( powerState . indexOf ( "mscreenon=true" ) > - 1 || powerState . indexOf ( "mpowerstate=0" ) == - 1 ) { return true ; } } catch ( ShellCommandException e ) { log . info ( "Could not get property init.svc.bootanim" , e ) ; } return false ; }
ugly implementation
ugly implementation