IDevice

public interface IDevice
implements IShellEnabledDevice

com.android.ddmlib.IDevice


デバイス。実機またはエミュレータを指定できます。

概要

定数

int CHANGE_BUILD_INFO

デバイス変更ビットマスク: ビルド情報の変更。

int CHANGE_CLIENT_LIST

デバイス変更ビットマスク: Client リストの変更。

int CHANGE_PROFILEABLE_CLIENT_LIST

デバイス変更ビットマスク: ProfileableClient リストの変更。

int CHANGE_STATE

デバイス変更ビットマスク: DeviceState 変更。

String FIRST_EMULATOR_SN

最初に接続されたエミュレータのシリアル番号。

String MNT_DATA

String MNT_EXTERNAL_STORAGE

String MNT_ROOT

String PROP_BUILD_API_LEVEL

String PROP_BUILD_CHARACTERISTICS

String PROP_BUILD_CODENAME

String PROP_BUILD_TAGS

String PROP_BUILD_TYPE

String PROP_BUILD_VERSION

String PROP_BUILD_VERSION_NUMBER

この定数は非推奨になりました。 PROP_BUILD_API_LEVEL を使用します。

String PROP_DEBUGGABLE

String PROP_DEVICE_CPU_ABI

String PROP_DEVICE_CPU_ABI2

String PROP_DEVICE_CPU_ABI_LIST

String PROP_DEVICE_DENSITY

String PROP_DEVICE_EMULATOR_DENSITY

String PROP_DEVICE_LANGUAGE

String PROP_DEVICE_MANUFACTURER

String PROP_DEVICE_MODEL

String PROP_DEVICE_REGION

String RE_EMULATOR_SN

エミュレータのシリアル番号の正規表現。

String UNKNOWN_PACKAGE

パブリック メソッド

abstract boolean arePropertiesSet()

プロパティがキャッシュに保存されている場合、true を返します。

abstract void createForward(int localPort, String remoteSocketName, IDevice.DeviceUnixSocketNamespace namespace)

ローカル TCP ポートとリモート UNIX ドメイン ソケット間のポート転送を作成します。

abstract void createForward(int localPort, int remotePort)

ローカル ポートとリモート ポート間のポート転送を作成します。

default void createReverse(int remotePort, int localPort)

リモート ポートとローカル ポート間のポート反転を作成します。

default void executeBinderCommand(String[] parameters, IShellOutputReceiver receiver, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, InputStream is)

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

デバイス OS とホスト ADB サーバーの両方が Android Binder Bridge 実行機能をサポートしている場合は、exec:cmd 呼び出しまたはより高速な abb_exec: を使用します。

default void executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, InputStream is)

stdin を介して送信する入力ストリームを受け取ることができる executeShell コマンドのバージョン。

abstract void executeShellCommand(String command, IShellOutputReceiver receiver)

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

これは、 executeShellCommand(command, receiver, DdmPreferences.getTimeOut()) を呼び出すのと同様です。

abstract void executeShellCommand(String command, IShellOutputReceiver receiver, int maxTimeToOutputResponse)

このメソッドは非推奨です。IShellEnabledDevice.executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit) を使用します。

default void forceStop(String applicationName)

アプリケーション名でアプリケーションを強制停止します。

abstract getAbis()

このデバイスでサポートされている ABI を返します。

default ListenableFuture<AvdData> getAvdData()

エミュレータが実行している AVD に関する情報を返します。

abstract String getAvdName()

エミュレータが実行している AVD の名前を返します。

abstract String getAvdPath()

ファイル システム内の仮想デバイスの絶対パスを返します。

abstract getBattery(long freshnessTime, TimeUnit timeUnit)

デバイスのバッテリー残量を 0 ~ 100% の範囲で返します。

abstract getBattery()

デバイスのバッテリー残量を 0 ~ 100% の範囲で返します。

abstract Integer getBatteryLevel(long freshnessMs)

このメソッドは非推奨です。getBattery(long, TimeUnit) を使用します。

abstract Integer getBatteryLevel()

このメソッドは非推奨です。getBattery() を使用します。

abstract Client getClient(String applicationName)

