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 void deleteFile(String deviceFilePath, int userId)

デバイス上のファイルまたはディレクトリを削除するヘルパー メソッド。

abstract boolean deviceSoftRestarted(ProcessInfo prevSystemServerProcess)

現在の system_server と以前の system_server ProcessInfo を比較して、デバイスがソフトリブートされたかどうかを確認するヘルパー メソッド。

abstract boolean deviceSoftRestartedSince(long utcEpochTime, TimeUnit timeUnit)

デバイスのエポックからの UTC 時刻とその ERROR(/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)

指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。

abstract CommandResult executeFastbootCommand(long timeout, String... commandArgs)

fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。

abstract CommandResult executeFastbootCommand(String... commandArgs)

デフォルトのタイムアウトが 2 分間のシステム コマンドとして fastboot コマンドを実行するヘルパー メソッド。

abstract CommandResult executeLongFastbootCommand(String... commandArgs)

長時間実行される fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。

abstract CommandResult executeLongFastbootCommand( envVarMap, String... commandArgs)

長時間実行される fastboot コマンドを、システム環境変数を使用してシステム コマンドとして実行するヘルパー メソッド。

abstract String executeShellCommand(String command)

adb シェルコマンドを実行し、出力を String として返すヘルパー メソッド。

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 が適切に入力された CommandResult として結果を返すヘルパー メソッドです。

abstract CommandResult executeShellV2Command(String command, OutputStream pipeToOutput)

adb シェルコマンドを実行し、コマンド ステータス出力と stderr が適切に入力された CommandResult として結果を返すヘルパー メソッドです。

abstract CommandResult executeShellV2Command(String command, File pipeAsInput)

adb シェルコマンドを実行し、コマンド ステータス出力、stdout、stderr が適切に入力された CommandResult として結果を返すヘルパー メソッドです。

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()

デバイスが割り当てられている場合はキャッシュに保存された DeviceDescriptor を返し、そうでない場合は現在の DeviceDescriptor を返します。

abstract DeviceDescriptor getCachedDeviceDescriptor(boolean shortDescriptor)

デバイスが割り当てられている場合はキャッシュに保存された DeviceDescriptor を返し、そうでない場合は現在の DeviceDescriptor を返します。

abstract String[] getChildren(String deviceFilePath)

IFileEntry を使用する代わりに、権限が原因で機能しないことがあります。

abstract AbstractConnection getConnection()

デバイスに関連付けられている接続を返します。

abstract String getDeviceClass()

デバイスクラスを取得します。

abstract long getDeviceDate()

デバイスの日付をエポックからのミリ秒単位で返します。

abstract DeviceDescriptor getDeviceDescriptor()

デバイス情報から DeviceDescriptor を返して、実際のデバイス オブジェクトを渡さずにデバイスに関する情報を取得します。

abstract DeviceDescriptor getDeviceDescriptor(boolean shortDescriptor)

デバイス情報から DeviceDescriptor を返して、実際のデバイス オブジェクトを渡さずにデバイスに関する情報を取得します。

abstract TestDeviceState getDeviceState()

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

abstract long getDeviceTimeOffset(Date date)

