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 の行を解析し、キャプチャされたイベント(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 ITestDevice: logcat の読み取り元

パブリック メソッド

閉じる

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