アプリケーション名で Client を返します。

abstract String getClientName(int pid)

pid でクライアントの名前を返します。pid が不明な場合は null を返します。

abstract Client[] getClients()

クライアントの配列を返します。

abstract int getDensity()

システム プロパティ PROP_DEVICE_DENSITY の値を読み取って、デバイス画面の密度バケットを返します。

abstract FileListingService getFileListingService()

このデバイスの FileListingService を返します。

default getHardwareCharacteristics()

ビルド特性プロパティを読み取って取得した特徴を返します。

abstract String getLanguage()

ユーザーの言語を返します。

default InstallMetrics getLastInstallMetrics()

このデバイスの最新のインストールに関する情報を取得します。

abstract String getMountPoint(String name)

マウント ポイントを返します。

default ProfileableClient[] getProfileableClients()

プロファイリング可能なクライアントの配列を返します。

abstract getProperties()

このメソッドは非推奨です。代わりに IShellEnabledDevice.getSystemProperty(String) を使用してください。

abstract String getProperty(String name)

非常に短い待機時間で IShellEnabledDevice.getSystemProperty(String) を介してプロパティを取得しようとし、例外を飲み込むコンビニエンス メソッド。

abstract String getPropertyCacheOrSync(String name)

このメソッドは非推奨です。代わりに IShellEnabledDevice.getSystemProperty(String) を使用してください。

abstract int getPropertyCount()

このメソッドは非推奨です。実装の詳細

abstract String getPropertySync(String name)

このメソッドは非推奨です。IShellEnabledDevice.getSystemProperty(String) を使用します。

abstract String getRegion()

ユーザーの地域を返します。

abstract RawImage getScreenshot()

デバイスのスクリーンショットを撮影し、RawImage として返します。

abstract RawImage getScreenshot(long timeout, TimeUnit unit)
abstract String getSerialNumber()

デバイスのシリアル番号を返します。

abstract IDevice.DeviceState getState()

デバイスの状態を返します。

abstract SyncService getSyncService()

デバイスとの間でファイルを push / pull するための SyncService オブジェクトを返します。

abstract boolean hasClients()

IDeviceClient があるかどうかを返します。

abstract void installPackage(String packageFilePath, boolean reinstall, InstallReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, String... extraArgs)

デバイスに Android アプリケーションをインストールします。

abstract void installPackage(String packageFilePath, boolean reinstall, InstallReceiver receiver, String... extraArgs)

デバイスに Android アプリケーションをインストールします。

abstract void installPackage(String packageFilePath, boolean reinstall, String... extraArgs)

デバイスに Android アプリケーションをインストールします。

default void installPackages( apks, boolean reinstall, installOptions)

デフォルトのタイムアウトで、複数の APK ファイル(1 つのメイン パッケージと 0 ~ n 個の分割パッケージ)で構成される Android アプリケーションをインストールします。

abstract void installPackages( apks, boolean reinstall, installOptions, long timeout, TimeUnit timeoutUnit)

複数の APK ファイル(1 つのメイン パッケージと 0 ~ n 個の分割パッケージ)で構成される Android アプリケーションをインストールします。

abstract void installRemotePackage(String remoteFilePath, boolean reinstall, InstallReceiver receiver, String... extraArgs)

デバイスの一時的な場所にプッシュされたアプリ パッケージをインストールします。

abstract void installRemotePackage(String remoteFilePath, boolean reinstall, String... extraArgs)

デバイスの一時的な場所にプッシュされたアプリ パッケージをインストールします。

abstract void installRemotePackage(String remoteFilePath, boolean reinstall, InstallReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, String... extraArgs)

デバイスの一時的な場所にプッシュされたアプリ パッケージをインストールします。

default void installRemotePackages( remoteApks, boolean reinstall, installOptions)

デバイスのローカルに存在する複数の APK ファイルで構成される Android アプリケーションをデフォルトのタイムアウトでインストールします。

default void installRemotePackages( remoteApks, boolean reinstall, installOptions, long timeout, TimeUnit timeoutUnit)

デバイスにローカルに保存されている複数の APK ファイルで構成される Android アプリケーションをインストールします。

