LogcatUpdaterEventParser

public class LogcatUpdaterEventParser
extends Object implements Closeable

java.lang.Object
   ↳ com.android.tradefed.util.LogcatUpdaterEventParser


Parse logcat input for system updater related events.

In any system with A/B updates, the updater will log its progress to logcat. This class interprets updater-related logcat messages and can inform listeners of events in both a blocking and non-blocking fashion.

Summary

Nested classes

class LogcatUpdaterEventParser.AsyncUpdaterEvent

A monitor object which allows callers to receive events asynchronously. 

Public constructors

LogcatUpdaterEventParser(ILogcatReceiver logcatReceiver)

Create a new LogcatUpdaterEventParser

Public methods

void close()

UpdaterEventType waitForEvent(UpdaterEventType expectedEvent, long timeoutMs)

Block until the specified event is encountered or the timeout is reached.

LogcatUpdaterEventParser.AsyncUpdaterEvent waitForEventAsync(UpdaterEventType expectedEvent, long timeoutMs)

Wait for an event but do not block.

Protected methods

UpdaterEventType parseEventType(String lastLine)

Parse a logcat line and return the captured event (that were registered with registerEventTrigger(String, String, UpdaterEventType)) or null.

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

Register an event of given logcat tag and message with the desired response.

Public constructors

LogcatUpdaterEventParser

LogcatUpdaterEventParser (ILogcatReceiver logcatReceiver)

Create a new LogcatUpdaterEventParser

Parameters
logcatReceiver ILogcatReceiver

Public methods

close

void close ()

Throws
IOException

waitForEvent

UpdaterEventType waitForEvent (UpdaterEventType expectedEvent, 
                long timeoutMs)

Block until the specified event is encountered or the timeout is reached.

Parameters
expectedEvent UpdaterEventType

timeoutMs long

Returns
UpdaterEventType

waitForEventAsync

LogcatUpdaterEventParser.AsyncUpdaterEvent waitForEventAsync (UpdaterEventType expectedEvent, 
                long timeoutMs)

Wait for an event but do not block. Return an LogcatUpdaterEventParser.AsyncUpdaterEvent monitor which the caller may wait on and query.

Parameters
expectedEvent UpdaterEventType

timeoutMs long

Returns
LogcatUpdaterEventParser.AsyncUpdaterEvent

Protected methods

parseEventType

UpdaterEventType parseEventType (String lastLine)

Parse a logcat line and return the captured event (that were registered with registerEventTrigger(String, String, UpdaterEventType)) or null.

Parameters
lastLine String

Returns
UpdaterEventType

registerEventTrigger

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

Register an event of given logcat tag and message with the desired response. Message may be partial.

Parameters
tag String

msg String

response UpdaterEventType