public static boolean sendAdbCmd(InputStream is,OutputStream os,String cmd) throws IOException {
  byte[] buf=new byte[ADB_RESPONSE_SIZE];
  cmd=String.format("%04X",cmd.length()) + cmd;
  os.write(cmd.getBytes());
  int read=is.read(buf);
  if (read != ADB_RESPONSE_SIZE || !ADB_OK.equals(new String(buf))) {
    Log.w(LOGTAG,"adb cmd faild.");
    return false;
  }
  return true;
}

public static boolean sendAdbCmd ( InputStream is , OutputStream os , String cmd ) throws IOException { byte [ ] buf = new byte [ ADB_RESPONSE_SIZE ] ; cmd = String . format ( "%04X" , cmd . length ( ) ) + cmd ; os . write ( cmd . getBytes ( ) ) ; int read = is . read ( buf ) ; if ( read != ADB_RESPONSE_SIZE || ! ADB_OK . equals ( new String ( buf ) ) ) { Log . w ( LOGTAG , "adb cmd faild." ) ; return false ; } return true ; }
send an adb command using existing socket connection the streams provided must be from a socket connected to adbd already