abstract boolean isBootLoader()

デバイスがブートローダー モードであるかどうかを返します。

abstract boolean isEmulator()

デバイスがエミュレータの場合、true を返します。

abstract boolean isOffline()

デバイスがオフラインかどうかを返します。

abstract boolean isOnline()

デバイスの準備ができているかどうかを返します。

abstract boolean isRoot()

デバイスの現在のルート ステータスをクエリします。

default void kill(String applicationName)

アプリケーション名でアプリケーションを強制終了します。

abstract void pullFile(String remote, String local)

単一のファイルを取得します。

default void push(String[] local, String remote)

複数のファイルまたはディレクトリをプッシュします。

abstract void pushFile(String local, String remote)

単一のファイルをプッシュします。

default SocketChannel rawBinder(String service, String[] parameters)

リモート デバイスで Android Binder Bridge サービスを呼び出します。

default SocketChannel rawExec(String executable, String[] parameters)

リモート デバイスで host:exec サービスを呼び出します。

abstract void reboot(String into)

デバイスを再起動します。

default void removeForward(int localPort)

ローカル ポートとリモート ポート間のポート転送を削除します。

default void removeForward(int localPort, int remotePort)

このメソッドは非推奨です。removeForward(int) を使用します。

default void removeForward(int localPort, String remoteSocketName, IDevice.DeviceUnixSocketNamespace namespace)

このメソッドは非推奨です。removeForward(int) を使用します。

abstract void removeRemotePackage(String remoteFilePath)

デバイスからファイルを削除します。

default void removeReverse(int remotePort)

リモートポートとローカルポート間のポート反転を削除します。

abstract boolean root()

デバイスで root になるよう adb デーモンに要求します。

abstract void startScreenRecorder(String remoteFilePath, ScreenRecorderOptions options, IShellOutputReceiver receiver)

デバイスが IDevice.Feature.SCREEN_RECORD をサポートしている場合、デバイスで画面録画を開始します。

abstract boolean supportsFeature(IDevice.HardwareFeature feature)

このデバイスが指定されたハードウェア機能をサポートしているかどうかを返します。

abstract boolean supportsFeature(IDevice.Feature feature)

このデバイスが指定されたソフトウェア機能をサポートしているかどうかを返します。

abstract String syncPackageToDevice(String localFilePath)

デバイスにファイルをプッシュします。

abstract String uninstallApp(String applicationID, String... extraArgs)

デバイスからアプリをアンインストールします。

abstract String uninstallPackage(String packageName)

デバイスからパッケージをアンインストールします。

定数

CHANGE_BUILD_INFO

public static final int CHANGE_BUILD_INFO

デバイス変更ビットマスク: ビルド情報の変更。

定数値: 4 (0x00000004)

CHANGE_CLIENT_LIST

public static final int CHANGE_CLIENT_LIST

デバイス変更ビットマスク: Client リストの変更。

定数値: 2 (0x00000002)

CHANGE_PROFILEABLE_CLIENT_LIST

public static final int CHANGE_PROFILEABLE_CLIENT_LIST

デバイス変更ビットマスク: ProfileableClient リストの変更。

定数値: 8 (0x00000008)

CHANGE_STATE

public static final int CHANGE_STATE

デバイス変更ビットマスク: DeviceState の変更。

定数値: 1 (0x00000001)

FIRST_EMULATOR_SN

public static final String FIRST_EMULATOR_SN

最初に接続されたエミュレータのシリアル番号。

定数値: "emulator-5554"

MNT_DATA

public static final String MNT_DATA

定数値: "ANDROID_DATA"

MNT_EXTERNAL_STORAGE

public static final String MNT_EXTERNAL_STORAGE

定数値: "EXTERNAL_STORAGE"

MNT_ROOT

public static final String MNT_ROOT

定数値: "ANDROID_ROOT"

PROP_BUILD_API_LEVEL

public static final String PROP_BUILD_API_LEVEL

定数値: "ro.build.version.sdk"

PROP_BUILD_CHARACTERISTICS

public static final String PROP_BUILD_CHARACTERISTICS

定数値: "ro.build.characteristics"