デバイスと指定された ERROR(/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 IDevice への参照を返します。

abstract long getIntProperty(String name, long defaultValue)

デバイスから指定されたプロパティの整数値を返します。

abstract long getLastExpectedRebootTimeMillis()

Tradefed API が最後に再起動をトリガーした時刻(エポックからのミリ秒単位)を System.currentTimeMillis() によって返します。

abstract int getLaunchApiLevel()

デバイスが最初にリリースされた API レベルを取得します。

abstract InputStreamSource getLogcat()

logcat データのスナップショット ストリームを取得します。

abstract InputStreamSource getLogcat(int maxBytes)

キャプチャされた logcat データの最後の maxBytes のスナップショット ストリームを取得します。

abstract InputStreamSource getLogcatDump()

デバイスの現在の logcat ダンプを取得します。

abstract InputStreamSource getLogcatSince(long date)

指定された日付からキャプチャされた logcat データのスナップショット ストリームを取得します。

abstract String getMountPoint(String mountName)

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

abstract ITestDevice.MountPointInfo getMountPointInfo(String mountpoint)

指定されたマウントポイント パスに対応する MountPointInfo を返します。そのパスにマウントされたものがない場合、または /proc/mounts にマウントポイントとして表示されない場合は null を返します。

abstract getMountPointInfo()

デバイスの /proc/mounts にある情報を解析したバージョンを返します。

abstract long getPartitionFreeSpace(String partition)

デバイス パーティションの空き容量を判断するヘルパー メソッド。

abstract ProcessInfo getProcessByName(String processName)

ヘルパー メソッドは「pidof」コマンドと「stat」コマンドを実行し、指定されたプロセスの PID とプロセス開始時間を示す ProcessInfo オブジェクトを返します。

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 を返します。

default String getTrackingSerial()

デバイス管理の目的で、デバイスの追跡に使用されるシリアル番号を取得します。

abstract boolean getUseFastbootErase()

fastboot erase と fastboot format のどちらを使用してデバイスのパーティションをワイプするかを取得します。

abstract boolean isAdbRoot()
abstract boolean isAdbTcp()
abstract boolean isAppEnumerationSupported()

デバイス上のプラットフォームがアプリの列挙をサポートしているかどうかを確認します。

abstract boolean isBypassLowTargetSdkBlockSupported()

デバイス上のプラットフォームが、アプリのインストール時に低いターゲット SDK ブロックのバイパスをサポートしているかどうかを確認します。

abstract boolean isDebugfsMounted()

debugfs がマウントされているかどうかを確認します。

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()

デバイスが TestDeviceState.FASTBOOT または TestDeviceState.FASTBOOTD にある場合は true を返します。

abstract boolean logAnrs(ITestLogger logger)

デバイスから ANR を収集してログに記録します。

abstract void logOnDevice(String tag, Log.LogLevel level, String format, Object... args)

デバイスの logcat にメッセージを記録します。

abstract void mountDebugfs()

debugfs をマウントします。

abstract void nonBlockingReboot()

デバイスを再起動するためのコマンドを送信し、コマンドが完了したとき、またはデバイスが adb に表示されなくなったときに返します。

abstract void postBootSetup()

起動後にテストを行うようにデバイスを構成する手順を実施します。

default void postInvocationTearDown()

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

abstract void postInvocationTearDown(Throwable invocationException)

呼び出しが完了した後に実行される、デバイス固有の必要なクリーンアップの追加手順。

default void preInvocationSetup(IBuildInfo info, MultiMap<String, String> attributes)

呼び出しフローの前にデバイス上で実行される、デバイス固有の必要な設定の追加手順。

abstract boolean pullDir(String deviceFilePath, File localDir)

デバイスからディレクトリ コンテンツを再帰的に pull します。

abstract boolean pullDir(String deviceFilePath, File localDir, int userId)

デバイスからディレクトリ コンテンツを再帰的に pull します。

abstract File pullFile(String remoteFilePath, int userId)

デバイスからファイルを取得し、ローカルの一時 ERROR(/File) に保存して、その File を返します。

abstract File pullFile(String remoteFilePath)

デバイスからファイルを取得し、ローカルの一時 ERROR(/File) に保存して、その File を返します。

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)

デバイスの外部ストレージからファイルを取得し、ローカルの一時 ERROR(/File) に保存し、その File への参照を返す便利なメソッドです。

abstract boolean pushDir(File localDir, String deviceFilePath, int userId)

ディレクトリの内容を再帰的にデバイスに push します。

abstract boolean pushDir(File localDir, String deviceFilePath, excludedDirectories)

フィルタされた一部のディレクトリを除外しながら、ディレクトリの内容をデバイスに再帰的にプッシュします。

abstract boolean pushDir(File localDir, String deviceFilePath)

ディレクトリの内容を再帰的にデバイスに push します。

abstract boolean pushFile(File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded)

pushFile(File, String) のバリエーション。必要に応じて、コンテンツ プロバイダのニーズを評価できます。

abstract boolean pushFile(File localFile, String deviceFilePath)

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

abstract boolean pushFile(File localFile, String deviceFilePath, int userId)

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

abstract boolean pushString(String contents, String deviceFilePath)

文字列から作成されたファイルをデバイスにプッシュする

abstract void reboot()

デバイスを adb モードで再起動します。

abstract void reboot(String reason)

指定された reason を使用してデバイスを adb モードで再起動します。この 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()

reboot() の代替手段。デバイスがオンラインになるまで(adb に表示される状態になるまで)のみブロックします。

abstract void rebootUntilOnline(String reason)

reboot() の代替手段。デバイスがオンラインになるまで(adb に表示される状態になるまで)のみブロックします。

