/** * Initialize the Android Debug Bridge and wait for it to start. Does not reinitialize it if it has * already been initialized (that would through and IllegalStateException...). Synchronized sine * the init call in the library is also synchronized .. just in case. */ protected AndroidDebugBridge initAndroidDebugBridge() throws MojoExecutionException { synchronized ( ADB_LOCK ) { if ( ! adbInitialized ) { DdmPreferences.setTimeOut( adbConnectionTimeout ); AndroidDebugBridge.init( false ); adbInitialized = true; } AndroidDebugBridge androidDebugBridge = AndroidDebugBridge .createBridge( getAndroidSdk().getAdbPath(), false ); waitUntilConnected( androidDebugBridge ); return androidDebugBridge; } }
/** Turn on debug logging in ddmlib classes. */ static void setDdmlibInternalLoggingLevel() { DdmPreferences.setLogLevel("debug"); }
/** * Write until all data in "data" is written or the connection fails or times out. * <p/>This uses the default time out value. * @param chan the opened socket to write to. * @param data the buffer to send. * @throws TimeoutException in case of timeout on the connection. * @throws IOException in case of I/O error on the connection. */ static void write(SocketChannel chan, byte[] data) throws TimeoutException, IOException { write(chan, data, -1, DdmPreferences.getTimeOut()); }
mAdbOsLocation, command[1])); ProcessBuilder processBuilder = new ProcessBuilder(command); if (DdmPreferences.getUseAdbHost()) { String adbHostValue = DdmPreferences.getAdbHostValue(); if (adbHostValue != null && adbHostValue.length() > 0) {
/** * Create an object for a new client connection. * * @param device the device this client belongs to * @param chan the connected {@link SocketChannel}. * @param pid the client pid. */ Client(Device device, SocketChannel chan, int pid) { super(new JdwpProtocol()); mDevice = device; mChan = chan; mReadBuffer = ByteBuffer.allocate(INITIAL_BUF_SIZE); mConnState = ST_INIT; mClientData = new ClientData(pid); mThreadUpdateEnabled = DdmPreferences.getInitialThreadUpdate(); mHeapInfoUpdateEnabled = DdmPreferences.getInitialHeapUpdate(); mHeapSegmentUpdateEnabled = DdmPreferences.getInitialHeapUpdate(); }
/** * Generic constructor. */ private MonitorThread() { super("Monitor"); mClientList = new ArrayList<Client>(); mHandlerMap = new HashMap<Integer, ChunkHandler>(); mNewDebugSelectedPort = DdmPreferences.getSelectedDebugPort(); }
/** * Write until all data in "data" is written or the connection fails or times out. * <p>This uses the default time out value. * @param chan the opened socket to write to. * @param data the buffer to send. * @throws TimeoutException in case of timeout on the connection. * @throws IOException in case of I/O error on the connection. */ static void write(SocketChannel chan, byte[] data) throws TimeoutException, IOException { write(chan, data, -1, DdmPreferences.getTimeOut()); }
Log.d(DDMS, String.format("Launching '%1$s' to ensure ADB is running.", commandString)); ProcessBuilder processBuilder = new ProcessBuilder(command); if (DdmPreferences.getUseAdbHost()) { String adbHostValue = DdmPreferences.getAdbHostValue(); if (adbHostValue != null && !adbHostValue.isEmpty()) {
/** * Create an object for a new client connection. * * @param device the device this client belongs to * @param chan the connected {@link SocketChannel}. * @param pid the client pid. */ Client(Device device, SocketChannel chan, int pid) { mDevice = device; mChan = chan; mReadBuffer = ByteBuffer.allocate(INITIAL_BUF_SIZE); mWriteBuffer = ByteBuffer.allocate(WRITE_BUF_SIZE); mOutstandingReqs = new HashMap<Integer,ChunkHandler>(); mConnState = ST_INIT; mClientData = new ClientData(pid); mThreadUpdateEnabled = DdmPreferences.getInitialThreadUpdate(); mHeapUpdateEnabled = DdmPreferences.getInitialHeapUpdate(); }
/** * Generic constructor. */ private MonitorThread() { super("Monitor"); mClientList = new ArrayList<Client>(); mNewDebugSelectedPort = DdmPreferences.getSelectedDebugPort(); mDdmJdwpExtension = new DdmJdwpExtension(); mJdwpExtensions = new LinkedList<JdwpExtension>(); mJdwpExtensions.add(mDdmJdwpExtension); }
logDebug(debug, "[%s] setDeviceDetails %s", serial, deviceDetails); DdmPreferences.setTimeOut((int) adbTimeout.toMillis());
/** * Write until all data in "data" is written or the connection fails or times out. * <p/>This uses the default time out value. * @param chan the opened socket to write to. * @param data the buffer to send. * @throws TimeoutException in case of timeout on the connection. * @throws IOException in case of I/O error on the connection. */ static void write(SocketChannel chan, byte[] data) throws TimeoutException, IOException { write(chan, data, -1, DdmPreferences.getTimeOut()); }
Log.d(DDMS, String.format("Launching '%1$s' to ensure ADB is running.", commandString)); ProcessBuilder processBuilder = new ProcessBuilder(command); if (DdmPreferences.getUseAdbHost()) { String adbHostValue = DdmPreferences.getAdbHostValue(); if (adbHostValue != null && !adbHostValue.isEmpty()) { Map<String, String> env = processBuilder.environment();
/** Turn on debug logging in ddmlib classes. */ static void setDdmlibInternalLoggingLevel() { DdmPreferences.setLogLevel("debug"); }
@Override public void connect() throws AndroidExecutionException { logger.info("Connecting to the Android Debug Bridge at " + adbLocation.getAbsolutePath() + " forceNewBridge = " + forceNewBridge); DdmPreferences.setTimeOut(ddmsTimeOut); AndroidDebugBridge.initIfNeeded(false); this.delegate = AndroidDebugBridge.createBridge(adbLocation.getAbsolutePath(), forceNewBridge); waitUntilConnected(); waitForInitialDeviceList(); }
/** * Reads from the socket until the array is filled, or no more data is coming (because * the socket closed or the timeout expired). * <p>This uses the default time out value. * * @param chan the opened socket to read from. It must be in non-blocking * mode for timeouts to work * @param data the buffer to store the read data into. * @throws TimeoutException in case of timeout on the connection. * @throws IOException in case of I/O error on the connection. */ static void read(SocketChannel chan, byte[] data) throws TimeoutException, IOException { read(chan, data, -1, DdmPreferences.getTimeOut()); }
checkArgument(testApk.exists(), "Could not find test APK: " + testApk); DdmPreferences.setTimeOut((int) adbTimeout.toMillis()); AndroidDebugBridge adb = SpoonUtils.initAdb(androidSdk, adbTimeout);
/** * Reads from the socket until the array is filled, or no more data is coming (because * the socket closed or the timeout expired). * <p/>This uses the default time out value. * * @param chan the opened socket to read from. It must be in non-blocking * mode for timeouts to work * @param data the buffer to store the read data into. * @throws TimeoutException in case of timeout on the connection. * @throws IOException in case of I/O error on the connection. */ static void read(SocketChannel chan, byte[] data) throws TimeoutException, IOException { read(chan, data, -1, DdmPreferences.getTimeOut()); }
@Override public void init() throws DeviceException { DdmPreferences.setTimeOut((int) timeOutUnit.toMillis(timeOut)); AndroidDebugBridge.initIfNeeded(false /*clientSupport*/);
/** * Reads from the socket until the array is filled, or no more data is coming (because * the socket closed or the timeout expired). * <p/>This uses the default time out value. * * @param chan the opened socket to read from. It must be in non-blocking * mode for timeouts to work * @param data the buffer to store the read data into. * @throws TimeoutException in case of timeout on the connection. * @throws IOException in case of I/O error on the connection. */ static void read(SocketChannel chan, byte[] data) throws TimeoutException, IOException { read(chan, data, -1, DdmPreferences.getTimeOut()); }