PROP_BUILD_CODENAME

public static final String PROP_BUILD_CODENAME

定数値: "ro.build.version.codename"

PROP_BUILD_TAGS

public static final String PROP_BUILD_TAGS

定数値: "ro.build.tags"

PROP_BUILD_TYPE

public static final String PROP_BUILD_TYPE

定数値: "ro.build.type"

PROP_BUILD_VERSION

public static final String PROP_BUILD_VERSION

定数値: "ro.build.version.release"

PROP_BUILD_VERSION_NUMBER

public static final String PROP_BUILD_VERSION_NUMBER

この定数は非推奨です。
PROP_BUILD_API_LEVEL を使用します。

定数値: "ro.build.version.sdk"

PROP_DEBUGGABLE

public static final String PROP_DEBUGGABLE

定数値: "ro.debuggable"

PROP_DEVICE_CPU_ABI

public static final String PROP_DEVICE_CPU_ABI

定数値: "ro.product.cpu.abi"

PROP_DEVICE_CPU_ABI2

public static final String PROP_DEVICE_CPU_ABI2

定数値: "ro.product.cpu.abi2"

PROP_DEVICE_CPU_ABI_LIST

public static final String PROP_DEVICE_CPU_ABI_LIST

定数値: "ro.product.cpu.abilist"

PROP_DEVICE_DENSITY

public static final String PROP_DEVICE_DENSITY

定数値: "ro.sf.lcd_density"

PROP_DEVICE_EMULATOR_DENSITY

public static final String PROP_DEVICE_EMULATOR_DENSITY

定数値: "qemu.sf.lcd_density"

PROP_DEVICE_LANGUAGE

public static final String PROP_DEVICE_LANGUAGE

定数値: "persist.sys.language"

PROP_DEVICE_MANUFACTURER

public static final String PROP_DEVICE_MANUFACTURER

定数値: "ro.product.manufacturer"

PROP_DEVICE_MODEL

public static final String PROP_DEVICE_MODEL

定数値: "ro.product.model"

PROP_DEVICE_REGION

public static final String PROP_DEVICE_REGION

定数値: "persist.sys.country"

RE_EMULATOR_SN

public static final String RE_EMULATOR_SN

エミュレータのシリアル番号の正規表現。

定数値: "emulator-(\d+)"

UNKNOWN_PACKAGE

public static final String UNKNOWN_PACKAGE

定数値: ""

パブリック メソッド

arePropertiesSet

public abstract boolean arePropertiesSet ()

プロパティがキャッシュに保存されている場合は true を返します

戻り値
boolean

createForward

public abstract void createForward (int localPort, 
                String remoteSocketName, 
                IDevice.DeviceUnixSocketNamespace namespace)

ローカル TCP ポートとリモート UNIX ドメイン ソケット間のポート転送を作成します。

パラメータ
localPort int: 転送するローカルポート

remoteSocketName String: デバイスで作成された Unix ドメイン ソケットの名前

namespace IDevice.DeviceUnixSocketNamespace: UNIX ドメイン ソケットが作成された Namespace

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
接続で I/O エラーが発生した場合。

createForward

public abstract void createForward (int localPort, 
                int remotePort)

ローカル ポートとリモート ポート間のポート転送を作成します。

パラメータ
localPort int: 転送するローカルポート

remotePort int: リモートポート。

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
接続で I/O エラーが発生した場合。

createReverse

public void createReverse (int remotePort, 
                int localPort)

リモートポートとローカルポート間のポート反転を作成します。

パラメータ
remotePort int: 反転するリモートポート。

localPort int: ローカルポート

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
接続で I/O エラーが発生した場合。

executeBinderCommand

public void executeBinderCommand (String[] parameters, 
                IShellOutputReceiver receiver, 
                long maxTimeToOutputResponse, 
                TimeUnit maxTimeUnits, 
                InputStream is)

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

デバイス OS とホスト ADB サーバーの両方が Android Binder Bridge 実行機能をサポートしている場合は、exec:cmd 呼び出しまたはより高速な abb_exec: を使用します。

パラメータ
parameters String: 実行するバインダ コマンド