abstract void rebootUserspace()

デバイスのユーザー空間部分のみを再起動します。

abstract void rebootUserspaceUntilOnline()

rebootUserspace() ()} の代替手段。デバイスがオンラインになるまで(adb に表示される状態になるまで)のみブロックします。

abstract void remountSystemReadOnly()

デバイスのシステム パーティションを読み取り専用にします。

abstract void remountSystemWritable()

デバイスのシステム パーティションを書き込み可能にします。

abstract void remountVendorReadOnly()

デバイス上のベンダー パーティションを読み取り専用にします。

abstract void remountVendorWritable()

デバイス上のベンダー パーティションを書き込み可能にします。

abstract boolean runInstrumentationTests(IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)

1 つ以上のリスナーをパラメータとして渡して ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) を実行するための便利なメソッドです。

abstract boolean runInstrumentationTests(IRemoteAndroidTestRunner runner, listeners)

インストルメンテーション テストを実行し、デバイスの復元を提供します。

abstract boolean runInstrumentationTestsAsUser(IRemoteAndroidTestRunner runner, int userId, listeners)

ERROR(ITestDevice.runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice.runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) と同じですが、指定したユーザーのテストが実行されます。

abstract boolean runInstrumentationTestsAsUser(IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)

ITestDevice.runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) と同じですが、特定のユーザーに対してテストを実行します。

abstract void setDate(Date date)

デバイスの日付を設定します

注: デバイスの日付を設定するには、root 権限が必要です。

abstract void setOptions(TestDeviceOptions options)

デバイスの TestDeviceOptions を設定する

abstract boolean setProperty(String propKey, String propValue)

デバイスで指定されたプロパティ値を設定します。

abstract void setRecovery(IDeviceRecovery recovery)

このデバイスに使用する IDeviceRecovery を設定します。

abstract void setRecoveryMode(ITestDevice.RecoveryMode mode)

デバイスに使用する現在のリカバリモードを設定します。

abstract void setTrackingSerial(String trackingSerial)

デバイス管理の目的で、デバイスの参照に使用するシリアル番号を追跡します。

abstract void setUseFastbootErase(boolean useFastbootErase)

fastboot erase と fastboot format のどちらを使用してデバイスのパーティションをワイプするかを設定します。

abstract void startLogcat()

バックグラウンドでデバイスからの logcat 出力の取得を開始します。

abstract boolean startTradeInModeTesting(int timeoutMs)

下取りモードのテスト機能を有効にする。

abstract void stopEmulatorOutput()

エミュレータの出力を閉じて削除します。

abstract void stopLogcat()

デバイスからの logcat 出力の取得を停止し、現在保存されている logcat データを破棄します。

abstract void stopTradeInModeTesting()

下取りモードのテストは終了しました。

abstract String switchToAdbTcp()

デバイスを adb-over-tcp モードに切り替えます。

abstract boolean switchToAdbUsb()

デバイスを USB 経由の ADB モードに切り替えます。

abstract boolean syncFiles(File localFileDir, String deviceFilePath)

ローカル ファイル ディレクトリの内容をデバイスに増分同期します。

abstract boolean unlockDevice()

デバイスが暗号化されている場合は、デバイスのロックを解除します。

abstract void unmountDebugfs()

debugfs のマウントを解除します。

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」状態になるのをブロックします(これは IDeviceRecovery とは異なります)。

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 shell コマンドに応答するまで待ちます。

定数

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

clearLogcat

public abstract void clearLogcat ()

蓄積された logcat データを削除します。

これは、ITestDevice.getLogcat() が特定の時点(新しいデバイスビルドのフラッシュ後など)以降に生成されたログデータのみを返すようにする場合に便利です。

deleteFile

public abstract void deleteFile (String deviceFilePath)

デバイス上のファイルまたはディレクトリを削除するヘルパー メソッド。

パラメータ
deviceFilePath String: デバイス上のファイルの絶対パス。

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

deleteFile

public abstract void deleteFile (String deviceFilePath, 
                int userId)

デバイス上のファイルまたはディレクトリを削除するヘルパー メソッド。

パラメータ
deviceFilePath String: デバイス上のファイルの絶対パス。

userId int: 削除するユーザー ID

例外
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(デバイスがソフトリブートされた場合)

例外
RuntimeException デバイスの起動理由が異常な場合
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

deviceSoftRestartedSince

public abstract boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

