boolean openSync() throws TimeoutException, AdbCommandRejectedException, IOException {
  try {
    mChannel=SocketChannel.open(mAddress);
    mChannel.configureBlocking(false);
    AdbHelper.setDevice(mChannel,mDevice);
    byte[] request=AdbHelper.formAdbRequest("sync:");
    AdbHelper.write(mChannel,request,-1,DdmPreferences.getTimeOut());
    AdbResponse resp=AdbHelper.readAdbResponse(mChannel,false);
    if (!resp.okay) {
      Log.w("ddms","Got unhappy response from ADB sync req: " + resp.message);
      mChannel.close();
      mChannel=null;
      return false;
    }
  }
 catch (  TimeoutException|IOException e) {
    if (mChannel != null) {
      try {
        mChannel.close();
      }
 catch (      IOException e2) {
      }
      mChannel=null;
    }
    throw e;
  }
  return true;
}

boolean openSync ( ) throws TimeoutException , AdbCommandRejectedException , IOException { try { mChannel = SocketChannel . open ( mAddress ) ; mChannel . configureBlocking ( false ) ; AdbHelper . setDevice ( mChannel , mDevice ) ; byte [ ] request = AdbHelper . formAdbRequest ( "sync:" ) ; AdbHelper . write ( mChannel , request , - 1 , DdmPreferences . getTimeOut ( ) ) ; AdbResponse resp = AdbHelper . readAdbResponse ( mChannel , false ) ; if ( ! resp . okay ) { Log . w ( "ddms" , "Got unhappy response from ADB sync req: " + resp . message ) ; mChannel . close ( ) ; mChannel = null ; return false ; } } catch ( TimeoutException | IOException e ) { if ( mChannel != null ) { try { mChannel . close ( ) ; } catch ( IOException e2 ) { } mChannel = null ; } throw e ; } return true ; }
opens the sync connection . this must be called before any calls to push [ file ] / pull [ file ] .
