diff options
author | Guang Zhu <guangzhu@google.com> | 2014-09-14 22:32:03 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-14 22:32:03 +0000 |
commit | 7a39182cc35e5a792b19a952fb16bcf52e40319f (patch) | |
tree | 5a2d2d38fe56e054fefd336da516d04f9653e5ce | |
parent | c0e8663ad11ee19ee426a254c73b4bc624641f51 (diff) | |
parent | 7a310443616941f6b1899e902a43f4e93d66f584 (diff) | |
download | tradefederation-7a39182cc35e5a792b19a952fb16bcf52e40319f.tar.gz |
Merge "allo specifying custom logcat command in LogcatReceiver"
-rw-r--r-- | src/com/android/tradefed/device/LogcatReceiver.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/com/android/tradefed/device/LogcatReceiver.java b/src/com/android/tradefed/device/LogcatReceiver.java index 9736fdfbc..cd2d50287 100644 --- a/src/com/android/tradefed/device/LogcatReceiver.java +++ b/src/com/android/tradefed/device/LogcatReceiver.java @@ -28,15 +28,35 @@ public class LogcatReceiver { static final String LOGCAT_CMD = "logcat -v threadtime"; private static final String LOGCAT_DESC = "logcat"; - public LogcatReceiver(ITestDevice device, long maxFileSize, int logStartDelay) { + /** + * Creates an instance with any specified logcat command + * @param device the device to start logcat on + * @param logcatCmd the logcat command to run (including 'logcat' part), see details on + * available options in logcat help message + * @param maxFileSize maximum file size, earlier lines will be discarded once size is reached + * @param logStartDelay the delay to wait after the device becomes online + */ + public LogcatReceiver(ITestDevice device, String logcatCmd, + long maxFileSize, int logStartDelay) { + mReceiver = new LargeOutputReceiver(LOGCAT_DESC, device.getSerialNumber(), maxFileSize); // FIXME: remove mLogStartDelay. Currently delay starting logcat, as starting // immediately after a device comes online has caused adb instability - mDeviceAction = new BackgroundDeviceAction(LOGCAT_CMD, LOGCAT_DESC, device, + mDeviceAction = new BackgroundDeviceAction(logcatCmd, LOGCAT_DESC, device, mReceiver, logStartDelay); } + /** + * Creates an instance with default logcat 'threadtime' format + * @param device the device to start logcat on + * @param maxFileSize maximum file size, earlier lines will be discarded once size is reached + * @param logStartDelay the delay to wait after the device becomes online + */ + public LogcatReceiver(ITestDevice device, long maxFileSize, int logStartDelay) { + this(device, LOGCAT_CMD, maxFileSize, logStartDelay); + } + public void start() { mDeviceAction.start(); } |