LogcatEventParser
public
class
LogcatEventParser
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.LogcatEventParser |
Parse logcat input for events.
This class interprets logcat messages and can inform the listener of events in both a blocking and polling fashion.
Summary
Nested classes | |
---|---|
class |
LogcatEventParser.LogcatEvent
Struct to hold a logcat event with the event type and triggering logcat message |
Public constructors | |
---|---|
LogcatEventParser(ITestDevice device)
Instantiates a new LogcatEventParser |
Public methods | |
---|---|
void
|
close()
Stop listening to logcat. |
void
|
parseEvents(String[] lines)
Parse logcat lines and add any captured events (that were registered with |
LogcatEventParser.LogcatEvent
|
pollForEvent()
Polls the event queue. |
void
|
registerEventTrigger(String tag, String msg, LogcatEventType response)
Register an event of given logcat tag and message with the desired response. |
void
|
start()
Start listening to logcat and parsing events. |
LogcatEventParser.LogcatEvent
|
waitForEvent(long timeoutMs)
Blocks until it receives an event. |
Public constructors
LogcatEventParser
public LogcatEventParser (ITestDevice device)
Instantiates a new LogcatEventParser
Parameters | |
---|---|
device |
ITestDevice : to read logcat from
|
Public methods
close
public void close ()
Stop listening to logcat.
parseEvents
public void parseEvents (String[] lines)
Parse logcat lines and add any captured events (that were registered with registerEventTrigger(String, String, com.android.tradefed.util.LogcatEventType)
) to the event queue.
Parameters | |
---|---|
lines |
String |
pollForEvent
public LogcatEventParser.LogcatEvent pollForEvent ()
Polls the event queue. Returns immediately.
Returns | |
---|---|
LogcatEventParser.LogcatEvent |
The event or null if no matching event is found
|
registerEventTrigger
public void registerEventTrigger (String tag, String msg, LogcatEventType response)
Register an event of given logcat tag and message with the desired response. Message may be partial.
Parameters | |
---|---|
tag |
String |
msg |
String |
response |
LogcatEventType |
start
public void start ()
Start listening to logcat and parsing events.
waitForEvent
public LogcatEventParser.LogcatEvent waitForEvent (long timeoutMs)
Blocks until it receives an event.
Parameters | |
---|---|
timeoutMs |
long : Time to wait in milliseconds |
Returns | |
---|---|
LogcatEventParser.LogcatEvent |
The event or null if the timeout is reached
|
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2020-09-08 (世界標準時間)。