デバイスのエポックからの UTC 時刻とその ERROR(/TimeUnit) 以降にデバイスがソフトリブートされたかどうかを確認するヘルパー メソッド。ソフトリブートとは、デバイスのハードリブート(リクエストされた再起動など)以外で system_server が再起動されたことを指します。現在のデバイスの utcEpochTime(ミリ秒単位)は、メソッド getDeviceDate() で取得できます。

パラメータ
utcEpochTime long: エポックからのデバイス時間(秒単位)。

timeUnit TimeUnit: 指定された utcEpochTime の時間単位 TimeUnit

戻り値
boolean true(デバイスがソフトリブートされた場合)

例外
RuntimeException デバイスの起動理由が異常な場合
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableAdbRoot

public abstract boolean disableAdbRoot ()

adb root をオフにします。

adb root を無効にすると、デバイスが adb から切断されることがあります。この方法では、デバイスが使用可能になるまでブロックされます。

戻り値
boolean 成功した場合は true

例外
DeviceNotAvailableException デバイスとの接続が失われ、復元できない場合。

doesFileExist

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 コマンドの stdout。コマンドが実行されなかった場合は null

例外
DeviceNotAvailableException デバイスとの接続が失われ、復元できない場合。

executeAdbCommand

public abstract String executeAdbCommand (String... commandArgs)

adb コマンドをシステム コマンドとして実行するヘルパー メソッド。

executeShellCommand(String) は、障害の検出とパフォーマンスが向上するため、可能な限り代わりに使用する必要があります。

パラメータ
commandArgs String: 実行する adb コマンドと引数

戻り値
String コマンドの stdout。コマンドが実行されなかった場合は null

例外
DeviceNotAvailableException デバイスとの接続が失われ、復元できない場合。

executeAdbCommand

public abstract String executeAdbCommand (long timeout, 
                 envMap, 
                String... commandArgs)

指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。

executeShellCommand(String) は、障害の検出とパフォーマンスが向上するため、可能な限り代わりに使用する必要があります。

パラメータ
timeout long: デバイスが応答していないと見なされるまでの時間(ミリ秒単位)。タイムアウトなしの場合は 0L

envMap : コマンドに設定する環境

commandArgs String: 実行する adb コマンドと引数

戻り値
String コマンドの stdout。コマンドが実行されなかった場合は 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)

デフォルトのタイムアウトが 2 分間のシステム コマンドとして fastboot コマンドを実行するヘルパー メソッド。

デバイスがすでに fastboot モードになっている場合に使用されることが想定されています。

パラメータ
commandArgs String: 実行する fastboot コマンドと引数

戻り値
CommandResult コマンドの出力を含む CommandResult

例外
DeviceNotAvailableException デバイスとの接続が失われ、復元できない場合。

executeLongFastbootCommand

public abstract CommandResult executeLongFastbootCommand (String... commandArgs)

長時間実行される fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。

executeFastbootCommand(String) と同じですが、タイムアウトが長くなります。

パラメータ
commandArgs String: 実行する fastboot コマンドと引数

戻り値
CommandResult コマンドの出力を含む CommandResult

例外
DeviceNotAvailableException デバイスとの接続が失われ、復元できない場合。

executeLongFastbootCommand

public abstract CommandResult executeLongFastbootCommand ( envVarMap, 
                String... commandArgs)

長時間実行される fastboot コマンドを、システム環境変数を使用してシステム コマンドとして実行するヘルパー メソッド。

executeFastbootCommand(String) と同じですが、タイムアウトが長くなります。

パラメータ
envVarMap : fastboot コマンドが実行されるシステム環境変数

commandArgs String: 実行する fastboot コマンドと引数

戻り値
CommandResult コマンドの出力を含む CommandResult

例外
DeviceNotAvailableException デバイスとの接続が失われ、復元できない場合。

executeShellCommand

public abstract String executeShellCommand (String command)

adb シェルコマンドを実行し、出力を String として返すヘルパー メソッド。

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

戻り値
String シェルの出力

例外
DeviceNotAvailableException デバイスとの接続が失われ、復元できない場合。

executeShellCommand

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 デバイスとの接続が失われ、復元できない場合。

executeShellCommand

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 デバイスとの接続が失われ、復元できない場合。

executeShellCommand

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 デバイスとの接続が失われ、復元できない場合。

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: 標準出力がリダイレクトされる 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 シェルコマンドを実行します。

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

