GenericLogcatEventParser

public class GenericLogcatEventParser
extends Object implements Closeable

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 の行を解析し、キャプチャされたイベント(registerEventTrigger(String,String,LogcatEventType) で登録されたイベント)をイベントキューに追加します。

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 logcat の読み取り元となる ITestDevice

パブリック メソッド

閉じる

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

例外
InterruptedException