receiver IShellOutputReceiver: バインダ コマンドの出力を受け取る IShellOutputReceiver

maxTimeToOutputResponse long

maxTimeUnits TimeUnit

is InputStream: stdin を介して送信する入力ストリーム(省略可)

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
ShellCommandUnresponsiveException バインダ コマンドが一定時間出力を送信しない場合。
接続で I/O エラーが発生した場合。

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 abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver)

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

これは、 executeShellCommand(command, receiver, DdmPreferences.getTimeOut()) を呼び出すのと同様です。

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

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

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
ShellCommandUnresponsiveException シェルコマンドが一定時間出力を送信しない場合。
接続で I/O エラーが発生した場合。

executeShellCommand

public abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                int maxTimeToOutputResponse)

このメソッドは非推奨です。
IShellEnabledDevice.executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit) を使用します。

パラメータ
command String

receiver IShellOutputReceiver

maxTimeToOutputResponse int

例外
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

forceStop

public void forceStop (String applicationName)

アプリケーション名を指定してアプリケーションを強制停止します。これにより、保留中のアラームとキューに登録された計算がすべて削除されます。

パラメータ
applicationName String: アプリケーションの名前

getAbis

public abstract  getAbis ()

このデバイスでサポートされている 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 abstract String getAvdName ()

エミュレータが実行している AVD の名前を返します。

これは、isEmulator() が true を返す場合にのみ有効です。

エミュレータが AVD を実行していない場合(たとえば、Android ソースツリー ビルドから実行されている場合)、このメソッドは「<build>」を返します。

注: タイムアウトを制御する場合は、getAvdData() を使用することをおすすめします。

戻り値
String AVD の名前。存在しない場合は null

getAvdPath

public abstract String getAvdPath ()

ファイル システム内の仮想デバイスの絶対パスを返します。パスはオペレーティング システムに依存します。Linux では / 区切り文字、Windows では \ 区切り文字が使用されます。

注: タイムアウトを制御する場合は、getAvdData() を使用することをおすすめします。

戻り値
String AVD パス。実機の場合、エミュレータ コンソール サブコマンドが失敗した場合、またはエミュレータのバージョンが 30.0.18 より古い場合は null

getBattery

public abstract  getBattery (long freshnessTime, 
                TimeUnit timeUnit)

デバイスのバッテリー残量を 0 ~ 100 パーセントで返します。

バッテリー残量がキャッシュに保存されている可能性があります。前回のクエリが成功してから freshnessTime が期限切れになった場合にのみ、デバイスにバッテリー残量を問い合わせます。

パラメータ
freshnessTime long: バッテリー残量の望ましい最新性

timeUnit TimeUnit: freshnessTime の ERROR(/TimeUnit)

戻り値
バッテリー残量のクエリに使用できる ERROR(/Future)。バッテリー残量を取得できなかった場合、Future は ERROR(/ExecutionException) を返します。

getBattery

public abstract  getBattery ()

デバイスのバッテリー残量を 0 ~ 100 パーセントで返します。

バッテリー残量がキャッシュに保存されている可能性があります。最後のクエリが成功してから 5 分経過した場合にのみ、デバイスにバッテリー残量を問い合わせます。

戻り値
バッテリー残量のクエリに使用できる ERROR(/Future)。バッテリー残量を取得できなかった場合、Future は ERROR(/ExecutionException) を返します。

getBatteryLevel

public abstract Integer getBatteryLevel (long freshnessMs)

このメソッドは非推奨です。
getBattery(long, TimeUnit) を使用します。

デバイスのバッテリー残量を 0 ~ 100 パーセントで返します。

バッテリー残量がキャッシュに保存されている可能性があります。前回のクエリが成功してから freshnessMs ミリ秒経過した場合にのみ、デバイスにバッテリー残量を問い合わせます。

戻り値
Integer バッテリー残量、または取得できなかった場合は null

例外
com.android.ddmlib.ShellCommandUnresponsiveException
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

getBatteryLevel

public abstract Integer getBatteryLevel ()

このメソッドは非推奨です。
getBattery() を使用します。

デバイスのバッテリー残量を 0 ~ 100 パーセントで返します。

