IShellEnabledDevice

public interface IShellEnabledDevice

com.android.ddmlib.IShellEnabledDevice


シェルコマンドを受信できる抽象デバイス。

概要

パブリック メソッド

abstract void executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputResponse, TimeUnit maxTimeUnits)

デバイスでシェルコマンドを実行し、結果を receiver に送信します。

abstract void executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits)

デバイスでシェルコマンドを実行し、結果を receiver に送信します。

abstract String getName()

このデバイスの(人間が判読可能な)名前を返します。

abstract ListenableFuture<String> getSystemProperty(String name)

システム プロパティの非同期クエリを実行する可能性があります。

パブリック メソッド

executeShellCommand

public abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeToOutputResponse, 
                TimeUnit maxTimeUnits)

デバイスでシェルコマンドを実行し、結果を receiver に送信します。

maxTimeToOutputResponse は、デバイスからのコマンド出力を待機する際の最大待機時間として使用されます。
maxTimeToOutputResponse より長い期間、シェルコマンドが何も出力しない場合、メソッドは ShellCommandUnresponsiveException をスローします。

ログ出力などのコマンドでは、maxTimeToOutputResponse 値 0 を使用する必要があります。これは、メソッドが例外をスローせず、受信側の IShellOutputReceiver.isCancelled()true を返すまでブロックすることを意味します。

パラメータ
command String: 実行するシェルコマンド

receiver IShellOutputReceiver: シェル コマンドの出力を受け取る IShellOutputReceiver

maxTimeToOutputResponse long: コマンドがレスポンスを出力しないことが許容される最大時間。値が 0 の場合、メソッドはコマンド出力が返されるまで(receiver が実行をキャンセルするまで)永久に待機し、例外をスローしません。

maxTimeUnits TimeUnit: ゼロ以外の maxTimeToOutputResponse 値の単位。

例外
TimeoutException コマンドの送信時に接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合。
ShellCommandUnresponsiveException シェルコマンドが maxTimeToOutputResponse より長い期間にわたって出力を送信しない場合。
接続で I/O エラーが発生した場合。

executeShellCommand

public abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeout, 
                long maxTimeToOutputResponse, 
                TimeUnit maxTimeUnits)

デバイスでシェルコマンドを実行し、結果を receiver に送信します。

maxTimeToOutputResponse は、デバイスからのコマンド出力を待機する際の最大待機時間として使用されます。
maxTimeToOutputResponse より長い期間、シェルコマンドが何も出力しない場合、メソッドは ShellCommandUnresponsiveException をスローします。

ログ出力などのコマンドでは、maxTimeToOutputResponse 値 0 を使用する必要があります。これは、メソッドが例外をスローせず、受信側の IShellOutputReceiver.isCancelled()true を返すまでブロックすることを意味します。

パラメータ
command String: 実行するシェルコマンド

receiver IShellOutputReceiver: シェル コマンドの出力を受け取る IShellOutputReceiver

maxTimeout long: コマンドが戻るまでの最大タイムアウト。値 0 は、最大タイムアウトが適用されないことを意味します。

maxTimeToOutputResponse long: コマンドがレスポンスを出力しないことが許容される最大時間。値が 0 の場合、メソッドはコマンド出力が返されるまで(receiver が実行をキャンセルするまで)永久に待機し、例外をスローしません。

maxTimeUnits TimeUnit: ゼロ以外の maxTimeout 値と maxTimeToOutputResponse 値の単位。

例外
TimeoutException コマンドの送信時に接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合。
ShellCommandUnresponsiveException シェルコマンドが maxTimeToOutputResponse より長い期間にわたって出力を送信しない場合。
接続で I/O エラーが発生した場合。

getName

public abstract String getName ()

このデバイスの(人間が判読可能な)名前を返します。通常、AVD の場合は AVD 名、デバイスの場合はメーカー名、モデル名、シリアル番号の組み合わせです。

戻り値
String

getSystemProperty

public abstract ListenableFuture<String> getSystemProperty (String name)

システム プロパティの非同期クエリを実行します。

パラメータ
name String: 返す値の名前。

戻り値
ListenableFuture<String> ListenableFuture. ERROR(get/Future#get() get) は null を返すことがあります。