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)
Instantiates a new LogcatEventParser |
|
公用方法 | |
|---|---|
void
|
close()
停止監聽 Logcat。 |
void
|
parseEvents(String[] lines)
剖析 logcat 行,並將擷取的任何事件 (已向 |
GenericLogcatEventParser.LogcatEvent
|
pollForEvent()
輪詢事件佇列。 |
void
|
registerEventTrigger(String tag, String msg, LogcatEventType response)
Register an event of given logcat tag and message with the desired response. |
void
|
registerEventTrigger(Log.LogLevel logLevel, String tag, String msg, LogcatEventType response)
Register an event of given logcat level, tag and message with the desired response. |
void
|
start()
Start listening to logcat and parsing events. |
GenericLogcatEventParser.LogcatEvent
|
waitForEvent(long timeoutMs)
封鎖作業會執行至收到事件為止。 |
公用建構函式
GenericLogcatEventParser
public GenericLogcatEventParser (ITestDevice device)
建立新的 LogcatEventParser 例項
| 參數 | |
|---|---|
device |
ITestDevice:從中讀取 logcat |
公用方法
關閉
public void close ()
停止監聽 logcat。
parseEvents
public void parseEvents (String[] lines)
剖析 logcat 行,並將擷取的任何事件 (已向 registerEventTrigger(String, String, LogcatEventType) 註冊) 新增至事件佇列。
| 參數 | |
|---|---|
lines |
String |
pollForEvent
public GenericLogcatEventParser.LogcatEvent pollForEvent ()
輪詢事件佇列。立即傳回。
| 傳回 | |
|---|---|
GenericLogcatEventParser.LogcatEvent |
活動或 null (如果找不到相符的活動) |
registerEventTrigger
public void registerEventTrigger (String tag,
String msg,
LogcatEventType response)使用所需的回應,註冊指定 logcat 標記和訊息的事件。訊息可能不完整。
| 參數 | |
|---|---|
tag |
String |
msg |
String |
response |
LogcatEventType |
registerEventTrigger
public void registerEventTrigger (Log.LogLevel logLevel, String tag, String msg, LogcatEventType response)
使用所需的回應,註冊指定 Logcat 層級、標記和訊息的事件。訊息可能不完整。
| 參數 | |
|---|---|
logLevel |
Log.LogLevel |
tag |
String |
msg |
String |
response |
LogcatEventType |
start
public void start ()
開始監聽 logcat 並剖析事件。
waitForEvent
public GenericLogcatEventParser.LogcatEvent waitForEvent (long timeoutMs)
封鎖,直到收到事件為止。
| 參數 | |
|---|---|
timeoutMs |
long:等待時間 (毫秒) |
| 傳回 | |
|---|---|
GenericLogcatEventParser.LogcatEvent |
事件或 null (如果達到逾時時間) |