バッテリー残量がキャッシュに保存されている可能性があります。最後のクエリが成功してから 5 分経過した場合にのみ、デバイスにバッテリー残量を問い合わせます。

戻り値
Integer バッテリー残量、または取得できなかった場合は null

例外
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

getClient

public abstract Client getClient (String applicationName)

アプリケーション名で Client を返します。

パラメータ
applicationName String: アプリケーションの名前

戻り値
Client Client オブジェクト。一致するものが見つからない場合は null

getClientName

public abstract String getClientName (int pid)

pid でクライアントの名前を返します。pid が不明な場合は null を返します

パラメータ
pid int: クライアントの pid。

戻り値
String

getClients

public abstract Client[] getClients ()

クライアントの配列を返します。

戻り値
Client[]

getDensity

public abstract int getDensity ()

システム プロパティ PROP_DEVICE_DENSITY の値を読み取って、デバイス画面の密度バケットを返します。

戻り値
int 密度。判定できない場合は -1。

getFileListingService

public abstract FileListingService getFileListingService ()

このデバイスの FileListingService を返します。

戻り値
FileListingService

getHardwareCharacteristics

public  getHardwareCharacteristics ()

ビルド特性プロパティを読み取って取得した特徴を返します。

戻り値

getLanguage

public abstract String getLanguage ()

ユーザーの言語を返します。

戻り値
String ユーザーの言語。不明な場合は null

getLastInstallMetrics

public InstallMetrics getLastInstallMetrics ()

このデバイスの最新のインストールに関する情報を取得します。

戻り値
InstallMetrics インストールを説明する InstallMetrics 指標。

getMountPoint

public abstract String getMountPoint (String name)

マウント ポイントを返します。

パラメータ
name String: 返すマウント ポイントの名前

戻り値
String

getProfileableClients

public ProfileableClient[] getProfileableClients ()

プロファイリング可能なクライアントの配列を返します。

戻り値
ProfileableClient[]

getProperties

public abstract  getProperties ()

このメソッドは非推奨です。
代わりに IShellEnabledDevice.getSystemProperty(String) を使用してください

キャッシュに保存されたデバイスのプロパティを返します。「getprop」の出力全体が含まれています。

戻り値

getProperty

public abstract String getProperty (String name)

非常に短い待機時間で IShellEnabledDevice.getSystemProperty(String) を介してプロパティを取得しようとし、例外を飲み込むコンビニエンス メソッド。

注: タイムアウトを制御する場合は、IShellEnabledDevice.getSystemProperty(String) を使用することをおすすめします。

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

戻り値
String 値。プロパティ値がすぐに利用できない場合は null

getPropertyCacheOrSync

public abstract String getPropertyCacheOrSync (String name)

このメソッドは非推奨です。
代わりに IShellEnabledDevice.getSystemProperty(String) を使用してください

キャッシュからプロパティを取得しようとする getProperty(String)getPropertySync(String) の組み合わせ。見つからない場合は、デバイスに直接クエリを同期的に試行し、成功した場合はキャッシュを再入力します。

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

戻り値
String 値。プロパティが存在しない場合は null

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
ShellCommandUnresponsiveException シェルコマンドが一定時間出力を送信しない場合。
接続で I/O エラーが発生した場合。

getPropertyCount

public abstract int getPropertyCount ()

このメソッドは非推奨です。
実装の詳細

このデバイスのプロパティの数を返します。

戻り値
int

getPropertySync

public abstract String getPropertySync (String name)

このメソッドは非推奨です。
IShellEnabledDevice.getSystemProperty(String) を使用します。

キャッシュを使用せずに、指定されたプロパティをデバイスから直接取得しようとする getProperty(String) のバリエーション。このメソッドは、揮発性プロパティにのみ使用する必要があります。

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

戻り値
String 値。プロパティが存在しない場合は null

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
ShellCommandUnresponsiveException シェルコマンドが一定時間出力を送信しない場合。
接続で I/O エラーが発生した場合。

getRegion

public abstract String getRegion ()

ユーザーの地域を返します。

戻り値
String ユーザーの地域。不明な場合は null

