com.android.ddmlib.log.LogReceiver Java Examples
The following examples show how to use
com.android.ddmlib.log.LogReceiver.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdbHelper.java From javaide with GNU General Public License v3.0 | 4 votes |
/** * Runs a log service on the {@link Device}, and provides its output to the {@link LogReceiver}. * <p/>This call is blocking until {@link LogReceiver#isCancelled()} returns true. * @param adbSockAddr the socket address to connect to adb * @param device the Device on which to run the service * @param logName the name of the log file to output * @param rcvr the {@link LogReceiver} to receive the log output * @throws TimeoutException in case of timeout on the connection. * @throws AdbCommandRejectedException if adb rejects the command * @throws IOException in case of I/O error on the connection. */ public static void runLogService(InetSocketAddress adbSockAddr, Device device, String logName, LogReceiver rcvr) throws TimeoutException, AdbCommandRejectedException, IOException { SocketChannel adbChan = null; try { adbChan = SocketChannel.open(adbSockAddr); adbChan.configureBlocking(false); // if the device is not -1, then we first tell adb we're looking to talk // to a specific device setDevice(adbChan, device); byte[] request = formAdbRequest("log:" + logName); write(adbChan, request); AdbResponse resp = readAdbResponse(adbChan, false /* readDiagString */); if (!resp.okay) { throw new AdbCommandRejectedException(resp.message); } byte[] data = new byte[16384]; ByteBuffer buf = ByteBuffer.wrap(data); while (true) { int count; if (rcvr != null && rcvr.isCancelled()) { break; } count = adbChan.read(buf); if (count < 0) { break; } else if (count == 0) { try { Thread.sleep(WAIT_TIME * 5); } catch (InterruptedException ie) { } } else { if (rcvr != null) { rcvr.parseNewData(buf.array(), buf.arrayOffset(), buf.position()); } buf.rewind(); } } } finally { if (adbChan != null) { adbChan.close(); } } }
Example #2
Source File: Device.java From javaide with GNU General Public License v3.0 | 4 votes |
@Override public void runEventLogService(LogReceiver receiver) throws TimeoutException, AdbCommandRejectedException, IOException { AdbHelper.runEventLogService(AndroidDebugBridge.getSocketAddress(), this, receiver); }
Example #3
Source File: Device.java From javaide with GNU General Public License v3.0 | 4 votes |
@Override public void runLogService(String logname, LogReceiver receiver) throws TimeoutException, AdbCommandRejectedException, IOException { AdbHelper.runLogService(AndroidDebugBridge.getSocketAddress(), this, logname, receiver); }
Example #4
Source File: TestDevice.java From buck with Apache License 2.0 | 4 votes |
@Override public void runEventLogService(LogReceiver logReceiver) { throw new UnsupportedOperationException(); }
Example #5
Source File: TestDevice.java From buck with Apache License 2.0 | 4 votes |
@Override public void runLogService(String s, LogReceiver logReceiver) { throw new UnsupportedOperationException(); }
Example #6
Source File: IosIDevice.java From agent with MIT License | 2 votes |
@Override public void runEventLogService(LogReceiver receiver) throws TimeoutException, AdbCommandRejectedException, IOException { }
Example #7
Source File: IosIDevice.java From agent with MIT License | 2 votes |
@Override public void runLogService(String logname, LogReceiver receiver) throws TimeoutException, AdbCommandRejectedException, IOException { }
Example #8
Source File: FileDevice.java From logviewer with Apache License 2.0 | 2 votes |
@Override public void runEventLogService(LogReceiver logReceiver) throws TimeoutException, AdbCommandRejectedException, IOException { }
Example #9
Source File: FileDevice.java From logviewer with Apache License 2.0 | 2 votes |
@Override public void runLogService(String s, LogReceiver logReceiver) throws TimeoutException, AdbCommandRejectedException, IOException { }
Example #10
Source File: AdbHelper.java From javaide with GNU General Public License v3.0 | 2 votes |
/** * Runs the Event log service on the {@link Device}, and provides its output to the * {@link LogReceiver}. * <p/>This call is blocking until {@link LogReceiver#isCancelled()} returns true. * @param adbSockAddr the socket address to connect to adb * @param device the Device on which to run the service * @param rcvr the {@link LogReceiver} to receive the log output * @throws TimeoutException in case of timeout on the connection. * @throws AdbCommandRejectedException if adb rejects the command * @throws IOException in case of I/O error on the connection. */ public static void runEventLogService(InetSocketAddress adbSockAddr, Device device, LogReceiver rcvr) throws TimeoutException, AdbCommandRejectedException, IOException { runLogService(adbSockAddr, device, "events", rcvr); //$NON-NLS-1$ }
Example #11
Source File: IDevice.java From javaide with GNU General Public License v3.0 | 2 votes |
/** * Runs the event log service and outputs the event log to the {@link LogReceiver}. * <p/>This call is blocking until {@link LogReceiver#isCancelled()} returns true. * @param receiver the receiver to receive the event log entries. * @throws TimeoutException in case of timeout on the connection. This can only be thrown if the * timeout happens during setup. Once logs start being received, no timeout will occur as it's * not possible to detect a difference between no log and timeout. * @throws AdbCommandRejectedException if adb rejects the command * @throws IOException in case of I/O error on the connection. */ void runEventLogService(LogReceiver receiver) throws TimeoutException, AdbCommandRejectedException, IOException;
Example #12
Source File: IDevice.java From javaide with GNU General Public License v3.0 | 2 votes |
/** * Runs the log service for the given log and outputs the log to the {@link LogReceiver}. * <p/>This call is blocking until {@link LogReceiver#isCancelled()} returns true. * * @param logname the logname of the log to read from. * @param receiver the receiver to receive the event log entries. * @throws TimeoutException in case of timeout on the connection. This can only be thrown if the * timeout happens during setup. Once logs start being received, no timeout will * occur as it's not possible to detect a difference between no log and timeout. * @throws AdbCommandRejectedException if adb rejects the command * @throws IOException in case of I/O error on the connection. */ void runLogService(String logname, LogReceiver receiver) throws TimeoutException, AdbCommandRejectedException, IOException;