IShellEnabledDevice
public
interface
IShellEnabledDevice
| com.android.ddmlib.IShellEnabledDevice |
可接收殼層指令的抽象裝置。
摘要
公用方法 | |
|---|---|
abstract
void
|
executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits)
在裝置上執行殼層指令,並將結果傳送至 receiver。 |
abstract
void
|
executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputResponse, TimeUnit maxTimeUnits)
在裝置上執行殼層指令,並將結果傳送至 receiver。 |
abstract
String
|
getName()
傳回這部裝置的 (人性化) 名稱。 |
abstract
ListenableFuture<String>
|
getSystemProperty(String name)
對系統屬性執行潛在的非同步查詢。 |
公用方法
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 值的單位。 |
| 擲回 | |
|---|---|
AdbCommandRejectedException |
如果 ADB 拒絕指令。 |
ShellCommandUnresponsiveException |
如果殼層指令在超過 maxTimeToOutputResponse 的時間內未傳送任何輸出內容,則會發生這種情況。 |
TimeoutException |
如果傳送指令時連線逾時, |
IOException |
(如果連線發生 I/O 錯誤)。 |
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 值的單位。 |
| 擲回 | |
|---|---|
AdbCommandRejectedException |
如果 ADB 拒絕指令。 |
ShellCommandUnresponsiveException |
如果殼層指令在超過 maxTimeToOutputResponse 的時間內未傳送任何輸出內容,則會發生這種情況。 |
TimeoutException |
如果傳送指令時連線逾時, |
IOException |
(如果連線發生 I/O 錯誤)。 |
getName
public abstract String getName ()
傳回這部裝置的 (人性化) 名稱。一般來說,AVD 的名稱是 AVD 名稱,裝置的名稱則是製造商名稱、型號名稱和序號的組合。
| 傳回 | |
|---|---|
String |
|
getSystemProperty
public abstract ListenableFuture<String> getSystemProperty (String name)
對系統屬性執行潛在的非同步查詢。
| 參數 | |
|---|---|
name |
String:要傳回的值名稱。 |
| 傳回 | |
|---|---|
ListenableFuture<String> |
ListenableFuture. get 可能會傳回空值。 |