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 行並將任何捕獲的事件(已使用 |
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 |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2023-04-28 (世界標準時間)。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"缺少我需要的資訊"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"過於複雜/步驟過多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"過時"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻譯問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/程式碼問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"容易理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"確實解決了我的問題"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]