INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
ddmlib IDevice
に、信頼性の高い、わずかに高レベルの API を提供します。
まとめ
定数 | |
---|---|
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 ルートをオフにします。 |
abstract boolean | doesFileExist (String deviceFilePath) デバイス上にファイルが存在するかどうかを判断するヘルパー メソッド。 |
abstract boolean | enableAdbRoot () adb ルートをオンにします。 |
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 shell コマンドを実行します。 |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) 指定された adb シェル コマンドを実行し、コマンドが失敗した場合は複数回再試行します。 |
abstract CommandResult | executeShellV2Command (String command) adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に取り込まれた |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) adb シェル コマンドを実行し、コマンド ステータス出力と stderr が適切に入力された |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に取り込まれた |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
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 InputStreamSource | getBugreport () デバイスからバグレポートを取得します。 |
abstract InputStreamSource | getBugreportz () デバイスからバグレポートを取得します。 |
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 String | getDeviceClass () デバイス クラスを取得します。 |
abstract long | getDeviceDate () エポックからのミリ秒単位でデバイスの日付を返します。 |
abstract DeviceDescriptor | getDeviceDescriptor () デバイス情報から |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) デバイス情報から |
abstract TestDeviceState | getDeviceState () デバイスの状態を取得します。 |
abstract long | getDeviceTimeOffset (Date date) デバイスと特定の |
abstract InputStreamSource | getEmulatorOutput () エミュレータの stdout と stderr のストリームを取得します |
abstract long | getExternalStoreFreeSpace () デバイスの外部ストレージの空き容量を決定するヘルパー メソッド。 |
abstract String | getFastbootProductType () fastboot モードのときにこのデバイスの製品タイプを取得する便利なメソッド。 |
abstract String | getFastbootProductVariant () fastboot モードのときにこのデバイスの製品タイプを取得する便利なメソッド。 |
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 erase または fastboot format を使用するかどうかを取得します。 |
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 boolean | logBugreport (String dataName, ITestLogger listener) バグレポートを取得してレポーターに記録するためのヘルパー メソッド。 |
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 sideload モードで再起動します (これはリカバリ中の特別なモードであることに注意してください) デバイスがサイドロード モードになるまでブロックする |
abstract void | rebootIntoSideload () デバイスを adb sideload モードで再起動します (これはリカバリ中の特別なモードであることに注意してください) デバイスがサイドロード モードになるまでブロックする |
abstract void | rebootUntilOnline () デバイスがオンラインになるまで、つまり adb に表示されるまでのみブロックする、 |
abstract void | rebootUntilOnline (String reason) デバイスがオンラインになるまで、つまり adb に表示されるまでのみブロックする、 |
abstract void | rebootUserspace () デバイスのユーザー空間部分のみを再起動します。 |
abstract void | rebootUserspaceUntilOnline () デバイスがオンラインになるまで、つまり adb に表示されるまでのみブロックする、 |
abstract void | remountSystemWritable () デバイスのシステム パーティションを書き込み可能にします。 |
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 erase または fastboot format を使用するかどうかを設定します。 |
abstract void | startLogcat () バックグラウンドでデバイスからの logcat 出力のキャプチャを開始します。 |
abstract void | stopEmulatorOutput () エミュレータ出力を閉じて削除します。 |
abstract void | stopLogcat () デバイスからの logcat 出力のキャプチャを停止し、現在保存されている logcat データを破棄します。 |
abstract String | switchToAdbTcp () デバイスを adb-over-tcp モードに切り替えます。 |
abstract boolean | switchToAdbUsb () デバイスを USB モードで adb に切り替えます。 |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) ローカル ファイル ディレクトリの内容をデバイスに増分的に同期します。 |
abstract Bugreport | takeBugreport () バグレポートを取得し、それを処理するために |
abstract boolean | unlockDevice () デバイスが暗号化された状態の場合、デバイスのロックを解除します。 |
abstract boolean | waitForBootComplete (long timeOut) デバイスの起動完了フラグが設定されるまでブロックします。 |
abstract boolean | waitForDeviceAvailable () デバイスが応答してテストできるようになるまで待機します。 |
abstract boolean | waitForDeviceAvailable (long waitTime) デバイスが応答してテストできるようになるまで待機します。 |
abstract void | waitForDeviceBootloader () fastboot 経由でデバイスが表示されるまでブロックします。 |
abstract boolean | waitForDeviceInRecovery (long waitTime) デバイスが「adb recovery」状態になることをブロックします (これは |
abstract boolean | waitForDeviceInSideload (long waitTime) デバイスが「adb sideload」状態になるためのブロック |
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。それ以外の場合は偽。 |
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
clearLogcat
public abstract void clearLogcat ()
蓄積された logcat データを削除します。
これは、ITestDevice#getLogcat()
が特定の時点以降 (新しいデバイス ビルドのフラッシュ後など) に生成されたログ データのみを返すようにしたい場合に役立ちます。 ファイルを削除する
public abstract void deleteFile (String deviceFilePath)
デバイス上のファイルまたはディレクトリを削除するヘルパー メソッド。
パラメーター | |
---|---|
deviceFilePath | String : デバイス上のファイルの絶対パス。 |
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestarted
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
現在の system_server と以前の system_server ProcessInfo
を比較して、デバイスがソフト リスタートしたかどうかを確認するヘルパー メソッド。 getProcessByName(String)
を使用してProcessInfo
を取得します。
パラメーター | |
---|---|
prevSystemServerProcess | ProcessInfo : 以前の system_server プロセスProcessInfo 。 |
戻り値 | |
---|---|
boolean | デバイスのソフト リスタートの場合はtrue |
スロー | |
---|---|
| デバイスに異常な起動理由がある場合 |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestartedSince
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
デバイスとそのERROR(/TimeUnit)
からのエポック以降の UTC 時間以降にデバイスがソフト リスタートしたかどうかを確認するヘルパー メソッド。ソフト再起動は、デバイスのハード再起動以外で再起動された system_server を指します (例: 要求された再起動)。ミリ秒単位の現在のデバイス utcEpochTime は、メソッドgetDeviceDate()
で取得できます。
パラメーター | |
---|---|
utcEpochTime | long : エポックからの秒単位のデバイス時間。 |
timeUnit | TimeUnit : 指定された utcEpochTime の時間単位TimeUnit 。 |
戻り値 | |
---|---|
boolean | デバイスのソフト リスタートの場合はtrue |
スロー | |
---|---|
| デバイスに異常な起動理由がある場合 |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
disableAdbRoot
public abstract boolean disableAdbRoot ()
adb ルートをオフにします。
adb root を無効にすると、デバイスが adb から切断される可能性があります。このメソッドは、デバイスが使用可能になるまでブロックされます。戻り値 | |
---|---|
boolean | 成功した場合はtrue 。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
dosFileExist
public abstract boolean doesFileExist (String deviceFilePath)
デバイス上にファイルが存在するかどうかを判断するヘルパー メソッド。
パラメーター | |
---|---|
deviceFilePath | String : チェックするデバイス上のファイルの絶対パス |
戻り値 | |
---|---|
boolean | ファイルが存在する場合はtrue 、そうでない場合はfalse 。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
enableAdbRoot
public abstract boolean enableAdbRoot ()
adb ルートをオンにします。 「enable-root」設定が「false」の場合、メッセージをログに記録し、root を有効にせずに戻ります。
adb root を有効にすると、デバイスが adb から切断される場合があります。このメソッドは、デバイスが使用可能になるまでブロックされます。戻り値 | |
---|---|
boolean | 成功した場合はtrue 。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeAdbCommand
public abstract String executeAdbCommand (long timeout, String... commandArgs)
指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。
executeShellCommand(String)
より優れた障害検出とパフォーマンスを提供するため、可能な限り代わりに使用する必要があります。
パラメーター | |
---|---|
timeout | long : デバイスが応答していないと見なされるまでのミリ秒単位の時間。タイムアウトなしの場合は 0L |
commandArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeAdbCommand
public abstract String executeAdbCommand (String... commandArgs)
システムコマンドとしてadbコマンドを実行するヘルパーメソッド。
executeShellCommand(String)
より優れた障害検出とパフォーマンスを提供するため、可能な限り代わりに使用する必要があります。パラメーター | |
---|---|
commandArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeAdbCommand
public abstract String executeAdbCommand (long timeout,envMap, String... commandArgs)
指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。
executeShellCommand(String)
より優れた障害検出とパフォーマンスを提供するため、可能な限り代わりに使用する必要があります。
パラメーター | |
---|---|
timeout | long : デバイスが応答していないと見なされるまでのミリ秒単位の時間。タイムアウトなしの場合は 0L |
envMap | |
commandArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeFastbootCommand
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。
デバイスが既に fastboot モードになっている場合に使用されると予想されます。パラメーター | |
---|---|
timeout | long : コマンドの有効期限が切れるまでのミリ秒単位の時間 |
commandArgs | String : 実行する fastboot コマンドと引数 |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeFastbootCommand
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 | デバイスとの接続が失われ、回復できない場合。 |
executeShellCommand
public abstract String executeShellCommand (String command)
adb シェル コマンドを実行し、出力をERROR(/String)
として返すヘルパー メソッド。
パラメーター | |
---|---|
command | String : 実行する adb shell コマンド |
戻り値 | |
---|---|
String | シェル出力 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb shell コマンド |
receiver | IShellOutputReceiver : シェル出力を送信するIShellOutputReceiver 。 |
maxTimeToOutputShellResponse | long : コマンドが応答を出力しない最大時間。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外が原因で失敗した場合にコマンドを再試行する最大回数。 retryAttempts成功しない場合、DeviceNotResponsiveException がスローされます。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb shell コマンド |
receiver | IShellOutputReceiver : シェル出力を送信するIShellOutputReceiver 。 |
maxTimeoutForCommand | long : コマンドが完了するまでの最大タイムアウト。 timeUnit で指定された単位 |
maxTimeToOutputShellResponse | long : コマンドが応答を出力しない最大時間。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外が原因で失敗した場合にコマンドを再試行する最大回数。 retryAttempts成功しない場合、DeviceNotResponsiveException がスローされます。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver)
指定された adb シェル コマンドを実行し、コマンドが失敗した場合は複数回再試行します。
デフォルト値を持つexecuteShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
の単純な形式。パラメーター | |
---|---|
command | String : 実行する adb shell コマンド |
receiver | IShellOutputReceiver : シェル出力を送信するIShellOutputReceiver 。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command)
adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に取り込まれたCommandResult
として結果を返すヘルパー メソッド。
パラメーター | |
---|---|
command | String : 実行するコマンド。 |
戻り値 | |
---|---|
CommandResult | CommandResult の結果。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
adb シェル コマンドを実行し、コマンド ステータス出力と stderr が適切に入力されたCommandResult
として結果を返すヘルパー メソッド。 stdout は、指定されたストリームに送られます。
パラメーター | |
---|---|
command | String : 実行するコマンド。 |
pipeToOutput | OutputStream : std 出力がリダイレクトされるERROR(/OutputStream) 、または null。 |
戻り値 | |
---|---|
CommandResult | CommandResult の結果。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に取り込まれたCommandResult
として結果を返すヘルパー メソッド。
パラメーター | |
---|---|
command | String : 実行するコマンド。 |
pipeAsInput | File : コマンドへの入力としてパイプされるERROR(/File) 、または null。 |
戻り値 | |
---|---|
CommandResult | CommandResult の結果。 |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb shell コマンド |
maxTimeoutForCommand | long : コマンドが完了するまでの最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外が原因で失敗した場合にコマンドを再試行する最大回数。 retryAttempts成功しない場合、DeviceNotResponsiveException がスローされます。 |
戻り値 | |
---|---|
CommandResult |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
以下も参照してください。
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb shell コマンド |
maxTimeoutForCommand | long : コマンドが完了するまでの最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
戻り値 | |
---|---|
CommandResult |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
以下も参照してください。
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb shell コマンド |
pipeAsInput | File : コマンドへの入力としてパイプされるERROR(/File) 、または null。 |
pipeToOutput | OutputStream : std 出力がリダイレクトされるERROR(/OutputStream) 、または null。 |
maxTimeoutForCommand | long : コマンドが完了するまでの最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外が原因で失敗した場合にコマンドを再試行する最大回数。 retryAttempts成功しない場合、DeviceNotResponsiveException がスローされます。 |
戻り値 | |
---|---|
CommandResult |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
以下も参照してください。
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb shell コマンド |
pipeAsInput | File : コマンドへの入力としてパイプされるERROR(/File) 、または null。 |
pipeToOutput | OutputStream : std 出力がリダイレクトされるERROR(/OutputStream) 、または null。 |
pipeToError | OutputStream : std エラーがリダイレクトされるERROR(/OutputStream) 、または null。 |
maxTimeoutForCommand | long : コマンドが完了するまでの最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外が原因で失敗した場合にコマンドを再試行する最大回数。 retryAttempts成功しない場合、DeviceNotResponsiveException がスローされます。 |
戻り値 | |
---|---|
CommandResult |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
以下も参照してください。
fastbootWipeパーティション
public abstract CommandResult fastbootWipePartition (String partition)
デバイスのパーティションをワイプするヘルパー メソッド。
getUseFastbootErase()
がtrue
の場合、ファストブート消去を使用してパーティションが消去されます。デバイスは、次にデバイスが起動するときにファイルシステムを作成する必要があります。それ以外の場合は、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 | ERROR(/String) ベースバンド バージョン、または判別できない場合はnull (デバイスに無線がないか、バージョン文字列を読み取ることができない) |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
getBattery
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" の場合はtrue 、プロパティの値が"0" 、 "n" 、 "no" 、 "off" の場合はfalse 、 "false" 、またはそれ以外の場合はdefaultValue 。 |
スロー | |
---|---|
DeviceNotAvailableException |
getBootHistory
public abstractgetBootHistory ()
ヘルパー メソッドは、起動時間と起動理由を含む起動履歴マップを収集します。
戻り値 | |
---|---|
起動時間 (エポックからの秒単位の UTC 時間) と起動理由のマップ |
スロー | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
ヘルパー メソッドは、デバイスからのエポックからの指定された時間以降の起動時間と起動理由を含む起動履歴マップと、指定された時間単位を収集します。ミリ秒単位の現在のデバイスの utcEpochTime は、メソッドgetDeviceDate()
で取得できます。
パラメーター | |
---|---|
utcEpochTime | long : エポック以降のデバイス時間。 |
timeUnit | TimeUnit : 時間単位TimeUnit 。 |
戻り値 | |
---|---|
起動時間 (エポックからの秒単位の UTC 時間) と起動理由のマップ |
スロー | |
---|---|
DeviceNotAvailableException |
getBootloaderVersion
public abstract String getBootloaderVersion ()
このデバイスのブートローダー バージョンを取得する便利なメソッド。
デバイスの現在の状態からブートローダーのバージョンを取得しようとします。 (つまり、デバイスが fastboot モードの場合、fastboot からバージョンを取得しようとします)戻り値 | |
---|---|
String | ERROR(/String) ブートローダーのバージョン、または見つからない場合はnull |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
getBugreport
public abstract InputStreamSource getBugreport ()
デバイスからバグレポートを取得します。
これの実装は、SD カードのない (または SD カードがまだマウントされていない) デバイスで引き続き動作することが保証されています。戻り値 | |
---|---|
InputStreamSource | オンデマンドでバグレポートの内容を生成するInputStreamSource 。失敗した場合、 InputStreamSource 空のERROR(/InputStream) を生成します。 |
getBugreportz
public abstract InputStreamSource getBugreportz ()
デバイスからバグレポートを取得します。 zip 形式のバグレポートには、メインのバグレポートと、デバッグに役立つその他のログ ファイルが含まれています。
「adb バージョン」 > 1.0.36 でのみサポートされています戻り値 | |
---|---|
InputStreamSource | bugreportz を含む zip ファイルのInputStreamSource 。失敗した場合は null を返します。 |
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 |
getChildren
public abstract String[] getChildren (String deviceFilePath)
アクセス許可のために時々機能しないIFileEntry
を使用する代わりの方法。
パラメーター | |
---|---|
deviceFilePath | String : 検索を行うデバイス上のパスです |
戻り値 | |
---|---|
String[] | デバイス上のパスにあるすべてのファイルを含む文字列の配列。 |
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getDeviceClass
public abstract String getDeviceClass ()
デバイス クラスを取得します。
戻り値 | |
---|---|
String | ERROR(/String) デバイス クラス。 |
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 ()
エミュレータの stdout と stderr のストリームを取得します
戻り値 | |
---|---|
InputStreamSource | エミュレータ出力 |
getExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
デバイスの外部ストレージの空き容量を決定するヘルパー メソッド。
戻り値 | |
---|---|
long | 空き容量 (KB) |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
getFastbootProductType
public abstract String getFastbootProductType ()
fastboot モードのときにこのデバイスの製品タイプを取得する便利なメソッド。
このメソッドは、デバイスを fastboot にする必要がある場合にのみ使用してください。この場合、一般的なgetProductType()
メソッドよりも少し安全なバリアントです。これは、デバイスが正しくない状態または応答がない場合に ITestDevice がデバイスを fastboot に回復することを認識しているためです。戻り値 | |
---|---|
String | ERROR(/String) 製品タイプ名、または判別できない場合はnull |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
getFastbootProductVariant
public abstract String getFastbootProductVariant ()
fastboot モードのときにこのデバイスの製品タイプを取得する便利なメソッド。
このメソッドは、デバイスを fastboot にする必要がある場合にのみ使用してください。この場合、一般的なgetProductType()
メソッドよりも少し安全なバリアントです。これは、デバイスが正しくない状態または応答がない場合に ITestDevice がデバイスを fastboot に回復することを認識しているためです。戻り値 | |
---|---|
String | ERROR(/String) 製品タイプ名、または判別できない場合はnull |
スロー | |
---|---|
DeviceNotAvailableException | デバイスとの接続が失われ、回復できない場合。 |
getFastbootシリアル番号
public abstract String getFastbootSerialNumber ()
fastboot モードのシリアル番号を返します。
戻り値 | |
---|---|
String |
getFastbootVariable
public abstract String getFastbootVariable (String variableName)
指定された fastboot 変数の値をデバイスから取得します。
パラメーター | |
---|---|
variableName | String : 変数名 |
戻り値 | |
---|---|
String | プロパティ値、または存在しない場合はnull |
スロー | |
---|---|
| サポートされていない操作例外 |
DeviceNotAvailableException |
getFileEntry
public abstract IFileEntry getFileEntry (String path)
デバイス上のリモート ファイルへの参照を取得します。
パラメーター | |
---|---|
path | String : 取得するファイル パス。絶対パスまたは「/」からの相対パスを指定できます。 (つまり、「/system」と「system」の両方の構文がサポートされています) |
戻り値 | |
---|---|
IFileEntry | 指定されたpathにファイルが見つからない場合はIFileEntry またはnull |
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getIDevice
public abstract IDevice getIDevice ()
関連する ddmlib IDevice
への参照を返します。
IDevice
DDMS によって割り当てられる場合があります。したがって、呼び出し元はIDevice
への参照を保持しないでください。参照が古くなる可能性があるためです。戻り値 | |
---|---|
IDevice | IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
デバイスから指定されたプロパティの整数値を返します。
パラメーター | |
---|---|
name | String : プロパティ名 |
defaultValue | long : プロパティが空または存在しない場合に返されるデフォルト値。 |
戻り値 | |
---|---|
long | プロパティが空、存在しない、または整数値を持たない場合は、プロパティ値またはdefaultValue 。 |
スロー | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
ERROR(/System#currentTimeMillis())
によって返される、EPOCH 以降に Tradefed API が最後に再起動をトリガーした時間をミリ秒単位で返します。
戻り値 | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
デバイスの最初に起動された API レベルを取得します。デフォルトはUNKNOWN_API_LEVEL
です。
戻り値 | |
---|---|
int | デバイスの最初に起動された API レベルを示す整数 |
スロー | |
---|---|
| 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 |
以下も参照してください。
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" |
スロー | |
---|---|
DeviceNotAvailableException |
以下も参照してください。
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" |
スロー | |
---|---|
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 |
スロー | |
---|---|
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 |
スロー | |
---|---|
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 |
スロー | |
---|---|
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 ERROR(/String) product type name. Will not be null |
スロー | |
---|---|
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 ERROR(/String) product variant name or null if it cannot be determined |
スロー | |
---|---|
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 |
スロー | |
---|---|
| 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 ERROR(/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. |
スロー | |
---|---|
DeviceNotAvailableException |
以下も参照してください。
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. |
以下も参照してください。
isAdbRoot
public abstract boolean isAdbRoot ()
戻り値 | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
スロー | |
---|---|
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 |
スロー | |
---|---|
| 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 |
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
戻り値 | |
---|---|
boolean | true if the device is encrypted. |
スロー | |
---|---|
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 |
スロー | |
---|---|
| 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. |
スロー | |
---|---|
| 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 |
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
戻り値 | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
スロー | |
---|---|
| 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. |
スロー | |
---|---|
DeviceNotAvailableException |
logBugreport
public abstract boolean logBugreport (String dataName, ITestLogger listener)
Helper method to take a bugreport and log it to the reporters.
パラメーター | |
---|---|
dataName | String : name under which the bugreport will be reported. |
listener | ITestLogger : an ITestLogger to log the bugreport. |
戻り値 | |
---|---|
boolean | True if the logging was successful, false otherwise. |
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.
スロー | |
---|---|
| 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)スロー | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
postInvocationTearDown
public void postInvocationTearDown ()
このメソッドは非推奨です。
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 |
スロー | |
---|---|
| 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. |
スロー | |
---|---|
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) |
スロー | |
---|---|
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) |
スロー | |
---|---|
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. |
スロー | |
---|---|
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. |
スロー | |
---|---|
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 ERROR(/String) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
スロー | |
---|---|
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) |
スロー | |
---|---|
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. |
スロー | |
---|---|
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. |
スロー | |
---|---|
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. |
スロー | |
---|---|
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. |
スロー | |
---|---|
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. |
スロー | |
---|---|
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.スロー | |
---|---|
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. |
スロー | |
---|---|
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.スロー | |
---|---|
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.
スロー | |
---|---|
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 recoveryスロー | |
---|---|
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 |
スロー | |
---|---|
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
スロー | |
---|---|
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.
スロー | |
---|---|
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. |
スロー | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
以下も参照してください。
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.
スロー | |
---|---|
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.
スロー | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
remountSystemWritable
public abstract void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
スロー | |
---|---|
| 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 |
スロー | |
---|---|
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 |
スロー | |
---|---|
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 |
スロー | |
---|---|
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 |
スロー | |
---|---|
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 |
スロー | |
---|---|
| 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. |
スロー | |
---|---|
| 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. |
以下も参照してください。
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 |
スロー | |
---|---|
| 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. |
スロー | |
---|---|
| 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. |
スロー | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
takeBugreport
public abstract Bugreport takeBugreport ()
Take a bugreport and returns it inside a Bugreport
object to handle it. Return null in case of issue.
Bugreport#close()
.戻り値 | |
---|---|
Bugreport |
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. |
スロー | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
| 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 |
スロー | |
---|---|
| 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. |
スロー | |
---|---|
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. |
スロー | |
---|---|
DeviceNotAvailableException | if device is still unresponsive after waitTime expires. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
スロー | |
---|---|
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.スロー | |
---|---|
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 |
スロー | |
---|---|
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. |