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 和/或其关联公司的注册商标。
最后更新时间 (UTC):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":"其他"
}]