getScreenshot

public abstract RawImage getScreenshot ()

デバイスのスクリーンショットを撮影し、RawImage として返します。

戻り値
RawImage エラーが発生した場合は、スクリーンショットを RawImage または null として返します。

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
接続で I/O エラーが発生した場合。

getScreenshot

public abstract RawImage getScreenshot (long timeout, 
                TimeUnit unit)

パラメータ
timeout long

unit TimeUnit

戻り値
RawImage

例外
AdbCommandRejectedException
TimeoutException

getSerialNumber

public abstract String getSerialNumber ()

デバイスのシリアル番号を返します。

戻り値
String

getState

public abstract IDevice.DeviceState getState ()

デバイスの状態を返します。

戻り値
IDevice.DeviceState

getSyncService

public abstract SyncService getSyncService ()

デバイスとの間でファイルを push / pull するための SyncService オブジェクトを返します。

戻り値
SyncService SyncService を作成できなかった場合は null。これは、IDevice が無効(または切断された)であるため、adb が接続を開くことを拒否した場合に発生する可能性があります。

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
adb との接続に失敗した場合。

hasClients

public abstract boolean hasClients ()

IDeviceClient があるかどうかを返します。

戻り値
boolean

installPackage

public abstract 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 abstract 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 abstract 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 abstract 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 abstract 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 abstract void installRemotePackage (String remoteFilePath, 
                boolean reinstall, 
                String... extraArgs)

デバイスの一時的な場所にプッシュされたアプリ パッケージをインストールします。

パラメータ
remoteFilePath String: デバイス上のパッケージ ファイルの絶対ファイルパス

reinstall boolean: アプリの再インストールを実行する場合は true に設定します

extraArgs String: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。

例外
InstallException インストールに失敗した場合。

installRemotePackage

public abstract 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 abstract boolean isBootLoader ()

デバイスがブートローダー モードかどうかを返します。

戻り値
boolean getState()DeviceState.BOOTLOADER を返す場合、true

isEmulator

public abstract boolean isEmulator ()

デバイスがエミュレータの場合、true を返します。

戻り値
boolean

isOffline

public abstract boolean isOffline ()

デバイスがオフラインかどうかを返します。

戻り値
boolean getState()DeviceState.OFFLINE を返す場合、true

isOnline

public abstract boolean isOnline ()

デバイスの準備ができているかどうかを返します。

戻り値
boolean getState()DeviceState.ONLINE を返す場合、true

isRoot

public abstract boolean isRoot ()

デバイスの現在のルート ステータスをクエリします。詳しくは、「adb root」をご覧ください。

戻り値
boolean adb デーモンが root として実行されている場合は true、それ以外の場合は false。

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合。
ShellCommandUnresponsiveException

中断 中止 止めて

public void kill (String applicationName)

アプリケーション名でアプリケーションを強制終了します。この操作ではアクティビティのみが破棄され、状態は Android システムに残ります。

パラメータ
applicationName String: アプリケーションの名前

pullFile

public abstract void pullFile (String remote, 
                String local)

単一のファイルを取得します。

パラメータ
remote String: リモート ファイルのフルパス

local String: ローカル宛先。

例外
IO 例外が発生した場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
TimeoutException デバイスからのレスポンスの読み取りがタイムアウトした場合。
SyncException 同期例外が発生した場合。

プッシュ

public void push (String[] local, 
                String remote)

複数のファイルまたはディレクトリをプッシュします。

パラメータ
local String: プッシュするローカル ファイル

remote String: ディレクトリを表すリモートパス

例外
接続で I/O エラーが発生した場合
AdbCommandRejectedException adb がコマンドを拒否した場合
TimeoutException デバイスからのレスポンスの読み取りがタイムアウトした場合
SyncException 一部のファイルをプッシュできなかった場合

pushFile

public abstract void pushFile (String local, 
                String remote)

単一のファイルをプッシュします。

パラメータ
local String: ローカル ファイルパス。

remote String: リモート ファイルパス

