DeviceImpl
public
final
class
DeviceImpl
extends Object
implements
IDevice
| java.lang.Object | |
| ↳ | com.android.tradefed.device.server.DeviceImpl |
デバイス。実機またはエミュレータを指定できます。
概要
パブリック コンストラクタ | |
|---|---|
DeviceImpl(ClientTracker clientTracer, String serialNumber, IDevice.DeviceState deviceState)
|
|
パブリック メソッド | |
|---|---|
boolean
|
arePropertiesSet()
プロパティがキャッシュに保存されている場合、 |
void
|
createForward(int localPort, String remoteSocketName, IDevice.DeviceUnixSocketNamespace namespace)
ローカル TCP ポートとリモート UNIX ドメイン ソケット間のポート転送を作成します。 |
void
|
createForward(int localPort, int remotePort)
ローカル ポートとリモート ポート間のポート転送を作成します。 |
void
|
createReverse(int remotePort, int localPort)
リモート ポートとローカル ポート間のポート反転を作成します。 |
void
|
executeBinderCommand(String[] parameters, IShellOutputReceiver receiver, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, InputStream is)
デバイスで Binder コマンドを実行し、結果を receiver に送信します。 デバイス OS とホスト ADB サーバーの両方が Android Binder Bridge 実行機能をサポートしている場合は、exec:cmd |
void
|
executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputResponse, TimeUnit maxTimeUnits)
デバイスでシェルコマンドを実行し、結果を receiver に送信します。 |
void
|
executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, InputStream is)
stdin を介して送信する入力ストリームを受け取ることができる executeShell コマンドのバージョン。 |
void
|
executeShellCommand(String command, IShellOutputReceiver receiver)
デバイスでシェルコマンドを実行し、結果を receiver に送信します。 これは、 |
void
|
executeShellCommand(String command, IShellOutputReceiver receiver, int maxTimeToOutputResponse)
|
void
|
executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits)
デバイスでシェルコマンドを実行し、結果を receiver に送信します。 |
void
|
forceStop(String applicationName)
アプリケーション名でアプリケーションを強制停止します。 |
|
getAbis()
このデバイスでサポートされている ABI を返します。 |
ListenableFuture<AvdData>
|
getAvdData()
エミュレータが実行している AVD に関する情報を返します。 |
String
|
getAvdName()
エミュレータが実行している AVD の名前を返します。 |
String
|
getAvdPath()
ファイル システム内の仮想デバイスの絶対パスを返します。 |
|
getBattery(long freshnessTime, TimeUnit timeUnit)
デバイスのバッテリー残量を 0 ~ 100% の範囲で返します。 |
|
getBattery()
デバイスのバッテリー残量を 0 ~ 100% の範囲で返します。 |
Integer
|
getBatteryLevel(long freshnessMs)
デバイスのバッテリー残量を 0 ~ 100% の範囲で返します。 |
Integer
|
getBatteryLevel()
デバイスのバッテリー残量を 0 ~ 100% の範囲で返します。 |
ClientImpl
|
getClient(String applicationName)
アプリケーション名で |
String
|
getClientName(int pid)
pid でクライアントの名前を返します。pid が不明な場合は |
ClientTracker
|
getClientTracker()
|
ClientImpl[]
|
getClients()
クライアントの配列を返します。 |
int
|
getDensity()
システム プロパティ |
FileListingService
|
getFileListingService()
このデバイスの |
String
|
getLanguage()
ユーザーの言語を返します。 |
InstallMetrics
|
getLastInstallMetrics()
このデバイスの最新のインストールに関する情報を取得します。 |
String
|
getMountPoint(String name)
マウント ポイントを返します。 |
String
|
getName()
このデバイスの(人間が判読可能な)名前を返します。 |
ClientImpl[]
|
getNativeClients()
|
ClientImpl
|
getNativeClients(String applicationName)
|
ProfileableClientImpl[]
|
getProfileableClients()
プロファイリング可能なクライアントの配列を返します。 |
|
getProperties()
キャッシュに保存されたデバイスのプロパティを返します。 |
String
|
getProperty(String name)
非常に短い待機時間で |
String
|
getPropertyCacheOrSync(String name)
キャッシュからプロパティを取得しようとする |
int
|
getPropertyCount()
このデバイスのプロパティの数を返します。 |
String
|
getPropertySync(String name)
キャッシュを使用せずに、デバイスから直接指定されたプロパティを取得しようとする |
String
|
getRegion()
ユーザーの地域を返します。 |
static
String
|
getScreenRecorderCommand(String remoteFilePath, ScreenRecorderOptions options)
|
RawImage
|
getScreenshot()
デバイスのスクリーンショットを撮影し、 |
RawImage
|
getScreenshot(long timeout, TimeUnit unit)
|
String
|
getSerialNumber()
デバイスのシリアル番号を返します。 |
IDevice.DeviceState
|
getState()
デバイスの状態を返します。 |
SyncService
|
getSyncService()
デバイスとの間でファイルを push / pull するための |
ListenableFuture<String>
|
getSystemProperty(String name)
システム プロパティの非同期クエリを実行する可能性があります。 |
boolean
|
hasClients()
|
void
|
installPackage(String packageFilePath, boolean reinstall, InstallReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, String... extraArgs)
デバイスに Android アプリケーションをインストールします。 |
void
|
installPackage(String packageFilePath, boolean reinstall, InstallReceiver receiver, String... extraArgs)
デバイスに Android アプリケーションをインストールします。 |
void
|
installPackage(String packageFilePath, boolean reinstall, String... extraArgs)
デバイスに Android アプリケーションをインストールします。 |
void
|
installPackages(
デフォルトのタイムアウトで、複数の APK ファイル(1 つのメイン パッケージと 0 ~ n 個の分割パッケージ)で構成される Android アプリケーションをインストールします。 |
void
|
installPackages(
複数の APK ファイル(1 つのメイン パッケージと 0 ~ n 個の分割パッケージ)で構成される Android アプリケーションをインストールします。 |
void
|
installRemotePackage(String remoteFilePath, boolean reinstall, InstallReceiver receiver, String... extraArgs)
デバイスの一時的な場所にプッシュされたアプリ パッケージをインストールします。 |
void
|
installRemotePackage(String remoteFilePath, boolean reinstall, String... extraArgs)
デバイスの一時的な場所にプッシュされたアプリ パッケージをインストールします。 |
void
|
installRemotePackage(String remoteFilePath, boolean reinstall, InstallReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, String... extraArgs)
デバイスの一時的な場所にプッシュされたアプリ パッケージをインストールします。 |
void
|
installRemotePackages(
デバイスのローカルに存在する複数の APK ファイルで構成される Android アプリケーションをデフォルトのタイムアウトでインストールします。 |
void
|
installRemotePackages(
デバイスにローカルに保存されている複数の APK ファイルで構成される Android アプリケーションをインストールします。 |
boolean
|
isBootLoader()
デバイスがブートローダー モードであるかどうかを返します。 |
boolean
|
isEmulator()
デバイスがエミュレータの場合、 |
boolean
|
isOffline()
デバイスがオフラインかどうかを返します。 |
boolean
|
isOnline()
デバイスの準備ができているかどうかを返します。 |
boolean
|
isRoot()
デバイスの現在のルート ステータスをクエリします。 |
void
|
kill(String applicationName)
アプリケーション名でアプリケーションを強制終了します。 |
void
|
pullFile(String remote, String local)
単一のファイルを取得します。 |
void
|
push(String[] local, String remote)
複数のファイルまたはディレクトリをプッシュします。 |
void
|
pushFile(String local, String remote)
単一のファイルをプッシュします。 |
SocketChannel
|
rawBinder(String service, String[] parameters)
リモート デバイスで Android Binder Bridge サービスを呼び出します。 |
SocketChannel
|
rawExec(String executable, String[] parameters)
リモート デバイスで host:exec サービスを呼び出します。 |
void
|
reboot(String into)
デバイスを再起動します。 |
void
|
removeForward(int localPort)
ローカル ポートとリモート ポート間のポート転送を削除します。 |
void
|
removeRemotePackage(String remoteFilePath)
デバイスからファイルを削除します。 |
void
|
removeReverse(int remotePort)
リモートポートとローカルポート間のポート反転を削除します。 |
boolean
|
root()
デバイスで root になるよう adb デーモンに要求します。 |
void
|
startScreenRecorder(String remoteFilePath, ScreenRecorderOptions options, IShellOutputReceiver receiver)
デバイスが |
boolean
|
supportsFeature(IDevice.HardwareFeature feature)
このデバイスが指定されたハードウェア機能をサポートしているかどうかを返します。 |
boolean
|
supportsFeature(IDevice.Feature feature)
このデバイスが指定されたソフトウェア機能をサポートしているかどうかを返します。 |
String
|
syncPackageToDevice(String localFilePath)
デバイスにファイルをプッシュします。 |
String
|
toString()
|
String
|
uninstallApp(String applicationID, String... extraArgs)
デバイスからアプリをアンインストールします。 |
String
|
uninstallPackage(String packageName)
デバイスからパッケージをアンインストールします。 |
パブリック コンストラクタ
DeviceImpl
public DeviceImpl (ClientTracker clientTracer, String serialNumber, IDevice.DeviceState deviceState)
| パラメータ | |
|---|---|
clientTracer |
ClientTracker |
serialNumber |
String |
deviceState |
IDevice.DeviceState |
パブリック メソッド
arePropertiesSet
public boolean arePropertiesSet ()
プロパティがキャッシュに保存されている場合は true を返します
| 戻り値 | |
|---|---|
boolean |
|
createForward
public void createForward (int localPort,
String remoteSocketName,
IDevice.DeviceUnixSocketNamespace namespace)ローカル TCP ポートとリモート UNIX ドメイン ソケット間のポート転送を作成します。
| パラメータ | |
|---|---|
localPort |
int: 転送するローカルポート |
remoteSocketName |
String: デバイスで作成された Unix ドメイン ソケットの名前 |
namespace |
IDevice.DeviceUnixSocketNamespace: UNIX ドメイン ソケットが作成された Namespace |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
createForward
public void createForward (int localPort,
int remotePort)ローカル ポートとリモート ポート間のポート転送を作成します。
| パラメータ | |
|---|---|
localPort |
int: 転送するローカルポート |
remotePort |
int: リモートポート。 |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
createReverse
public void createReverse (int remotePort,
int localPort)リモートポートとローカルポート間のポート反転を作成します。
| パラメータ | |
|---|---|
remotePort |
int: 反転するリモートポート。 |
localPort |
int: ローカルポート |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
executeBinderCommand
public void executeBinderCommand (String[] parameters,
IShellOutputReceiver receiver,
long maxTimeToOutputResponse,
TimeUnit maxTimeUnits,
InputStream is)デバイスで Binder コマンドを実行し、結果を receiver に送信します。
デバイス OS とホスト ADB サーバーの両方が Android Binder Bridge 実行機能をサポートしている場合は、exec:cmd
| パラメータ | |
|---|---|
parameters |
String: 実行するバインダ コマンド |
receiver |
IShellOutputReceiver: バインダ コマンドの出力を受け取る IShellOutputReceiver |
maxTimeToOutputResponse |
long |
maxTimeUnits |
TimeUnit |
is |
InputStream: stdin を介して送信する入力ストリーム(省略可) |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
executeShellCommand
public 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 |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver,
long maxTimeToOutputResponse,
TimeUnit maxTimeUnits,
InputStream is)stdin を介して送信する入力ストリームを受け取ることができる executeShell コマンドのバージョン。
| パラメータ | |
|---|---|
command |
String |
receiver |
IShellOutputReceiver |
maxTimeToOutputResponse |
long |
maxTimeUnits |
TimeUnit |
is |
InputStream |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver)デバイスでシェルコマンドを実行し、結果を receiver に送信します。
これは、
executeShellCommand(command, receiver, DdmPreferences.getTimeOut()) を呼び出すのと同様です。
| パラメータ | |
|---|---|
command |
String: 実行するシェルコマンド |
receiver |
IShellOutputReceiver: シェル コマンドの出力を受け取る IShellOutputReceiver |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver,
int maxTimeToOutputResponse)| パラメータ | |
|---|---|
command |
String |
receiver |
IShellOutputReceiver |
maxTimeToOutputResponse |
int |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
executeShellCommand
public 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 |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
forceStop
public void forceStop (String applicationName)
アプリケーション名を指定してアプリケーションを強制停止します。これにより、保留中のアラームとキューに登録された計算がすべて削除されます。
| パラメータ | |
|---|---|
applicationName |
String: アプリケーションの名前 |
getAbis
publicgetAbis ()
このデバイスでサポートされている ABI を返します。ABI は優先順に並べ替えられ、最初の ABI が最も優先されます。
| 戻り値 | |
|---|---|
|
ABI のリスト。 |
getAvdData
public ListenableFuture<AvdData> getAvdData ()
エミュレータが実行している AVD に関する情報を返します。
AvdData.getName は AVD の名前です。AVD がない場合は null です。
AvdData.getPath は、AVD パスです。実機の場合、エミュレータ コンソール サブコマンドが失敗した場合、またはエミュレータのバージョンが 30.0.18 より古い場合は null です。
| 戻り値 | |
|---|---|
ListenableFuture<AvdData> |
デバイスの AvdData。 |
getAvdName
public String getAvdName ()
エミュレータが実行している AVD の名前を返します。
これは、isEmulator() が true を返す場合にのみ有効です。
エミュレータが AVD を実行していない場合(たとえば、Android ソースツリー ビルドから実行されている場合)、このメソッドは「<build>」を返します。
注: タイムアウトを制御する場合は、getAvdData() を使用することをおすすめします。
| 戻り値 | |
|---|---|
String |
AVD の名前。存在しない場合は null。 |
getAvdPath
public String getAvdPath ()
ファイル システム内の仮想デバイスの絶対パスを返します。パスはオペレーティング システムに依存します。Linux では / 区切り文字、Windows では \ 区切り文字が使用されます。
注: タイムアウトを制御する場合は、getAvdData() を使用することをおすすめします。
| 戻り値 | |
|---|---|
String |
AVD パス。実機の場合、エミュレータ コンソール サブコマンドが失敗した場合、またはエミュレータのバージョンが 30.0.18 より古い場合は null |
getBattery
publicgetBattery (long freshnessTime, TimeUnit timeUnit)
デバイスのバッテリー残量を 0 ~ 100 パーセントで返します。
バッテリー残量がキャッシュに保存されている可能性があります。前回のクエリが成功してから
freshnessTime が期限切れになった場合にのみ、デバイスにバッテリー残量を問い合わせます。
| パラメータ | |
|---|---|
freshnessTime |
long: バッテリー残量の望ましい最新性 |
timeUnit |
TimeUnit: freshnessTime の ERROR(/TimeUnit) |
| 戻り値 | |
|---|---|
|
バッテリー残量のクエリに使用できる ERROR(/Future)。バッテリー残量を取得できなかった場合、Future は ERROR(/ExecutionException) を返します。 |
getBattery
publicgetBattery ()
デバイスのバッテリー残量を 0 ~ 100 パーセントで返します。
バッテリー残量がキャッシュに保存されている可能性があります。最後のクエリが成功してから 5 分経過した場合にのみ、デバイスにバッテリー残量を問い合わせます。
| 戻り値 | |
|---|---|
|
バッテリー残量のクエリに使用できる ERROR(/Future)。バッテリー残量を取得できなかった場合、Future は ERROR(/ExecutionException) を返します。 |
getBatteryLevel
public Integer getBatteryLevel (long freshnessMs)
デバイスのバッテリー残量を 0 ~ 100 パーセントで返します。
バッテリー残量がキャッシュに保存されている可能性があります。前回のクエリが成功してから
freshnessMs ミリ秒経過した場合にのみ、デバイスにバッテリー残量を問い合わせます。
| 戻り値 | |
|---|---|
Integer |
バッテリー残量、または取得できなかった場合は null |
getBatteryLevel
public Integer getBatteryLevel ()
デバイスのバッテリー残量を 0 ~ 100 パーセントで返します。
バッテリー残量がキャッシュに保存されている可能性があります。最後のクエリが成功してから 5 分経過した場合にのみ、デバイスにバッテリー残量を問い合わせます。
| 戻り値 | |
|---|---|
Integer |
バッテリー残量、または取得できなかった場合は null |
getClient
public ClientImpl getClient (String applicationName)
アプリケーション名で Client を返します。
| パラメータ | |
|---|---|
applicationName |
String: アプリケーションの名前 |
| 戻り値 | |
|---|---|
ClientImpl |
Client オブジェクト。一致するものが見つからない場合は null。 |
getClientName
public String getClientName (int pid)
pid でクライアントの名前を返します。pid が不明な場合は null を返します
| パラメータ | |
|---|---|
pid |
int: クライアントの pid。 |
| 戻り値 | |
|---|---|
String |
|
getDensity
public int getDensity ()
システム プロパティ PROP_DEVICE_DENSITY の値を読み取って、デバイス画面の密度バケットを返します。
| 戻り値 | |
|---|---|
int |
密度。判定できない場合は -1。 |
getFileListingService
public FileListingService getFileListingService ()
このデバイスの FileListingService を返します。
| 戻り値 | |
|---|---|
FileListingService |
|
getLanguage
public String getLanguage ()
ユーザーの言語を返します。
| 戻り値 | |
|---|---|
String |
ユーザーの言語。不明な場合は null |
getLastInstallMetrics
public InstallMetrics getLastInstallMetrics ()
このデバイスの最新のインストールに関する情報を取得します。
| 戻り値 | |
|---|---|
InstallMetrics |
インストールを説明する InstallMetrics 指標。 |
getMountPoint
public String getMountPoint (String name)
マウント ポイントを返します。
| パラメータ | |
|---|---|
name |
String: 返すマウント ポイントの名前 |
| 戻り値 | |
|---|---|
String |
|
getName
public String getName ()
このデバイスの(人間が判読可能な)名前を返します。通常、AVD の場合は AVD 名、デバイスの場合はメーカー名、モデル名、シリアル番号の組み合わせです。
| 戻り値 | |
|---|---|
String |
|
getNativeClients
public ClientImpl getNativeClients (String applicationName)
| パラメータ | |
|---|---|
applicationName |
String |
| 戻り値 | |
|---|---|
ClientImpl |
|
getProfileableClients
public ProfileableClientImpl[] getProfileableClients ()
プロファイリング可能なクライアントの配列を返します。
| 戻り値 | |
|---|---|
ProfileableClientImpl[] |
|
getProperties
publicgetProperties ()
キャッシュに保存されたデバイスのプロパティを返します。「getprop」の出力全体が含まれています。
| 戻り値 | |
|---|---|
|
|
getProperty
public String getProperty (String name)
非常に短い待機時間で IShellEnabledDevice.getSystemProperty(String) を介してプロパティを取得しようとし、例外を飲み込むコンビニエンス メソッド。
注: タイムアウトを制御する場合は、IShellEnabledDevice.getSystemProperty(String) を使用することをおすすめします。
| パラメータ | |
|---|---|
name |
String: 返す値の名前。 |
| 戻り値 | |
|---|---|
String |
値。プロパティ値がすぐに利用できない場合は null |
getPropertyCacheOrSync
public String getPropertyCacheOrSync (String name)
キャッシュからプロパティを取得しようとする getProperty(String) と getPropertySync(String) の組み合わせ。見つからない場合は、デバイスに直接クエリを同期的に試行し、成功した場合はキャッシュを再入力します。
| パラメータ | |
|---|---|
name |
String: 返す値の名前。 |
| 戻り値 | |
|---|---|
String |
値。プロパティが存在しない場合は null |
getPropertyCount
public int getPropertyCount ()
このデバイスのプロパティの数を返します。
| 戻り値 | |
|---|---|
int |
|
getPropertySync
public String getPropertySync (String name)
キャッシュを使用せずに、指定されたプロパティをデバイスから直接取得しようとする getProperty(String) のバリエーション。このメソッドは、揮発性プロパティにのみ使用する必要があります。
| パラメータ | |
|---|---|
name |
String: 返す値の名前。 |
| 戻り値 | |
|---|---|
String |
値。プロパティが存在しない場合は null |
getRegion
public String getRegion ()
ユーザーの地域を返します。
| 戻り値 | |
|---|---|
String |
ユーザーの地域。不明な場合は null |
getScreenRecorderCommand
public static String getScreenRecorderCommand (String remoteFilePath,
ScreenRecorderOptions options)| パラメータ | |
|---|---|
remoteFilePath |
String |
options |
ScreenRecorderOptions |
| 戻り値 | |
|---|---|
String |
|
getScreenshot
public RawImage getScreenshot ()
デバイスのスクリーンショットを撮影し、RawImage として返します。
| 戻り値 | |
|---|---|
RawImage |
エラーが発生した場合は、スクリーンショットを RawImage または null として返します。 |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
getScreenshot
public RawImage getScreenshot (long timeout, TimeUnit unit)
| パラメータ | |
|---|---|
timeout |
long |
unit |
TimeUnit |
| 戻り値 | |
|---|---|
RawImage |
|
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
getSerialNumber
public String getSerialNumber ()
デバイスのシリアル番号を返します。
| 戻り値 | |
|---|---|
String |
|
getSyncService
public SyncService getSyncService ()
デバイスとの間でファイルを push / pull するための SyncService オブジェクトを返します。
| 戻り値 | |
|---|---|
SyncService |
SyncService を作成できなかった場合は null。これは、IDevice が無効(または切断された)であるため、adb が接続を開くことを拒否した場合に発生する可能性があります。 |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
getSystemProperty
public ListenableFuture<String> getSystemProperty (String name)
システム プロパティの非同期クエリを実行します。
| パラメータ | |
|---|---|
name |
String: 返す値の名前。 |
| 戻り値 | |
|---|---|
ListenableFuture<String> |
ListenableFuture. ERROR(get/Future#get() get) は null を返すことがあります。 |
installPackage
public void installPackage (String packageFilePath,
boolean reinstall,
InstallReceiver receiver,
long maxTimeout,
long maxTimeToOutputResponse,
TimeUnit maxTimeUnits,
String... extraArgs)デバイスに Android アプリケーションをインストールします。これは、syncPackageToDevice、installRemotePackage、removePackage の手順を組み合わせたヘルパー メソッドです。
| パラメータ | |
|---|---|
packageFilePath |
String: インストールするローカルホスト上のファイルへの絶対ファイル システム パス |
reinstall |
boolean: アプリの再インストールを実行する場合は true に設定します |
receiver |
InstallReceiver: インストールをモニタリングして最終ステータスを取得するために使用される InstallReceiver。 |
maxTimeout |
long: コマンドが戻るまでの最大タイムアウト。値 0 は、最大タイムアウトが適用されないことを意味します。 |
maxTimeToOutputResponse |
long: コマンドがレスポンスを出力しないことが許容される最大時間。値が 0 の場合、メソッドはコマンド出力が返されるまで(receiver が実行をキャンセルするまで)永久に待機し、例外をスローしません。 |
maxTimeUnits |
TimeUnit: ゼロ以外の maxTimeout 値と maxTimeToOutputResponse 値の単位。 |
extraArgs |
String: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
| 例外 | |
|---|---|
InstallException |
|
installPackage
public void installPackage (String packageFilePath,
boolean reinstall,
InstallReceiver receiver,
String... extraArgs)デバイスに Android アプリケーションをインストールします。これは、syncPackageToDevice、installRemotePackage、removePackage の手順を組み合わせたヘルパー メソッドです。
| パラメータ | |
|---|---|
packageFilePath |
String: インストールするローカルホスト上のファイルへの絶対ファイル システム パス |
reinstall |
boolean: アプリの再インストールを実行する場合は true に設定します |
receiver |
InstallReceiver: インストールをモニタリングして最終ステータスを取得するために使用される InstallReceiver。 |
extraArgs |
String: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
| 例外 | |
|---|---|
InstallException |
|
installPackage
public void installPackage (String packageFilePath,
boolean reinstall,
String... extraArgs)デバイスに Android アプリケーションをインストールします。これは、syncPackageToDevice、installRemotePackage、removePackage の手順を組み合わせたヘルパー メソッドです。
| パラメータ | |
|---|---|
packageFilePath |
String: インストールするローカルホスト上のファイルへの絶対ファイル システム パス |
reinstall |
boolean: アプリの再インストールを実行する場合は true に設定します |
extraArgs |
String: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
| 例外 | |
|---|---|
InstallException |
|
installPackages
public void installPackages (apks, boolean reinstall, installOptions)
デフォルトのタイムアウトで、複数の APK ファイル(1 つのメイン パッケージと 0 ~ n 個の分割パッケージ)で構成される Android アプリケーションをインストールします
| パラメータ | |
|---|---|
apks |
: インストールする APK のリスト(1 つのメイン APK + 0 ~ n 個の分割 APK) |
reinstall |
boolean: アプリの再インストールを実行する場合は true に設定します |
installOptions |
: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
| 例外 | |
|---|---|
InstallException |
|
installPackages
public void installPackages (apks, boolean reinstall, installOptions, long timeout, TimeUnit timeoutUnit)
複数の APK ファイル(1 つのメイン パッケージと 0 ~ n 個の分割パッケージ)で構成される Android アプリケーションをインストールします。
| パラメータ | |
|---|---|
apks |
: インストールする APK のリスト(1 つのメイン APK + 0 ~ n 個の分割 APK) |
reinstall |
boolean: アプリの再インストールを実行する場合は true に設定します |
installOptions |
: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
timeout |
long: インストールのタイムアウト |
timeoutUnit |
TimeUnit: タイムアウト パラメータに対応する ERROR(/TimeUnit) |
| 例外 | |
|---|---|
InstallException |
|
installRemotePackage
public void installRemotePackage (String remoteFilePath,
boolean reinstall,
InstallReceiver receiver,
String... extraArgs)デバイスの一時的な場所にプッシュされたアプリ パッケージをインストールします。
| パラメータ | |
|---|---|
remoteFilePath |
String: デバイス上のパッケージ ファイルの絶対ファイルパス |
reinstall |
boolean: アプリの再インストールを実行する場合は true に設定します |
receiver |
InstallReceiver: インストールをモニタリングして最終ステータスを取得するために使用される InstallReceiver。 |
extraArgs |
String: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
| 例外 | |
|---|---|
InstallException |
|
installRemotePackage
public void installRemotePackage (String remoteFilePath,
boolean reinstall,
String... extraArgs)デバイスの一時的な場所にプッシュされたアプリ パッケージをインストールします。
| パラメータ | |
|---|---|
remoteFilePath |
String: デバイス上のパッケージ ファイルの絶対ファイルパス |
reinstall |
boolean: アプリの再インストールを実行する場合は true に設定します |
extraArgs |
String: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
| 例外 | |
|---|---|
InstallException |
|
installRemotePackage
public void installRemotePackage (String remoteFilePath,
boolean reinstall,
InstallReceiver receiver,
long maxTimeout,
long maxTimeToOutputResponse,
TimeUnit maxTimeUnits,
String... extraArgs)デバイスの一時的な場所にプッシュされたアプリ パッケージをインストールします。
| パラメータ | |
|---|---|
remoteFilePath |
String: デバイス上のパッケージ ファイルの絶対ファイルパス |
reinstall |
boolean: アプリの再インストールを実行する場合は true に設定します |
receiver |
InstallReceiver: インストールをモニタリングして最終ステータスを取得するために使用される InstallReceiver。 |
maxTimeout |
long: コマンドが戻るまでの最大タイムアウト。値 0 は、最大タイムアウトが適用されないことを意味します。 |
maxTimeToOutputResponse |
long: コマンドがレスポンスを出力しないことが許容される最大時間。値が 0 の場合、メソッドはコマンド出力が返されるまで(receiver が実行をキャンセルするまで)永久に待機し、例外をスローしません。 |
maxTimeUnits |
TimeUnit: ゼロ以外の maxTimeout 値と maxTimeToOutputResponse 値の単位。 |
extraArgs |
String: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
| 例外 | |
|---|---|
InstallException |
|
installRemotePackages
public void installRemotePackages (remoteApks, boolean reinstall, installOptions)
デフォルトのタイムアウトで、デバイスのローカルに存在する複数の APK ファイルで構成される Android アプリケーションをインストールします
| パラメータ | |
|---|---|
remoteApks |
: インストールするデバイス上の APK ファイルパスのリスト |
reinstall |
boolean: アプリの再インストールを実行する場合は true に設定します |
installOptions |
: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
| 例外 | |
|---|---|
InstallException |
|
installRemotePackages
public void installRemotePackages (remoteApks, boolean reinstall, installOptions, long timeout, TimeUnit timeoutUnit)
デバイスにローカルに保存されている複数の APK ファイルで構成される Android アプリケーションをインストールします
| パラメータ | |
|---|---|
remoteApks |
: インストールするデバイス上の APK ファイルパスのリスト |
reinstall |
boolean: アプリの再インストールを実行する場合は true に設定します |
installOptions |
: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
timeout |
long: インストールのタイムアウト |
timeoutUnit |
TimeUnit: タイムアウト パラメータに対応する ERROR(/TimeUnit) |
| 例外 | |
|---|---|
InstallException |
|
isBootLoader
public boolean isBootLoader ()
デバイスがブートローダー モードかどうかを返します。
| 戻り値 | |
|---|---|
boolean |
getState() が DeviceState.BOOTLOADER を返す場合、true。 |
isEmulator
public boolean isEmulator ()
デバイスがエミュレータの場合、true を返します。
| 戻り値 | |
|---|---|
boolean |
|
isOffline
public boolean isOffline ()
デバイスがオフラインかどうかを返します。
| 戻り値 | |
|---|---|
boolean |
getState() が DeviceState.OFFLINE を返す場合、true。 |
isOnline
public boolean isOnline ()
デバイスの準備ができているかどうかを返します。
| 戻り値 | |
|---|---|
boolean |
getState() が DeviceState.ONLINE を返す場合、true。 |
isRoot
public boolean isRoot ()
デバイスの現在のルート ステータスをクエリします。詳しくは、「adb root」をご覧ください。
| 戻り値 | |
|---|---|
boolean |
adb デーモンが root として実行されている場合は true、それ以外の場合は false。 |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
中断 中止 止めて
public void kill (String applicationName)
アプリケーション名でアプリケーションを強制終了します。この操作ではアクティビティのみが破棄され、状態は Android システムに残ります。
| パラメータ | |
|---|---|
applicationName |
String: アプリケーションの名前 |
pullFile
public void pullFile (String remote,
String local)単一のファイルを取得します。
| パラメータ | |
|---|---|
remote |
String: リモート ファイルのフルパス |
local |
String: ローカル宛先。 |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
SyncException |
|
TimeoutException |
|
プッシュ
public void push (String[] local,
String remote)複数のファイルまたはディレクトリをプッシュします。
| パラメータ | |
|---|---|
local |
String: プッシュするローカル ファイル |
remote |
String: ディレクトリを表すリモートパス |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
SyncException |
|
TimeoutException |
|
pushFile
public void pushFile (String local,
String remote)単一のファイルをプッシュします。
| パラメータ | |
|---|---|
local |
String: ローカル ファイルパス。 |
remote |
String: リモート ファイルパス |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
SyncException |
|
TimeoutException |
|
rawBinder
public SocketChannel rawBinder (String service,
String[] parameters)リモート デバイスで Android Binder Bridge サービスを呼び出します。デバイス バインダ コマンドに接続されているソケット チャネルを返します。
SocketChannel の所有権は呼び出し元に譲渡されます。使用後は明示的に閉じる必要があります。
| パラメータ | |
|---|---|
service |
String: 接続する Android サービスの名前 |
parameters |
String: バインダ コマンドのパラメータ |
| 戻り値 | |
|---|---|
SocketChannel |
デバイス上の実行中のプロセスに接続された SocketChannel。使用後。 |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
rawExec
public SocketChannel rawExec (String executable,
String[] parameters)リモート デバイスで host:exec サービスを呼び出します。実行中のプロセスに接続されているソケット チャネルを返します。exec サービスは stdout と stderr を区別しないため、ソケットから読み取られたものはどちらの出力からでも取得でき、インターリーブされる可能性があります。
SocketChannel の所有権は呼び出し元に譲渡されます。使用後は明示的に閉じる必要があります。
| パラメータ | |
|---|---|
executable |
String |
parameters |
String |
| 戻り値 | |
|---|---|
SocketChannel |
デバイス上の実行中のプロセスに接続された SocketChannel。使用後。 |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
再起動
public void reboot (String into)
デバイスを再起動します。
| パラメータ | |
|---|---|
into |
String: 再起動するブートローダー名。デバイスを再起動するだけの場合は null。 |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
removeForward
public void removeForward (int localPort)
ローカルポートとリモートポート間のポート転送を削除します。
| パラメータ | |
|---|---|
localPort |
int: 転送するローカルポート |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
removeRemotePackage
public void removeRemotePackage (String remoteFilePath)
デバイスからファイルを削除します。
| パラメータ | |
|---|---|
remoteFilePath |
String: 削除するファイルのデバイス上のパス |
| 例外 | |
|---|---|
InstallException |
|
removeReverse
public void removeReverse (int remotePort)
リモートポートとローカルポート間のポート反転を削除します。
| パラメータ | |
|---|---|
remotePort |
int: リモートポート。 |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
ルート
public boolean root ()
デバイスで adb デーモンを root にするようリクエストします。これはサイレントに失敗する可能性があり、デベロッパー ビルドでのみ成功します。詳しくは、「adb root」をご覧ください。
| 戻り値 | |
|---|---|
boolean |
adb デーモンが root として実行されている場合は true、それ以外の場合は false。 |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
startScreenRecorder
public void startScreenRecorder (String remoteFilePath,
ScreenRecorderOptions options,
IShellOutputReceiver receiver)デバイスが IDevice.Feature.SCREEN_RECORD をサポートしている場合、デバイスで画面録画を開始します。
| パラメータ | |
|---|---|
remoteFilePath |
String |
options |
ScreenRecorderOptions |
receiver |
IShellOutputReceiver |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
supportsFeature
public boolean supportsFeature (IDevice.HardwareFeature feature)
このデバイスが指定されたハードウェア機能をサポートしているかどうかを返します。
| パラメータ | |
|---|---|
feature |
IDevice.HardwareFeature |
| 戻り値 | |
|---|---|
boolean |
|
supportsFeature
public boolean supportsFeature (IDevice.Feature feature)
このデバイスが指定されたソフトウェア機能をサポートしているかどうかを返します。
| パラメータ | |
|---|---|
feature |
IDevice.Feature |
| 戻り値 | |
|---|---|
boolean |
|
syncPackageToDevice
public String syncPackageToDevice (String localFilePath)
デバイスにファイルをプッシュします
| パラメータ | |
|---|---|
localFilePath |
String: ローカルホスト上のファイルへの絶対パス |
| 戻り値 | |
|---|---|
String |
デバイス上のファイルの String の宛先パス |
| 例外 | |
|---|---|
AdbCommandRejectedException |
|
SyncException |
|
TimeoutException |
|
toString
public String toString ()
| 戻り値 | |
|---|---|
String |
|
uninstallApp
public String uninstallApp (String applicationID,
String... extraArgs)デバイスからアプリをアンインストールします。
| パラメータ | |
|---|---|
applicationID |
String: アンインストールする Android アプリケーション ID |
extraArgs |
String: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。 |
| 戻り値 | |
|---|---|
String |
エラーコードを含む String、または成功した場合は null。 |
| 例外 | |
|---|---|
InstallException |
|
uninstallPackage
public String uninstallPackage (String packageName)
デバイスからパッケージをアンインストールします。
| パラメータ | |
|---|---|
packageName |
String: アンインストールする Android アプリケーション ID |
| 戻り値 | |
|---|---|
String |
エラーコードを含む String、または成功した場合は null。 |
| 例外 | |
|---|---|
InstallException |
|