maxTimeoutForCommand long: コマンドが完了するまでの最大タイムアウト(timeUnit で指定された単位)

timeUnit TimeUnit: maxTimeToOutputShellResponse の単位

retryAttempts int: 例外が原因で失敗した場合にコマンドを再試行する最大回数。retryAttempts が正常に実行されなかった場合、DeviceNotResponsiveException がスローされます。

戻り値
CommandResult

例外
DeviceNotAvailableException デバイスとの接続が失われ、復元できない場合。

executeShellV2Command

public abstract CommandResult executeShellV2Command (String command, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit)

コマンドの動作を制御するための追加のパラメータを使用して、adb シェルコマンドを実行します。

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

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 シェルコマンドを実行します。

パラメータ
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 デバイスとの接続が失われ、復元できない場合。

executeShellV2Command

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 デバイスとの接続が失われ、復元できない場合。

fastbootWipePartition

public abstract CommandResult fastbootWipePartition (String partition)

デバイスのパーティションをワイプするヘルパー メソッド。

getUseFastbootErase()true の場合、fastboot erase を使用してパーティションがワイプされます。次回デバイスが起動したときに、デバイスがファイルシステムを作成する必要があります。それ以外の場合は、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 無線のバージョンが返されないこともあります。要約すると、このメソッドは、gsm.version.baseband プロパティが fastboot getvar version-baseband によって返されたバージョンと同じである場合にのみ、正確なバージョンを報告します。

戻り値
String 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"defaultValue の場合は false

例外
DeviceNotAvailableException

getBootHistory

public abstract  getBootHistory ()

ヘルパー メソッドは、起動時間と起動理由を含む起動履歴マップを収集します。

戻り値
起動時間(エポックからの経過時間(UTC 秒単位))と起動理由のマップ

例外
DeviceNotAvailableException

getBootHistorySince

public abstract  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

ヘルパー メソッドは、指定されたエポックからの時間と指定された時間単位に基づいて、デバイスから起動時間と起動理由を含む起動履歴マップを収集します。現在のデバイスの utcEpochTime(ミリ秒単位)は、メソッド getDeviceDate() で取得できます。

パラメータ
utcEpochTime long: エポックからのデバイス時間。

timeUnit TimeUnit: 時間単位 TimeUnit

戻り値
起動時間(エポックからの経過時間(UTC 秒単位))と起動理由のマップ

例外
DeviceNotAvailableException

getBootloaderVersion

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

getChildren

public abstract String[] getChildren (String deviceFilePath)

権限が原因で機能しないことがある IFileEntry の代替手段。

パラメータ
deviceFilePath String: デバイス上で検索を行うパス

戻り値
String[] デバイス上のパス内のすべてのファイルを含む文字列の配列。

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getConnection

public abstract AbstractConnection getConnection ()

デバイスに関連付けられている接続を返します。

戻り値
AbstractConnection

getDeviceClass

public abstract String getDeviceClass ()

デバイスクラスを取得します。

戻り値
String 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

getDeviceState

public abstract TestDeviceState getDeviceState ()

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

戻り値
TestDeviceState

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 モードにする必要がある場合にのみ使用してください。この場合、ITestDevice はデバイスが正しくない状態であるか、応答しない場合にデバイスを fastboot に復元することを認識するため、汎用の getProductType() メソッドよりも安全なバリエーションです。

