Logcat接收器

public class LogcatReceiver
extends Object implements ILogcatReceiver

java.lang.Object
com.android.tradefed.device.LogcatReceiver


在后台收集 logcat 的类。即使设备离线然后又上线,也会继续捕获 logcat。

概括

公共构造函数

LogcatReceiver ( ITestDevice device, String logcatCmd, long maxFileSize, int logStartDelay)

使用任何指定的 logcat 命令创建实例

LogcatReceiver ( ITestDevice device, long maxFileSize, int logStartDelay)

使用默认 logcat 'threadtime' 格式创建一个实例

公共方法

void clear ()
static String getDefaultLogcatCmd ( ITestDevice device)

获取默认的 logcat 命令,仅在 api 级别 > 24 时附加 uid 格式。

InputStreamSource getLogcatData (int maxBytes, int offset)

返回给定偏移量的当前 logcat 缓冲区。

InputStreamSource getLogcatData (int maxBytes)
InputStreamSource getLogcatData ()
void start ()
void stop ()

公共构造函数

Logcat接收器

public LogcatReceiver (ITestDevice device, 
                String logcatCmd, 
                long maxFileSize, 
                int logStartDelay)

使用任何指定的 logcat 命令创建实例

参数
device ITestDevice :启动 logcat 的设备

logcatCmd String :要运行的 logcat 命令(包括“logcat”部分),请参阅 logcat 帮助消息中有关可用选项的详细信息

maxFileSize long :最大文件大小,一旦达到大小,前面的行将被丢弃

logStartDelay int : 设备上线后等待的延迟时间

Logcat接收器

public LogcatReceiver (ITestDevice device, 
                long maxFileSize, 
                int logStartDelay)

使用默认 logcat 'threadtime' 格式创建一个实例

参数
device ITestDevice :启动 logcat 的设备

maxFileSize long :最大文件大小,一旦达到大小,前面的行将被丢弃

logStartDelay int : 设备上线后等待的延迟时间

公共方法

清除

public void clear ()

获取默认LogcatCmd

public static String getDefaultLogcatCmd (ITestDevice device)

获取默认的 logcat 命令,仅在 api 级别 > 24 时附加 uid 格式。

参数
device ITestDevice

退货
String

获取Logcat数据

public InputStreamSource getLogcatData (int maxBytes, 
                int offset)

返回给定偏移量的当前 logcat 缓冲区。

参数
maxBytes int : 返回缓冲区的最大大小

offset int :完整缓冲区的偏移量。

退货
InputStreamSource logcat 缓冲区从偏移量开始。

获取Logcat数据

public InputStreamSource getLogcatData (int maxBytes)

参数
maxBytes int

退货
InputStreamSource

获取Logcat数据

public InputStreamSource getLogcatData ()

退货
InputStreamSource

开始

public void start ()

停止

public void stop ()