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 ()

getDefaultLogcatCmd

public static String getDefaultLogcatCmd (ITestDevice device)

獲取默認的 logcat 命令,僅在 api 級別 > 24 時附加 uid 格式。

參數
device ITestDevice

退貨
String

獲取日誌數據

public InputStreamSource getLogcatData (int maxBytes, 
                int offset)

返回給定偏移量的當前 logcat 緩衝區。

參數
maxBytes int : 返回緩衝區的最大大小

offset int :完整緩衝區的偏移量。

退貨
InputStreamSource從偏移量開始的 logcat 緩衝區。

獲取日誌數據

public InputStreamSource getLogcatData (int maxBytes)

參數
maxBytes int

退貨
InputStreamSource

獲取日誌數據

public InputStreamSource getLogcatData ()

退貨
InputStreamSource

開始

public void start ()

停止

public void stop ()