戻り値
String String プロダクト タイプ名(特定できない場合は null

例外
DeviceNotAvailableException デバイスとの接続が失われ、復元できない場合。

getFastbootProductVariant

public abstract String getFastbootProductVariant ()

Fastboot モードでこのデバイスのプロダクト タイプを取得する便利なメソッドです。

この方法は、デバイスを Fastboot モードにする必要がある場合にのみ使用してください。この場合、ITestDevice はデバイスが正しくない状態であるか、応答しない場合にデバイスを fastboot に復元することを認識するため、汎用の getProductType() メソッドよりも安全なバリエーションです。

戻り値
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 指定された path のファイルが見つからない場合の IFileEntry または null

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getIDevice

public abstract IDevice getIDevice ()

関連する ddmlib IDevice への参照を返します。

デバイスが adb から切断されて再接続されるたびに、新しい 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 ()

Tradefed API が最後に再起動をトリガーした時刻(System.currentTimeMillis() によって返されるエポックからのミリ秒単位)を返します。

戻り値
long

getLaunchApiLevel

public abstract int getLaunchApiLevel ()

デバイスが最初にリリースされた際の API レベルを取得します。デフォルトは UNKNOWN_API_LEVEL です。

戻り値
int デバイスが最初に起動された API レベルを示す整数

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getLogcat

public abstract InputStreamSource getLogcat ()

logcat データのスナップショット ストリームを取得します。

次の 2 つのモードで動作します。

  • 現在バックグラウンドで logcat がキャプチャされている場合は、バックグラウンド logcat キャプチャの現在の内容を最大 TestDeviceOptions.getMaxLogcatDataSize() バイト返します。
  • それ以外の場合は、デバイスが現在応答している場合は、logcat データの静的ダンプが返されます。

    戻り値
    InputStreamSource

  • getLogcat

    public abstract InputStreamSource getLogcat (int maxBytes)

    キャプチャされた logcat データの最後の maxBytes のスナップショット ストリームを取得します。

    キャプチャされた logcat データのスナップショットを頻繁にキャプチャする際に、getLogcat() スナップショット全体を取得する際に発生する可能性のあるディスク容量のペナルティを回避する場合に便利です。

    パラメータ
    maxBytes int: 返されるデータの最大量。メモリに余裕を持って収まる量にする必要があります。

    戻り値
    InputStreamSource

    getLogcatDump

    public abstract InputStreamSource getLogcatDump ()

    デバイスの現在の logcat ダンプを取得します。getLogcat() とは異なり、このメソッドは常に logcat の静的ダンプが返されます。

    デバイスに到達できない場合は何も返されないという欠点があります。

    戻り値
    InputStreamSource logcat データの InputStreamSource。logcat データをキャプチャできない場合は、空のストリームが返されます。

    getLogcatSince

    public abstract InputStreamSource getLogcatSince (long date)

    指定された日付からキャプチャされた logcat データのスナップショット ストリームを取得します。デバイスの時刻は getDeviceDate() を使用する必要があります。

    パラメータ
    date long: スナップショットの開始時間から現在までのエポックからのミリ秒数。(「date +%s」を使用して取得できます)

    戻り値
    InputStreamSource

    getMountPoint

    public abstract String getMountPoint (String mountName)

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

    IDevice のキャッシュに保存された情報が利用できない場合は、デバイスに直接クエリを実行します。

    TODO: この動作を IDevice.getMountPoint(String) に移動

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

    戻り値
    String マウント ポイントまたは null

    getMountPointInfo

    public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

    指定されたマウントポイント パスに対応する MountPointInfo を返します。そのパスにマウントされたものがない場合、または /proc/mounts にマウントポイントとして表示されない場合は null を返します。

    パラメータ
    mountpoint String

    戻り値
    ITestDevice.MountPointInfo 「/proc/mounts」の情報を含む MountPointInfoERROR(/List)

    例外
    DeviceNotAvailableException

    関連項目:

    getMountPointInfo

    public abstract  getMountPointInfo ()

    デバイスの /proc/mounts にある情報を解析して返します。

    戻り値
    「/proc/mounts」の情報を含む MountPointInfoERROR(/List)

    例外
    DeviceNotAvailableException

    getPartitionFreeSpace

    public abstract long getPartitionFreeSpace (String partition)

    デバイス パーティションの空き容量を判断するヘルパー メソッド。

    パラメータ
    partition String

    戻り値
    long 空き容量(KB)

    例外
    DeviceNotAvailableException デバイスとの接続が失われ、復元できない場合。

    getProcessByName

    public abstract ProcessInfo getProcessByName (String processName)

    ヘルパー メソッドは、「pidof」コマンドと「stat」コマンドを実行し、指定されたプロセスの PID とプロセス開始時間を示す ProcessInfo オブジェクトを返します。

    パラメータ
    processName String: プロセス名の文字列。

    戻り値
    ProcessInfo 指定された processName の ProcessInfo

    例外
    DeviceNotAvailableException

    getProcessPid

    public abstract String getProcessPid (String process)

    サービスの pid を返します。エラーが発生した場合は null を返します。

    パラメータ
    process String: プロセス名の文字列。

    戻り値
    String

    例外
    DeviceNotAvailableException

    getProductType

    public abstract String getProductType ()

    このデバイスのプロダクト タイプを取得する便利なメソッド。

    この方法は、デバイスが adb モードまたは fastboot モードの場合に機能します。

    戻り値
    String