GenericLogcatEventParser

public class GenericLogcatEventParser
extends Object

java.lang.Object
com.android.tradefed.util.GenericLogcatEventParser<LogcatEventType>


解析事件的 logcat 輸入。

此類解釋 logcat 消息,並可以以阻塞和輪詢方式通知事件的偵聽器。

概括

嵌套類

class GenericLogcatEventParser.LogcatEvent

用於保存具有事件類型和触發 logcat 消息的 logcat 事件的結構

公共構造函數

GenericLogcatEventParser ( ITestDevice device)

實例化一個新的 LogcatEventParser

公共方法

void close ()

停止收聽 logcat。

void parseEvents (String[] lines)

解析 logcat 行並將任何捕獲的事件(已使用registerEventTrigger(String, String, LogcatEventType)註冊)添加到事件隊列。

GenericLogcatEventParser.LogcatEvent pollForEvent ()

輪詢事件隊列。

void registerEventTrigger (String tag, String msg, LogcatEventType response)

使用所需的響應註冊給定 logcat 標記和消息的事件。

void registerEventTrigger (Log.LogLevel logLevel, String tag, String msg, LogcatEventType response)

使用所需的響應註冊給定 logcat 級別、標記和消息的事件。

void start ()

開始監聽 logcat 和解析事件。

GenericLogcatEventParser.LogcatEvent waitForEvent (long timeoutMs)

阻塞直到它收到一個事件。

公共構造函數

GenericLogcatEventParser

public GenericLogcatEventParser (ITestDevice device)

實例化一個新的 LogcatEventParser

參數
device ITestDevice :從中讀取 logcat

公共方法

關閉

public void close ()

停止收聽 logcat。

解析事件

public void parseEvents (String[] lines)

解析 logcat 行並將任何捕獲的事件(已使用registerEventTrigger(String, String, LogcatEventType)註冊)添加到事件隊列。

參數
lines String

輪詢事件

public GenericLogcatEventParser.LogcatEvent pollForEvent ()

輪詢事件隊列。立即返回。

退貨
GenericLogcatEventParser.LogcatEvent如果找不到匹配的事件,則為事件或null

註冊事件觸發器

public void registerEventTrigger (String tag, 
                String msg, 
                LogcatEventType response)

使用所需的響應註冊給定 logcat 標記和消息的事件。消息可能是部分的。

參數
tag String

msg String

response LogcatEventType

註冊事件觸發器

public void registerEventTrigger (Log.LogLevel logLevel, 
                String tag, 
                String msg, 
                LogcatEventType response)

使用所需的響應註冊給定 logcat 級別、標記和消息的事件。消息可能是部分的。

參數
logLevel Log.LogLevel

tag String

msg String

response LogcatEventType

開始

public void start ()

開始監聽 logcat 和解析事件。

等待事件

public GenericLogcatEventParser.LogcatEvent waitForEvent (long timeoutMs)

阻塞直到它收到一個事件。

參數
timeoutMs long :等待時間(以毫秒為單位)

退貨
GenericLogcatEventParser.LogcatEvent如果達到超時,則為事件或null