例外
接続で I/O エラーが発生した場合
AdbCommandRejectedException adb がコマンドを拒否した場合
TimeoutException デバイスからのレスポンスの読み取りがタイムアウトした場合
SyncException ファイルがプッシュできなかった場合

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 abstract void reboot (String into)

デバイスを再起動します。

パラメータ
into String: 再起動するブートローダー名。デバイスを再起動するだけの場合は null。

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
IOException

removeForward

public void removeForward (int localPort)

ローカルポートとリモートポート間のポート転送を削除します。

パラメータ
localPort int: 転送するローカルポート

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
接続で I/O エラーが発生した場合。

removeForward

public void removeForward (int localPort, 
                int remotePort)

このメソッドは非推奨です。
removeForward(int) を使用します。

パラメータ
localPort int

remotePort int

例外
AdbCommandRejectedException
TimeoutException

removeForward

public void removeForward (int localPort, 
                String remoteSocketName, 
                IDevice.DeviceUnixSocketNamespace namespace)

このメソッドは非推奨です。
removeForward(int) を使用します。

パラメータ
localPort int

remoteSocketName String

namespace IDevice.DeviceUnixSocketNamespace

例外
AdbCommandRejectedException
TimeoutException

removeRemotePackage

public abstract void removeRemotePackage (String remoteFilePath)

デバイスからファイルを削除します。

パラメータ
remoteFilePath String: 削除するファイルのデバイス上のパス

例外
InstallException インストールに失敗した場合。

removeReverse

public void removeReverse (int remotePort)

リモートポートとローカルポート間のポート反転を削除します。

パラメータ
remotePort int: リモートポート。

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
接続で I/O エラーが発生した場合。

ルート

public abstract boolean root ()

デバイスで adb デーモンを root にするようリクエストします。これはサイレントに失敗する可能性があり、デベロッパー ビルドでのみ成功します。詳しくは、「adb root」をご覧ください。

戻り値
boolean adb デーモンが root として実行されている場合は true、それ以外の場合は false。

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合。
ShellCommandUnresponsiveException ルート ステータスをクエリできない場合。
IOException

startScreenRecorder

public abstract void startScreenRecorder (String remoteFilePath, 
                ScreenRecorderOptions options, 
                IShellOutputReceiver receiver)

デバイスが IDevice.Feature.SCREEN_RECORD をサポートしている場合、デバイスで画面録画を開始します。

パラメータ
remoteFilePath String

options ScreenRecorderOptions

receiver IShellOutputReceiver

例外
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

supportsFeature

public abstract boolean supportsFeature (IDevice.HardwareFeature feature)

このデバイスが指定されたハードウェア機能をサポートしているかどうかを返します。

パラメータ
feature IDevice.HardwareFeature

戻り値
boolean

supportsFeature

public abstract boolean supportsFeature (IDevice.Feature feature)

このデバイスが指定されたソフトウェア機能をサポートしているかどうかを返します。

パラメータ
feature IDevice.Feature

戻り値
boolean

syncPackageToDevice

public abstract String syncPackageToDevice (String localFilePath)

デバイスにファイルをプッシュします

パラメータ
localFilePath String: ローカルホスト上のファイルへの絶対パス

戻り値
String デバイス上のファイルの String の宛先パス

例外
TimeoutException 接続がタイムアウトした場合。
AdbCommandRejectedException adb がコマンドを拒否した場合
接続で I/O エラーが発生した場合。
SyncException デバイスへのパッケージのプッシュ中にエラーが発生した場合。

uninstallApp

public abstract String uninstallApp (String applicationID, 
                String... extraArgs)

デバイスからアプリをアンインストールします。

パラメータ
applicationID String: アンインストールする Android アプリケーション ID

extraArgs String: 渡す追加の引数(省略可)。使用可能なオプションについては、「adb shell pm install --help」をご覧ください。

戻り値
String エラーコードを含む String、または成功した場合は null

例外
InstallException アンインストールに失敗した場合。

uninstallPackage

public abstract String uninstallPackage (String packageName)

デバイスからパッケージをアンインストールします。

パラメータ
packageName String: アンインストールする Android アプリケーション ID

戻り値
String エラーコードを含む String、または成功した場合は null

例外
InstallException アンインストールに失敗した場合。