INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
信頼性が高く、少し高いレベルの API を ddmlib IDevice
に提供します。
まとめ
定数 | |
---|---|
int | UNKNOWN_API_LEVEL APIレベルが検出できない場合のデフォルト値 |
パブリックメソッド | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) 最小限のサポート レベルを指定して、機能が現在サポートされているかどうかを確認します。 |
abstract void | clearLogcat () 蓄積された logcat データを削除します。 |
abstract void | deleteFile (String deviceFilePath) デバイス上のファイルまたはディレクトリを削除するヘルパー メソッド。 |
abstract boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) 現在の system_server と以前の system_server |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) デバイスとその |
abstract boolean | disableAdbRoot () adb root をオフにします。 |
abstract boolean | doesFileExist (String deviceFilePath) デバイス上にファイルが存在するかどうかを判断するヘルパー メソッド。 |
abstract boolean | enableAdbRoot () adb root をオンにします。 |
abstract String | executeAdbCommand (long timeout, String... commandArgs) 指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。 |
abstract String | executeAdbCommand (String... commandArgs) adbコマンドをシステムコマンドとして実行するヘルパーメソッド。 |
abstract String | executeAdbCommand (long timeout, envMap, String... commandArgs) executeAdbCommand (long timeout, envMap, String... commandArgs) 指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。 |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) fastboot コマンドをシステムコマンドとして実行するヘルパーメソッド。 |
abstract CommandResult | executeFastbootCommand (String... commandArgs) fastboot コマンドをデフォルトのタイムアウト 2 分でシステム コマンドとして実行するヘルパー メソッド。 |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) 長時間実行される fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。 |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) システム環境変数を使用して、長時間実行される fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。 |
abstract String | executeShellCommand (String command) adb シェル コマンドを実行し、出力を |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) 指定された adb シェル コマンドを実行し、コマンドが失敗した場合は複数回再試行します。 |
abstract CommandResult | executeShellV2Command (String command) adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に設定された |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) adb シェル コマンドを実行し、コマンド ステータス出力と標準エラー出力が適切に設定された |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に設定された |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
abstract CommandResult | fastbootWipePartition (String partition) デバイスのパーティションを消去するヘルパー メソッド。 |
abstract int | getApiLevel () デバイスの API レベルを取得します。 |
abstract String | getBasebandVersion () このデバイスのベースバンド (無線) バージョンを取得するための便利な方法。 |
abstract Integer | getBattery () デバイスの現在のバッテリー レベルを返すか、バッテリー レベルが利用できない場合は Null を返します。 |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) 指定されたプロパティのブール値を返します。 |
abstract | getBootHistory () ヘルパー メソッドは、起動時間と起動理由を含む起動履歴マップを収集します。 |
abstract | getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) ヘルパー メソッドは、デバイスからのエポックからの指定された時間以降のブート時刻とブート理由、および指定された時間単位を含むブート履歴マップを収集します。 |
abstract String | getBootloaderVersion () このデバイスのブートローダーのバージョンを取得するための便利なメソッド。 |
abstract String | getBuildAlias () デバイスが現在実行しているビルドのエイリアスを取得します。 |
abstract String | getBuildFlavor () デバイスのビルド フレーバーを取得します。 |
abstract String | getBuildId () デバイスが現在実行しているビルドを取得します。 |
abstract String | getBuildSigningKeys () デバイスイメージの署名に使用されるキーのタイプを返します。 通常、Android デバイスは、テスト キー (AOSP など) またはリリース キー (個々のデバイス メーカーによって制御される) で署名されます。 |
abstract DeviceDescriptor | getCachedDeviceDescriptor () デバイスが割り当てられている場合はキャッシュされた |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) デバイスが割り当てられている場合はキャッシュされた |
abstract String[] | getChildren (String deviceFilePath) アクセス許可が原因で機能しない場合がある |
abstract AbstractConnection | getConnection () デバイスに関連付けられた接続を返します。 |
abstract String | getDeviceClass () デバイスクラスを取得します。 |
abstract long | getDeviceDate () デバイスの日付をエポックからのミリ秒単位で返します。 |
abstract DeviceDescriptor | getDeviceDescriptor () 実際のデバイス オブジェクトを渡さずにデバイス情報を取得するには、デバイス情報から |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) 実際のデバイス オブジェクトを渡さずにデバイス情報を取得するには、デバイス情報から |
abstract TestDeviceState | getDeviceState () デバイスの状態を取得します。 |
abstract long | getDeviceTimeOffset (Date date) デバイスと指定された |
abstract InputStreamSource | getEmulatorOutput () エミュレータの標準出力と標準エラー出力のストリームを取得します。 |
abstract long | getExternalStoreFreeSpace () デバイスの外部ストレージ上の空き領域の量を決定するヘルパー メソッド。 |
abstract String | getFastbootProductType () 高速ブート モードのときにこのデバイスの製品タイプを取得する便利なメソッド。 |
abstract String | getFastbootProductVariant () 高速ブート モードのときにこのデバイスの製品タイプを取得する便利なメソッド。 |
abstract String | getFastbootSerialNumber () fastboot モードのシリアル番号を返します。 |
abstract String | getFastbootVariable (String variableName) 指定された fastboot 変数値をデバイスから取得します。 |
abstract IFileEntry | getFileEntry (String path) デバイス上のリモート ファイルへの参照を取得します。 |
abstract IDevice | getIDevice () 関連付けられた ddmlib |
abstract long | getIntProperty (String name, long defaultValue) デバイスから指定されたプロパティの整数値を返します。 |
abstract long | getLastExpectedRebootTimeMillis () |
abstract int | getLaunchApiLevel () デバイスの最初に起動された API レベルを取得します。 |
abstract InputStreamSource | getLogcat () logcat データのスナップショット ストリームを取得します。 |
abstract InputStreamSource | getLogcat (int maxBytes) キャプチャされた logcat データの最後の |
abstract InputStreamSource | getLogcatDump () デバイスの現在の logcat のダンプを取得します。 |
abstract InputStreamSource | getLogcatSince (long date) 指定された日付から始まる、キャプチャされた logcat データのスナップショット ストリームを取得します。 |
abstract String | getMountPoint (String mountName) マウントポイントを返します。 |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) 指定されたマウントポイント パスに対応する |
abstract | getMountPointInfo () デバイス上の /proc/mounts 内の情報の解析されたバージョンを返します。 |
abstract long | getPartitionFreeSpace (String partition) デバイス パーティション上の空き領域の量を決定するヘルパー メソッド。 |
abstract ProcessInfo | getProcessByName (String processName) ヘルパー メソッドは、「pidof」および「stat」コマンドを実行し、指定されたプロセスの PID とプロセス開始時間を含む |
abstract String | getProcessPid (String process) サービスの PID を返すか、何か問題があった場合は null を返します。 |
abstract String | getProductType () このデバイスの製品タイプを取得するための便利なメソッド。 |
abstract String | getProductVariant () このデバイスの製品バリアントを取得するための便利な方法。 |
abstract String | getProperty (String name) デバイスから指定されたプロパティ値を取得します。 |
abstract ITestDevice.RecoveryMode | getRecoveryMode () デバイスに使用されている現在の回復モードを取得します。 |
abstract String | getSerialNumber () このデバイスのシリアル番号を取得するための便利なメソッド。 |
abstract | getTombstones () デバイスからトゥームストーンのリストを取得して返します。 |
abstract long | getTotalMemory () 物理メモリの合計サイズをバイト単位で返します。内部エラーの場合は -1 を返します。 |
abstract boolean | getUseFastbootErase () デバイス上のパーティションを消去するために fastboot 消去または fastboot フォーマットを使用するかどうかを取得します。 |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () デバイス上のプラットフォームがアプリの列挙をサポートしているかどうかを確認する |
abstract boolean | isBypassLowTargetSdkBlockSupported () デバイス上のプラットフォームがアプリのインストール時の低ターゲット SDK ブロックのバイパスをサポートしているかどうかを確認します |
abstract boolean | isDeviceEncrypted () デバイスが暗号化されているかどうかを返します。 |
abstract boolean | isDirectory (String deviceFilePath) デバイス上のパスがディレクトリの場合は True を返し、それ以外の場合は false を返します。 |
abstract boolean | isEncryptionSupported () デバイスで暗号化がサポートされているかどうかを返します。 |
abstract boolean | isExecutable (String fullPath) デバイス上のファイル パスが実行可能ファイルの場合は True を返し、それ以外の場合は false を返します。 |
abstract boolean | isHeadless () デバイスがヘッドレス (画面なし) の場合は true を返し、それ以外の場合は false を返します。 |
abstract boolean | isRuntimePermissionSupported () デバイス上のプラットフォームが実行時権限付与をサポートしているかどうかを確認する |
abstract boolean | isStateBootloaderOrFastbootd () デバイスが |
abstract boolean | logAnrs ( ITestLogger logger) デバイスから ANR を収集して記録します。 |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) デバイスの logcat にメッセージを記録します。 |
abstract void | nonBlockingReboot () デバイスを再起動するコマンドを発行し、コマンドが完了し、デバイスが adb に認識されなくなったときに戻ります。 |
abstract void | postBootSetup () 毎回の起動後にテスト用にデバイスを構成する手順を実行します。 |
default void | postInvocationTearDown () このメソッドは廃止されました。代わりに |
abstract void | postInvocationTearDown (Throwable invocationException) デバイス固有の必要なクリーンアップの追加手順は、呼び出しの完了後に実行されます。 |
default void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) 呼び出しフローの前にデバイス上で実行される、デバイス固有の必要なセットアップのための追加の手順。 |
abstract boolean | pullDir (String deviceFilePath, File localDir) デバイスからディレクトリの内容を再帰的にプルします。 |
abstract File | pullFile (String remoteFilePath, int userId) デバイスからファイルを取得し、それをローカルの一時 |
abstract File | pullFile (String remoteFilePath) デバイスからファイルを取得し、それをローカルの一時 |
abstract boolean | pullFile (String remoteFilePath, File localFile) デバイスからファイルを取得します。 |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) デバイスからファイルを取得します。 |
abstract String | pullFileContents (String remoteFilePath) デバイスからファイルを取得し、その内容を返します。 |
abstract File | pullFileFromExternal (String remoteFilePath) デバイスの外部ストレージからファイルを取得し、それをローカルの一時 |
abstract boolean | pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories) フィルタリングされた一部のディレクトリを除外しながら、ディレクトリの内容をデバイスに再帰的にプッシュします。 |
abstract boolean | pushDir (File localDir, String deviceFilePath) ディレクトリの内容をデバイスに再帰的にプッシュします。 |
abstract boolean | pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded) |
abstract boolean | pushFile (File localFile, String deviceFilePath) ファイルをデバイスにプッシュします。 |
abstract boolean | pushString (String contents, String deviceFilePath) 文字列から作成されたファイルをデバイスにプッシュします |
abstract void | reboot () デバイスを adb モードで再起動します。 |
abstract void | reboot (String reason) デバイスを再起動して、再起動後も保持されるように指定された |
abstract void | rebootIntoBootloader () デバイスをブートローダー モードで再起動します。 |
abstract void | rebootIntoFastbootd () デバイスを fastbootd モードで再起動します。 |
abstract void | rebootIntoRecovery () デバイスを adb リカバリ モードで再起動します。 |
abstract void | rebootIntoSideload (boolean autoReboot) デバイスを adb サイドロード モードで再起動します (これは回復中の特別なモードであることに注意してください) デバイスがサイドロード モードに入るまでブロックします |
abstract void | rebootIntoSideload () デバイスを adb サイドロード モードで再起動します (これは回復中の特別なモードであることに注意してください) デバイスがサイドロード モードに入るまでブロックします |
abstract void | rebootUntilOnline () |
abstract void | rebootUntilOnline (String reason) |
abstract void | rebootUserspace () デバイスのユーザースペース部分のみを再起動します。 |
abstract void | rebootUserspaceUntilOnline () |
abstract void | remountSystemReadOnly () デバイス上のシステム パーティションを読み取り専用にします。 |
abstract void | remountSystemWritable () デバイス上のシステム パーティションを書き込み可能にします。 |
abstract void | remountVendorReadOnly () デバイス上のベンダー パーティションを読み取り専用にします。 |
abstract void | remountVendorWritable () デバイス上のベンダー パーティションを書き込み可能にします。 |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) パラメーターとして渡された 1 つ以上のリスナーを |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) インストルメンテーション テストを実行し、デバイスのリカバリを提供します。 |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) |
abstract void | setDate (Date date) デバイスに日付を設定します 注: デバイスの日付を設定するには root が必要です |
abstract void | setOptions ( TestDeviceOptions options) デバイスの |
abstract boolean | setProperty (String propKey, String propValue) 指定されたプロパティ値をデバイスに設定します。 |
abstract void | setRecovery ( IDeviceRecovery recovery) このデバイスに使用する |
abstract void | setRecoveryMode ( ITestDevice.RecoveryMode mode) デバイスに使用する現在の回復モードを設定します。 |
abstract void | setUseFastbootErase (boolean useFastbootErase) デバイス上のパーティションを消去するために fastboot 消去または fastboot フォーマットを使用するかどうかを設定します。 |
abstract void | startLogcat () バックグラウンドでデバイスからの logcat 出力のキャプチャを開始します。 |
abstract void | stopEmulatorOutput () エミュレータ出力を閉じて削除します。 |
abstract void | stopLogcat () デバイスからの logcat 出力のキャプチャを停止し、現在保存されている logcat データを破棄します。 |
abstract String | switchToAdbTcp () デバイスを adb-over-tcp モードに切り替えます。 |
abstract boolean | switchToAdbUsb () デバイスを adb over USB モードに切り替えます。 |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) ローカル ファイル ディレクトリの内容をデバイスに増分同期します。 |
abstract boolean | unlockDevice () デバイスが暗号化状態にある場合、デバイスのロックを解除します。 |
abstract boolean | waitForBootComplete (long timeOut) デバイスのブート完了フラグが設定されるまでブロックします。 |
abstract boolean | waitForDeviceAvailable () デバイスが応答し、テストできるようになるまで待ちます。 |
abstract boolean | waitForDeviceAvailable (long waitTime) デバイスが応答し、テストできるようになるまで待ちます。 |
abstract boolean | waitForDeviceAvailableInRecoverPath (long waitTime) 回復パスを考慮せずに、デバイスが応答して使用可能になるまで待機します。 |
abstract void | waitForDeviceBootloader () fastboot 経由でデバイスが表示されるまでブロックします。 |
abstract boolean | waitForDeviceInRecovery (long waitTime) デバイスが「adb Recovery」状態になることをブロックします (これは |
abstract boolean | waitForDeviceInSideload (long waitTime) デバイスが「adb サイドロード」状態になるためのブロック |
abstract boolean | waitForDeviceNotAvailable (long waitTime) デバイスが利用できないようにブロックします。つまり、adb から欠落しています。 |
abstract void | waitForDeviceOnline () デバイスが adb 経由で表示されるまでブロックします。 |
abstract void | waitForDeviceOnline (long waitTime) デバイスが adb 経由で表示されるまでブロックします。 |
abstract boolean | waitForDeviceShell (long waitTime) デバイスが基本的な adb シェル コマンドに応答するまで待機します。 |
定数
UNKNOWN_API_LEVEL
public static final int UNKNOWN_API_LEVEL
APIレベルが検出できない場合のデフォルト値
定数値: -1 (0xffffffff)
パブリックメソッド
checkApiLevelAgainstNextRelease
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
最小限のサポート レベルを指定して、機能が現在サポートされているかどうかを確認します。この方法では、API レベルが上がる前に、まだリリースされていない機能が考慮されます。
パラメーター | |
---|---|
strictMinLevel | int : 機能をサポートする厳密な最小可能レベル。 |
戻り値 | |
---|---|
boolean | レベルがサポートされている場合は True。それ以外の場合は false。 |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
クリアログキャット
public abstract void clearLogcat ()
蓄積された logcat データを削除します。
これは、ITestDevice#getLogcat()
が特定の時点 (新しいデバイス ビルドをフラッシュした後など) 以降に生成されたログ データのみを返すようにする場合に便利です。 ファイルを削除する
public abstract void deleteFile (String deviceFilePath)
デバイス上のファイルまたはディレクトリを削除するヘルパー メソッド。
パラメーター | |
---|---|
deviceFilePath | String : デバイス上のファイルの絶対パス。 |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
デバイスソフト再起動
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
現在の system_server と以前の system_server ProcessInfo
を比較することで、デバイスがソフト再起動したかどうかを確認するヘルパー メソッド。 getProcessByName(String)
を使用してProcessInfo
を取得します。
パラメーター | |
---|---|
prevSystemServerProcess | ProcessInfo : 以前の system_server プロセスProcessInfo 。 |
戻り値 | |
---|---|
boolean | デバイスがソフト再起動された場合はtrue |
投げる | |
---|---|
RuntimeException | デバイスに異常な起動理由がある場合 |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
デバイスソフト再起動以来
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
デバイスとそのERROR(/TimeUnit)
からのエポック以降の UTC 時間以降にデバイスがソフト再起動したかどうかを確認するヘルパー メソッド。ソフト再起動とは、デバイスのハード リブート (例: 要求された再起動) 以外で再起動された system_server を指します。現在のデバイスの utcEpochTime (ミリ秒単位) はgetDeviceDate()
メソッドで取得できます。
パラメーター | |
---|---|
utcEpochTime | long : エポックからの秒単位のデバイス時間。 |
timeUnit | TimeUnit : 指定された utcEpochTime の時間単位TimeUnit 。 |
戻り値 | |
---|---|
boolean | デバイスがソフト再起動された場合はtrue |
投げる | |
---|---|
RuntimeException | デバイスに異常な起動理由がある場合 |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
AdbRootを無効にする
public abstract boolean disableAdbRoot ()
adb root をオフにします。
adb root を無効にすると、デバイスが adb から切断される可能性があります。このメソッドは、デバイスが使用可能になるまでブロックされます。戻り値 | |
---|---|
boolean | 成功した場合はtrue 。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
ファイルが存在しますか
public abstract boolean doesFileExist (String deviceFilePath)
デバイス上にファイルが存在するかどうかを判断するヘルパー メソッド。
パラメーター | |
---|---|
deviceFilePath | String : チェックするデバイス上のファイルの絶対パス |
戻り値 | |
---|---|
boolean | ファイルが存在する場合はtrue 、存在しない場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
AdbRoot を有効にする
public abstract boolean enableAdbRoot ()
adb root をオンにします。 「enable-root」設定が「false」の場合、メッセージをログに記録し、root を有効にせずに戻ります。
adb root を有効にすると、デバイスが adb から切断される可能性があります。このメソッドは、デバイスが使用可能になるまでブロックされます。戻り値 | |
---|---|
boolean | 成功した場合はtrue 。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
実行Adbコマンド
public abstract String executeAdbCommand (long timeout, String... commandArgs)
指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。
代わりに、可能な限り、 executeShellCommand(String)
を使用してください。このメソッドの方が障害検出とパフォーマンスが向上します。
パラメーター | |
---|---|
timeout | long : デバイスが応答なしとみなされるまでの時間 (ミリ秒)、タイムアウトなしの場合は 0L |
commandArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
実行Adbコマンド
public abstract String executeAdbCommand (String... commandArgs)
adbコマンドをシステムコマンドとして実行するヘルパーメソッド。
代わりに、可能な限り、executeShellCommand(String)
を使用してください。このメソッドの方が障害検出とパフォーマンスが向上します。パラメーター | |
---|---|
commandArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
実行Adbコマンド
public abstract String executeAdbCommand (long timeout,envMap, String... commandArgs)
指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。
代わりに、可能な限り、 executeShellCommand(String)
を使用してください。このメソッドの方が障害検出とパフォーマンスが向上します。
パラメーター | |
---|---|
timeout | long : デバイスが応答なしとみなされるまでの時間 (ミリ秒)、タイムアウトなしの場合は 0L |
envMap | |
commandArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
高速起動コマンドの実行
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
fastboot コマンドをシステムコマンドとして実行するヘルパーメソッド。
デバイスがすでに fastboot モードになっている場合に使用されることが予想されます。パラメーター | |
---|---|
timeout | long : コマンドの有効期限が切れるまでの時間 (ミリ秒) |
commandArgs | String : 実行する fastboot コマンドと引数 |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
高速起動コマンドの実行
public abstract CommandResult executeFastbootCommand (String... commandArgs)
fastboot コマンドをデフォルトのタイムアウト 2 分でシステム コマンドとして実行するヘルパー メソッド。
デバイスがすでに fastboot モードになっている場合に使用されることが予想されます。
パラメーター | |
---|---|
commandArgs | String : 実行する fastboot コマンドと引数 |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeLongFastbootコマンド
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
長時間実行される fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。
より長いタイムアウトを使用することを除いて、executeFastbootCommand(String)
と同じです。パラメーター | |
---|---|
commandArgs | String : 実行する fastboot コマンドと引数 |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeLongFastbootコマンド
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
システム環境変数を使用して、長時間実行される fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。
より長いタイムアウトを使用することを除いて、 executeFastbootCommand(String)
と同じです。
パラメーター | |
---|---|
envVarMap | |
commandArgs | String : 実行する fastboot コマンドと引数 |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
シェルコマンドの実行
public abstract String executeShellCommand (String command)
adb シェル コマンドを実行し、出力をString
として返すヘルパー メソッド。
パラメーター | |
---|---|
command | String : 実行する adb シェル コマンド |
戻り値 | |
---|---|
String | シェルの出力 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
シェルコマンドの実行
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb シェル コマンド |
receiver | IShellOutputReceiver : シェル出力を送信する先のIShellOutputReceiver 。 |
maxTimeToOutputShellResponse | long : コマンドが応答を出力しないことが許可される最大時間。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外によりコマンドが失敗した場合にコマンドを再試行する最大回数。 retryAttempts正常に実行されなかった場合は、DeviceNotResponsiveException がスローされます。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
シェルコマンドの実行
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb シェル コマンド |
receiver | IShellOutputReceiver : シェル出力を送信する先のIShellOutputReceiver 。 |
maxTimeoutForCommand | long : コマンドが完了するまでの最大タイムアウト。 timeUnit で指定された単位 |
maxTimeToOutputShellResponse | long : コマンドが応答を出力しないことが許可される最大時間。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外によりコマンドが失敗した場合にコマンドを再試行する最大回数。 retryAttempts正常に実行されなかった場合は、DeviceNotResponsiveException がスローされます。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
シェルコマンドの実行
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver)
指定された adb シェル コマンドを実行し、コマンドが失敗した場合は複数回再試行します。
デフォルト値を使用した、より単純な形式のexecuteShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
。パラメーター | |
---|---|
command | String : 実行する adb シェル コマンド |
receiver | IShellOutputReceiver : シェル出力を送信する先のIShellOutputReceiver 。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
実行ShellV2コマンド
public abstract CommandResult executeShellV2Command (String command)
adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に設定されたCommandResult
として結果を返すヘルパー メソッド。
パラメーター | |
---|---|
command | String : 実行するコマンド。 |
戻り値 | |
---|---|
CommandResult | 結果はCommandResult に格納されます。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
実行ShellV2コマンド
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
adb シェル コマンドを実行し、コマンド ステータス出力と標準エラー出力が適切に設定されたCommandResult
として結果を返すヘルパー メソッド。 stdout は指定されたストリームに送信されます。
パラメーター | |
---|---|
command | String : 実行するコマンド。 |
pipeToOutput | OutputStream : 標準出力がリダイレクトされるERROR(/OutputStream) 、または null。 |
戻り値 | |
---|---|
CommandResult | 結果はCommandResult に格納されます。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
実行ShellV2コマンド
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に設定されたCommandResult
として結果を返すヘルパー メソッド。
パラメーター | |
---|---|
command | String : 実行するコマンド。 |
pipeAsInput | File : コマンドへの入力としてパイプされるERROR(/File) 、または null。 |
戻り値 | |
---|---|
CommandResult | 結果はCommandResult に格納されます。 |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
実行ShellV2コマンド
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb シェル コマンド |
maxTimeoutForCommand | long : コマンドが完了するまでの最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外によりコマンドが失敗した場合にコマンドを再試行する最大回数。 retryAttempts正常に実行されなかった場合は、DeviceNotResponsiveException がスローされます。 |
戻り値 | |
---|---|
CommandResult |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
以下も参照してください。
実行ShellV2コマンド
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb シェル コマンド |
maxTimeoutForCommand | long : コマンドが完了するまでの最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
戻り値 | |
---|---|
CommandResult |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
以下も参照してください。
実行ShellV2コマンド
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb シェル コマンド |
pipeAsInput | File : コマンドへの入力としてパイプされるERROR(/File) 、または null。 |
pipeToOutput | OutputStream : 標準出力がリダイレクトされるERROR(/OutputStream) 、または null。 |
maxTimeoutForCommand | long : コマンドが完了するまでの最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外によりコマンドが失敗した場合にコマンドを再試行する最大回数。 retryAttempts正常に実行されなかった場合は、DeviceNotResponsiveException がスローされます。 |
戻り値 | |
---|---|
CommandResult |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
以下も参照してください。
実行ShellV2コマンド
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb シェル コマンド |
pipeAsInput | File : コマンドへの入力としてパイプされるERROR(/File) 、または null。 |
pipeToOutput | OutputStream : 標準出力がリダイレクトされるERROR(/OutputStream) 、または null。 |
pipeToError | OutputStream : 標準エラーがリダイレクトされるERROR(/OutputStream) 、または null。 |
maxTimeoutForCommand | long : コマンドが完了するまでの最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外によりコマンドが失敗した場合にコマンドを再試行する最大回数。 retryAttempts正常に実行されなかった場合は、DeviceNotResponsiveException がスローされます。 |
戻り値 | |
---|---|
CommandResult |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
以下も参照してください。
高速ブートワイプパーティション
public abstract CommandResult fastbootWipePartition (String partition)
デバイスのパーティションを消去するヘルパー メソッド。
getUseFastbootErase()
がtrue
の場合、fastboot 消去がパーティションのワイプに使用されます。デバイスは、次回デバイスを起動するときにファイルシステムを作成する必要があります。それ以外の場合は、デバイス上に新しいファイルシステムを作成する fastboot 形式が使用されます。デバイスがすでに fastboot モードになっている場合に使用されることが予想されます。パラメーター | |
---|---|
partition | String : ワイプするパーティション |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
getApiLevel
public abstract int getApiLevel ()
デバイスの API レベルを取得します。デフォルトはUNKNOWN_API_LEVEL
です。
戻り値 | |
---|---|
int | デバイスの API レベルを示す整数 |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBasebandVersion
public abstract String getBasebandVersion ()
このデバイスのベースバンド (無線) バージョンを取得するための便利な方法。無線バージョンの取得はデバイス固有であるため、すべてのデバイスに対して正しい情報が返されるとは限りません。このメソッドは、gsm.version.baseband プロパティに依存して正しいバージョン情報を返します。これは一部の CDMA デバイスでは正確ではなく、ここで返されるバージョンは fastboot から報告されるバージョンと一致しない可能性があり、CDMA 無線のバージョンを返さない場合があります。 TL;DR このメソッドは、 gsm.version.baseband プロパティがfastboot getvar version-baseband
によって返されるバージョンと同じである場合にのみ、正確なバージョンを報告します。
戻り値 | |
---|---|
String | String ベースバンド バージョン、または決定できない場合はnull (デバイスに無線がない、またはバージョン文字列を読み取れない) |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
バッテリーを取得する
public abstract Integer getBattery ()
デバイスの現在のバッテリー レベルを返すか、バッテリー レベルが利用できない場合は Null を返します。
戻り値 | |
---|---|
Integer |
getBooleanProperty
public abstract boolean getBooleanProperty (String name, boolean defaultValue)
指定されたプロパティのブール値を返します。
パラメーター | |
---|---|
name | String : プロパティ名 |
defaultValue | boolean : プロパティが空か存在しない場合に返されるデフォルト値。 |
戻り値 | |
---|---|
boolean | プロパティの値が"1" 、 "y" 、 "yes" 、 "on" または"true" の場合はfalse 、プロパティの値が"0" 、 "n" 、 "no" 、 "off" の場合はtrue "false" 、それ以外の場合はdefaultValue 。 |
投げる | |
---|---|
DeviceNotAvailableException |
ブート履歴の取得
public abstractgetBootHistory ()
ヘルパー メソッドは、起動時間と起動理由を含む起動履歴マップを収集します。
戻り値 | |
---|---|
ブート時間 (エポックからの秒単位の UTC 時間) とブート理由のマップ |
投げる | |
---|---|
DeviceNotAvailableException |
ブート履歴の取得
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
ヘルパー メソッドは、デバイスからのエポックからの指定された時間以降のブート時刻とブート理由、および指定された時間単位を含むブート履歴マップを収集します。現在のデバイスの utcEpochTime (ミリ秒単位) はgetDeviceDate()
メソッドで取得できます。
パラメーター | |
---|---|
utcEpochTime | long : エポック以降のデバイス時間。 |
timeUnit | TimeUnit : 時間単位TimeUnit 。 |
戻り値 | |
---|---|
ブート時間 (エポックからの秒単位の UTC 時間) とブート理由のマップ |
投げる | |
---|---|
DeviceNotAvailableException |
ブートローダーのバージョンの取得
public abstract String getBootloaderVersion ()
このデバイスのブートローダーのバージョンを取得するための便利なメソッド。
デバイスの現在の状態からブートローダーのバージョンを取得しようとします。 (つまり、デバイスが fastboot モードの場合、fastboot からバージョンを取得しようとします)戻り値 | |
---|---|
String | String ブートローダーのバージョン、または見つからない場合はnull |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
getBuildAlias
public abstract String getBuildAlias ()
デバイスが現在実行しているビルドのエイリアスを取得します。
ビルド エイリアスは通常、ビルド ID (通常は Nexus ビルドの数値) よりも読みやすい文字列です。たとえば、最終的な Android 4.2 リリースのビルド エイリアスは JDQ39、ビルド ID は 573038 です。
戻り値 | |
---|---|
String | ビルド エイリアス、または取得できなかった場合はビルド ID にフォールバックします |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildFlavor
public abstract String getBuildFlavor ()
デバイスのビルド フレーバーを取得します。
戻り値 | |
---|---|
String | ビルドフレーバー、または取得できなかった場合は null |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildId
public abstract String getBuildId ()
デバイスが現在実行しているビルドを取得します。
戻り値 | |
---|---|
String | ビルド ID または取得できなかった場合はIBuildInfo#UNKNOWN_BUILD_ID |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildSigningKeys
public abstract String getBuildSigningKeys ()
デバイスイメージの署名に使用されるキーのタイプを返します。
通常、Android デバイスは、テスト キー (AOSP など) またはリリース キー (個々のデバイス メーカーによって制御される) で署名されます。
戻り値 | |
---|---|
String | 署名キーが見つかった場合は、それ以外の場合は null。 |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
デバイスが割り当てられている場合はキャッシュされたDeviceDescriptor
を返し、それ以外の場合は現在のDeviceDescriptor
を返します。
戻り値 | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
デバイスが割り当てられている場合はキャッシュされたDeviceDescriptor
を返し、それ以外の場合は現在のDeviceDescriptor
を返します。
パラメーター | |
---|---|
shortDescriptor | boolean : 記述子を最小限の情報に制限するかどうか |
戻り値 | |
---|---|
DeviceDescriptor |
取得
public abstract String[] getChildren (String deviceFilePath)
アクセス許可が原因で機能しない場合があるIFileEntry
を使用する代わりに。
パラメーター | |
---|---|
deviceFilePath | String : 検索を実行するデバイス上のパスです。 |
戻り値 | |
---|---|
String[] | デバイス上のパス内のすべてのファイルを含む文字列の配列。 |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
接続を取得する
public abstract AbstractConnection getConnection ()
デバイスに関連付けられた接続を返します。
戻り値 | |
---|---|
AbstractConnection |
getDeviceDate
public abstract long getDeviceDate ()
デバイスの日付をエポックからのミリ秒単位で返します。
戻り値 | |
---|---|
long | エポック形式でのデバイスの日付。 |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
実際のデバイス オブジェクトを渡さずにデバイス情報を取得するには、デバイス情報からDeviceDescriptor
を返します。
戻り値 | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
実際のデバイス オブジェクトを渡さずにデバイス情報を取得するには、デバイス情報からDeviceDescriptor
を返します。
パラメーター | |
---|---|
shortDescriptor | boolean : 記述子を最小限の情報に制限するかどうか |
戻り値 | |
---|---|
DeviceDescriptor |
getDeviceTimeOffset
public abstract long getDeviceTimeOffset (Date date)
デバイスと指定されたERROR(/Date)
の間の時差を取得するヘルパー。内部的にエポックタイムを使用します。
パラメーター | |
---|---|
date | Date |
戻り値 | |
---|---|
long | ミリ秒単位の違い |
投げる | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public abstract InputStreamSource getEmulatorOutput ()
エミュレータの標準出力と標準エラー出力のストリームを取得します。
戻り値 | |
---|---|
InputStreamSource | エミュレータの出力 |
get外部ストアフリースペース
public abstract long getExternalStoreFreeSpace ()
デバイスの外部ストレージ上の空き領域の量を決定するヘルパー メソッド。
戻り値 | |
---|---|
long | 空き容量 (KB) |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
getFastbootProductType
public abstract String getFastbootProductType ()
高速ブート モードのときにこのデバイスの製品タイプを取得する便利なメソッド。
この方法は、デバイスを高速ブートする必要がある場合にのみ使用してください。この場合、一般的なgetProductType()
メソッドよりも少し安全なバリアントです。ITestDevice は、デバイスが不正な状態にある場合、または応答しない場合にデバイスを fastboot に回復することを認識しているためです。戻り値 | |
---|---|
String | String 製品タイプ名、または判断できない場合はnull |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
getFastbootProductVariant
public abstract String getFastbootProductVariant ()
高速ブート モードのときにこのデバイスの製品タイプを取得する便利なメソッド。
この方法は、デバイスを高速ブートする必要がある場合にのみ使用してください。この場合、一般的なgetProductType()
メソッドよりも少し安全なバリアントです。ITestDevice は、デバイスが不正な状態にある場合、または応答しない場合にデバイスを fastboot に回復することを認識しているためです。戻り値 | |
---|---|
String | String 製品タイプ名、または判断できない場合はnull |
投げる | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
fastboot モードのシリアル番号を返します。
戻り値 | |
---|---|
String |
getFastbootVariable
public abstract String getFastbootVariable (String variableName)
指定された fastboot 変数値をデバイスから取得します。
パラメーター | |
---|---|
variableName | String : 変数名 |
戻り値 | |
---|---|
String | プロパティ値、または存在しない場合はnull |
投げる | |
---|---|
| UnsupportedOperationException |
DeviceNotAvailableException |
getFileEntry
public abstract IFileEntry getFileEntry (String path)
デバイス上のリモート ファイルへの参照を取得します。
パラメーター | |
---|---|
path | String : 取得するファイルのパス。絶対パスまたは「/」を基準とした相対パスを指定できます。 (つまり、「/system」と「system」の両方の構文がサポートされています) |
戻り値 | |
---|---|
IFileEntry | IFileEntry 、または指定されたpathにファイルが見つからない場合はnull |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getIDevice
public abstract IDevice getIDevice ()
関連付けられた ddmlib IDevice
への参照を返します。
IDevice
が割り当てられる場合があります。したがって、呼び出し元はIDevice
への参照を保持すべきではありません。その参照は古くなってしまう可能性があるからです。戻り値 | |
---|---|
IDevice | IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
デバイスから指定されたプロパティの整数値を返します。
パラメーター | |
---|---|
name | String : プロパティ名 |
defaultValue | long : default value to return if property is empty or doesn't exist. |
戻り値 | |
---|---|
long | the property value or defaultValue if the property is empty, doesn't exist, or doesn't have an integer value. |
Throws | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by System.currentTimeMillis()
.
戻り値 | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL
.
戻り値 | |
---|---|
int | an integer indicating the first launched API Level of device |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getLogcat
public abstract InputStreamSource getLogcat ()
Grabs a snapshot stream of the logcat data.
Works in two modes:
TestDeviceOptions.getMaxLogcatDataSize()
bytes of the current contents of the background logcat capture戻り値 | |
---|---|
InputStreamSource |
getLogcat
public abstract InputStreamSource getLogcat (int maxBytes)
Grabs a snapshot stream of the last maxBytes
of captured logcat data.
Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat()
snapshot.
パラメーター | |
---|---|
maxBytes | int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory |
戻り値 | |
---|---|
InputStreamSource |
getLogcatDump
public abstract InputStreamSource getLogcatDump ()
Get a dump of the current logcat for device. Unlike getLogcat()
, this method will always return a static dump of the logcat.
Has the disadvantage that nothing will be returned if device is not reachable.
戻り値 | |
---|---|
InputStreamSource | a InputStreamSource of the logcat data. An empty stream is returned if fail to capture logcat data. |
getLogcatSince
public abstract InputStreamSource getLogcatSince (long date)
Grabs a snapshot stream of captured logcat data starting the date provided. The time on the device should be used getDeviceDate()
.
パラメーター | |
---|---|
date | long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s') |
戻り値 | |
---|---|
InputStreamSource |
getMountPoint
public abstract String getMountPoint (String mountName)
Returns a mount point.
Queries the device directly if the cached info inIDevice
is not available. TODO: move this behavior to IDevice#getMountPoint(String)
パラメーター | |
---|---|
mountName | String : the name of the mount point |
戻り値 | |
---|---|
String | the mount point or null |
See also:
getMountPointInfo
public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
Returns a MountPointInfo
corresponding to the specified mountpoint path, or null
if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.
パラメーター | |
---|---|
mountpoint | String |
戻り値 | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Throws | |
---|---|
DeviceNotAvailableException |
See also:
getMountPointInfo
public abstractgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
戻り値 | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Throws | |
---|---|
DeviceNotAvailableException |
getPartitionFreeSpace
public abstract long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
パラメーター | |
---|---|
partition | String |
戻り値 | |
---|---|
long | the amount of free space in KB |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getProcessByName
public abstract ProcessInfo getProcessByName (String processName)
Helper method runs the "pidof" and "stat" command and returns ProcessInfo
object with PID and process start time of the given process.
パラメーター | |
---|---|
processName | String : the proces name String. |
戻り値 | |
---|---|
ProcessInfo | ProcessInfo of given processName |
Throws | |
---|---|
DeviceNotAvailableException |
getProcessPid
public abstract String getProcessPid (String process)
Returns the pid of the service or null if something went wrong.
パラメーター | |
---|---|
process | String : The proces name String. |
戻り値 | |
---|---|
String |
Throws | |
---|---|
DeviceNotAvailableException |
getProductType
public abstract String getProductType ()
Convenience method to get the product type of this device.
This method will work if device is in either adb or fastboot mode.戻り値 | |
---|---|
String | the String product type name. Will not be null |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered, or if product type can not be determined |
getProductVariant
public abstract String getProductVariant ()
Convenience method to get the product variant of this device.
This method will work if device is in either adb or fastboot mode.戻り値 | |
---|---|
String | the String product variant name or null if it cannot be determined |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getProperty
public abstract String getProperty (String name)
Retrieve the given property value from the device.
パラメーター | |
---|---|
name | String : the property name |
戻り値 | |
---|---|
String | the property value or null if it does not exist |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getRecoveryMode
public abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
戻り値 | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
戻り値 | |
---|---|
String | the String serial number |
getTombstones
public abstractgetTombstones ()
Fetch and return the list of tombstones from the devices. Requires root.
method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException
will terminate the method early.
戻り値 | |
---|---|
A list of tombstone files, empty if no tombstone. |
Throws | |
---|---|
DeviceNotAvailableException |
See also:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
戻り値 | |
---|---|
long |
getUseFastbootErase
public abstract boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
戻り値 | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
戻り値 | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isAdbTcp
public abstract boolean isAdbTcp ()
戻り値 | |
---|---|
boolean | true if device is connected to adb-over-tcp, false otherwise. |
isAppEnumerationSupported
public abstract boolean isAppEnumerationSupported ()
Check whether platform on device supports app enumeration
戻り値 | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isBypassLowTargetSdkBlockSupported
public abstract boolean isBypassLowTargetSdkBlockSupported ()
Check whether platform on device supports bypassing low target sdk block on app installs
戻り値 | |
---|---|
boolean | True if bypass low target sdk block is supported, false otherwise |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
戻り値 | |
---|---|
boolean | true if the device is encrypted. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isDirectory
public abstract boolean isDirectory (String deviceFilePath)
Return True if the path on the device is a directory, false otherwise.
パラメーター | |
---|---|
deviceFilePath | String |
戻り値 | |
---|---|
boolean |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
戻り値 | |
---|---|
boolean | true if the device supports encryption. |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isExecutable
public abstract boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
パラメーター | |
---|---|
fullPath | String |
戻り値 | |
---|---|
boolean |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
戻り値 | |
---|---|
boolean |
Throws | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
戻り値 | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
戻り値 | |
---|---|
boolean |
logAnrs
public abstract boolean logAnrs (ITestLogger logger)
Collects and log ANRs from the device.
パラメーター | |
---|---|
logger | ITestLogger : an ITestLogger to log the ANRs. |
戻り値 | |
---|---|
boolean | True if the logging was successful, false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
logOnDevice
public abstract void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)
Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.
パラメーター | |
---|---|
tag | String : The tag under which we log our message in the logcat. |
level | Log.LogLevel : The debug level of the message in the logcat. |
format | String : The message format. |
args | Object : the args to be replaced via String.format(). |
nonBlockingReboot
public abstract void nonBlockingReboot ()
Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
postBootSetup
public abstract void postBootSetup ()
Perform instructions to configure device for testing that after every boot.
Should be called after device is fully booted/available In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot. Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
postInvocationTearDown
public void postInvocationTearDown ()
This method is deprecated.
Use postInvocationTearDown(Throwable)
instead.
Extra steps for device specific required clean up that will be executed after the invocation is done.
postInvocationTearDown
public abstract void postInvocationTearDown (Throwable invocationException)
Extra steps for device specific required clean up that will be executed after the invocation is done.
パラメーター | |
---|---|
invocationException | Throwable : if any, the final exception raised by the invocation failure. |
preInvocationSetup
public void preInvocationSetup (IBuildInfo info, MultiMap<String, String> attributes)
Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.
パラメーター | |
---|---|
info | IBuildInfo : The IBuildInfo of the device. |
attributes | MultiMap : The attributes stored in the invocation context |
Throws | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public abstract boolean pullDir (String deviceFilePath, File localDir)
Recursively pull directory contents from device.
パラメーター | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
戻り値 | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract File pullFile (String remoteFilePath, int userId)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
パラメーター | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
userId | int : The user id to pull from |
戻り値 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract File pullFile (String remoteFilePath)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
パラメーター | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
戻り値 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract boolean pullFile (String remoteFilePath, File localFile)
Retrieves a file off device.
パラメーター | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
戻り値 | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract boolean pullFile (String remoteFilePath, File localFile, int userId)
Retrieves a file off device.
パラメーター | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
userId | int : The user id to pull from |
戻り値 | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFileContents
public abstract String pullFileContents (String remoteFilePath)
Retrieves a file off device, and returns the contents.
パラメーター | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
戻り値 | |
---|---|
String | A String containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Throws | |
---|---|
DeviceNotAvailableException |
pullFileFromExternal
public abstract File pullFileFromExternal (String remoteFilePath)
A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File)
, and return a reference to that File
.
パラメーター | |
---|---|
remoteFilePath | String : the path to file on device, relative to the device's external storage mountpoint |
戻り値 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
パラメーター | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
戻り値 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath)
Recursively push directory contents to device.
パラメーター | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
戻り値 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded)
Variant of pushFile(File, String)
which can optionally consider evaluating the need for the content provider.
パラメーター | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
evaluateContentProviderNeeded | boolean : whether to check if we need the content provider |
戻り値 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath)
Push a file to device. By default using a content provider.
パラメーター | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
戻り値 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushString
public abstract boolean pushString (String contents, String deviceFilePath)
Push file created from a string to device
パラメーター | |
---|---|
contents | String : the contents of the file to push |
deviceFilePath | String : the remote destination absolute file path |
戻り値 | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
reboot
public abstract void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
reboot
public abstract void reboot (String reason)
Reboots the device into adb mode with given reason
to be persisted across reboot.
Blocks until device becomes available.
Last reboot reason can be obtained by querying sys.boot.reason
propety.
パラメーター | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootIntoBootloader
public abstract void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoFastbootd
public abstract void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoRecovery
public abstract void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recoveryThrows | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootIntoSideload
public abstract void rebootIntoSideload (boolean autoReboot)
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
パラメーター | |
---|---|
autoReboot | boolean : whether to automatically reboot the device after sideload |
Throws | |
---|---|
DeviceNotAvailableException | if device is not in sideload after reboot |
rebootIntoSideload
public abstract void rebootIntoSideload ()
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
Throws | |
---|---|
DeviceNotAvailableException | if device is not in sideload after reboot |
rebootUntilOnline
public abstract void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUntilOnline
public abstract void rebootUntilOnline (String reason)
An alternate to reboot()
that only blocks until device is online ie visible to adb.
パラメーター | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
See also:
rebootUserspace
public abstract void rebootUserspace ()
Reboots only userspace part of device.
Blocks until device becomes available.
WARNING. Userspace reboot is currently under active development, use it on your own risk.
Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUserspaceUntilOnline
public abstract void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
remountSystemReadOnly
public abstract void remountSystemReadOnly ()
Make the system partition on the device read-only. May reboot the device.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountSystemWritable
public abstract void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorReadOnly
public abstract void remountVendorReadOnly ()
Make the vendor partition on the device read-only. May reboot the device.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
runInstrumentationTests
public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)
Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection))
with one or more listeners passed as parameters.
パラメーター | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners | ITestLifeCycleReceiver : the test result listener(s) |
戻り値 | |
---|---|
boolean | true if test command completed. false if it failed to complete, but recovery succeeded |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTests
public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner,listeners)
Runs instrumentation tests, and provides device recovery.
If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.
If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.
パラメーター | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners |
戻り値 | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTestsAsUser
public abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId,listeners)
Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection))
but runs the test for the given user.
パラメーター | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
戻り値 | |
---|---|
boolean |
Throws | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)
Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)
but runs the test for a given user.
パラメーター | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
戻り値 | |
---|---|
boolean |
Throws | |
---|---|
DeviceNotAvailableException |
setDate
public abstract void setDate (Date date)
Sets the date on device
Note: setting date on device requires root
パラメーター | |
---|---|
date | Date : specify a particular date; will use host date if null |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setOptions
public abstract void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
パラメーター | |
---|---|
options | TestDeviceOptions |
setProperty
public abstract boolean setProperty (String propKey, String propValue)
Sets the given property value on the device. Requires adb root is true.
パラメーター | |
---|---|
propKey | String : The key targeted to be set. |
propValue | String : The property value to be set. |
戻り値 | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setRecovery
public abstract void setRecovery (IDeviceRecovery recovery)
Set the IDeviceRecovery
to use for this device. Should be set when device is first allocated.
パラメーター | |
---|---|
recovery | IDeviceRecovery : the IDeviceRecovery |
setRecoveryMode
public abstract void setRecoveryMode (ITestDevice.RecoveryMode mode)
Set the current recovery mode to use for the device.
Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etcパラメーター | |
---|---|
mode | ITestDevice.RecoveryMode : whether 'recover till online only' mode should be on or not. |
setUseFastbootErase
public abstract void setUseFastbootErase (boolean useFastbootErase)
Set whether to use fastboot erase or fastboot format to wipe a partition on the device.
パラメーター | |
---|---|
useFastbootErase | boolean : true if fastboot erase should be used or false if fastboot format should be used. |
See also:
startLogcat
public abstract void startLogcat ()
Start capturing logcat output from device in the background.
Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat. When the device is no longer in use,stopLogcat()
must be called. startLogcat()
and stopLogcat()
do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.stopEmulatorOutput
public abstract void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public abstract void stopLogcat ()
Stop capturing logcat output from device, and discard currently saved logcat data.
Will have no effect if logcat output is not being captured.switchToAdbTcp
public abstract String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
戻り値 | |
---|---|
String | the tcp serial number or null if device could not be switched |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
戻り値 | |
---|---|
boolean | true if switch was successful, false otherwise. |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
syncFiles
public abstract boolean syncFiles (File localFileDir, String deviceFilePath)
Incrementally syncs the contents of a local file directory to device.
Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date. Hidden files (with names starting with ".") will be ignored. Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.パラメーター | |
---|---|
localFileDir | File : the local file directory containing files to recursively push. |
deviceFilePath | String : the remote destination absolute file path root. All directories in thos file path must be readable. ie pushing to /data/local/tmp when adb is not root will fail |
戻り値 | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
unlockDevice
public abstract boolean unlockDevice ()
Unlocks the device if the device is in an encrypted state.
This method may restart the framework but will not callpostBootSetup()
. Therefore, the device might not be fully ready to be tested when this method returns.戻り値 | |
---|---|
boolean | true if successful or if the device is unencrypted. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
UnsupportedOperationException | if encryption is not supported on the device. |
waitForBootComplete
public abstract boolean waitForBootComplete (long timeOut)
Blocks until the device's boot complete flag is set.
パラメーター | |
---|---|
timeOut | long : time in msecs to wait for the flag to be set |
戻り値 | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
waitForDeviceAvailable
public abstract boolean waitForDeviceAvailable ()
Waits for the device to be responsive and available for testing. Uses default timeout.
戻り値 | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceAvailable
public abstract boolean waitForDeviceAvailable (long waitTime)
Waits for the device to be responsive and available for testing.
パラメーター | |
---|---|
waitTime | long : the time in ms to wait |
戻り値 | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Throws | |
---|---|
DeviceNotAvailableException | if device is still unresponsive after waitTime expires. |
waitForDeviceAvailableInRecoverPath
public abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)
Waits for the device to be responsive and available without considering recovery path.
パラメーター | |
---|---|
waitTime | long |
戻り値 | |
---|---|
boolean | True if device is available, False if unavailable. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceInRecovery
public abstract boolean waitForDeviceInRecovery (long waitTime)
Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery
).
パラメーター | |
---|---|
waitTime | long : the time in ms to wait |
戻り値 | |
---|---|
boolean | true if device boots into recovery before time expires. false otherwise |
waitForDeviceInSideload
public abstract boolean waitForDeviceInSideload (long waitTime)
Blocks for the device to be in the 'adb sideload' state
パラメーター | |
---|---|
waitTime | long : the time in ms to wait |
戻り値 | |
---|---|
boolean | true if device boots into sideload before time expires. false otherwise |
waitForDeviceNotAvailable
public abstract boolean waitForDeviceNotAvailable (long waitTime)
Blocks for the device to be not available ie missing from adb
パラメーター | |
---|---|
waitTime | long : the time in ms to wait |
戻り値 | |
---|---|
boolean | true if device becomes not available before time expires. false otherwise |
waitForDeviceOnline
public abstract void waitForDeviceOnline ()
Blocks until device is visible via adb. Uses default timeout
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceOnline
public abstract void waitForDeviceOnline (long waitTime)
Blocks until device is visible via adb.
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.パラメーター | |
---|---|
waitTime | long : the time in ms to wait |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceShell
public abstract boolean waitForDeviceShell (long waitTime)
Waits for device to be responsive to a basic adb shell command.
パラメーター | |
---|---|
waitTime | long : the time in ms to wait |
戻り値 | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |