NativeDevice

public class NativeDevice
extends Object implements IConfigurationReceiver, IManagedTestDevice, ITestLoggerReceiver

java.lang.Object
   ↳ com.android.tradefed.device.NativeDevice


ITestDevice 非フルスタック Android デバイスのデフォルト実装。

概要

ネストされたクラス

class NativeDevice.AdbAction

OS の「adb ....」コマンドを実行するための ERROR(DeviceAction/com.android.tradefed.device.NativeDevice.DeviceAction DeviceAction)。 

class NativeDevice.AdbShellAction

 

class NativeDevice.RebootDeviceAction

デバイスの再起動には ERROR(DeviceAction/com.android.tradefed.device.NativeDevice.DeviceAction DeviceAction)。 

定数

String DEBUGFS_PATH

int INVALID_USER_ID

無効なユーザー ID または見つからないユーザー ID に対して返される値: UserHandle で -10000 の値が定義されています。

long MAX_HOST_DEVICE_TIME_OFFSET

int MAX_RETRY_ATTEMPTS

実行するコマンドの再試行回数のデフォルト値

String SD_CARD

String STORAGE_EMULATED

フィールド

protected TestDeviceOptions mOptions

protected final IDeviceStateMonitor mStateMonitor

パブリック コンストラクタ

NativeDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

TestDevice を作成します。

パブリック メソッド

void batchPrefetchStartupBuildProps()

必要なすべてのプロパティをプリフェッチして、それぞれに対して「adb getprop」を呼び出すのではなく、マイクロ最適化(約 400 ミリ秒)を行いました。

boolean canSwitchToHeadlessSystemUser()

ヘッドレスの SYSTEM ユーザーに切り替えることが許可されているかどうかを返します。

boolean checkApiLevelAgainstNextRelease(int strictMinLevel)

最小限サポートされているレベルで、機能が現在サポートされているかどうかを確認します。

boolean checkConnectivity()

デバイスがネットワークに接続されていることを確認します。

boolean clearErrorDialogs()

デバイス UI に現在表示されているエラー ダイアログを閉じようとします。

void clearLastConnectedWifiNetwork()

最後に接続された Wi-Fi ネットワークをクリアします。

void clearLogcat()

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

boolean connectToWifiNetwork( wifiSsidToPsk, boolean scanSsid)

Wi-Fi ネットワークに接続します。

boolean connectToWifiNetwork(String wifiSsid, String wifiPsk)

Wi-Fi ネットワークに接続します。

boolean connectToWifiNetwork( wifiSsidToPsk)

Wi-Fi ネットワークに接続します。f

boolean connectToWifiNetwork(String wifiSsid, String wifiPsk, boolean scanSsid)

Wi-Fi ネットワークに接続します。

boolean connectToWifiNetworkIfNeeded(String wifiSsid, String wifiPsk, boolean scanSsid)

デバイスが現在ネットワークに接続されていない場合にのみ接続する connectToWifiNetwork(String, String) のバリエーション。

boolean connectToWifiNetworkIfNeeded(String wifiSsid, String wifiPsk)

デバイスが現在ネットワークに接続されていない場合にのみ接続する connectToWifiNetwork(String, String) のバリエーション。

int createUser(String name, boolean guest, boolean ephemeral)

指定された名前と指定されたフラグを使用してユーザーを作成します。

int createUser(String name, boolean guest, boolean ephemeral, boolean forTesting)

指定された名前と指定されたフラグを使用してユーザーを作成します。

int createUser(String name)

指定された名前とデフォルトのフラグ 0 を持つユーザーを作成します。

int createUserNoThrow(String name)

指定された名前とデフォルトのフラグ 0 を持つユーザーを作成します。

DeviceInspectionResult debugDeviceNotAvailable()

デバイスを検査し、デバイスが使用できなくなったときに詳細情報を返します。

void deleteFile(String deviceFilePath, int userId)

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

void deleteFile(String deviceFilePath)

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

void deregisterDeviceActionReceiver(IDeviceActionReceiver deviceActionReceiver)

登録済みの IDeviceActionReceiver を削除します。

boolean deviceSoftRestarted(ProcessInfo prevSystemServerProcess)

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

boolean deviceSoftRestartedSince(long utcEpochTime, TimeUnit timeUnit)

デバイスの UTC エポック時間とその ERROR(/TimeUnit) から、デバイスがソフト再起動されたかどうかを確認するヘルパー メソッド。

boolean disableAdbRoot()

adb root をオフにします。

void disableKeyguard()

キーガードを無効にしようとします。

boolean disableNetworkMonitor()

デバイスのネットワーク モニタリングを無効にします。

boolean disconnectFromWifi()

Wi-Fi ネットワークから切断します。

boolean doesFileExist(String deviceFilePath, int userId)

特定のユーザーのデバイスにファイルが存在するかどうかを判断するヘルパー メソッド。

boolean doesFileExist(String deviceFilePath)

デバイス上のファイルが存在するかどうかを判断するヘルパー メソッド。

File dumpHeap(String process, String devicePath)

system_server からヒープをダンプしようとします。

boolean enableAdbRoot()

adb root をオンにします。

boolean enableNetworkMonitor()

デバイスでネットワーク モニタリングを有効にします。

String executeAdbCommand(long timeout, String... cmdArgs)

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

String executeAdbCommand(long timeout, envMap, String... cmdArgs)

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

String executeAdbCommand(String... cmdArgs)

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

CommandResult executeAdbV2Command(String... cmdArgs)

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

CommandResult executeAdbV2Command(long timeout, String... cmdArgs)

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

CommandResult executeAdbV2Command(long timeout, envMap, String... cmdArgs)

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

CommandResult executeFastbootCommand(String... cmdArgs)

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

CommandResult executeFastbootCommand(long timeout, String... cmdArgs)

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

CommandResult executeLongFastbootCommand(String... cmdArgs)

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

CommandResult executeLongFastbootCommand( envVarMap, String... cmdArgs)

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

String executeShellCommand(String command)

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

void executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

adb シェルコマンドを実行します。コマンドの動作を制御するパラメータが追加されています。

void executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

adb シェルコマンドを実行します。コマンドの動作を制御するパラメータが追加されています。

void executeShellCommand(String command, IShellOutputReceiver receiver)

指定された adb シェルコマンドを実行します。コマンドが失敗した場合は、複数回再試行します。

CommandResult executeShellV2Command(String cmd)

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

CommandResult executeShellV2Command(String cmd, OutputStream pipeToOutput)

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

CommandResult executeShellV2Command(String cmd, File pipeAsInput)

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

CommandResult executeShellV2Command(String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

adb シェルコマンドを実行します。コマンドの動作を制御するパラメータが追加されています。

CommandResult executeShellV2Command(String cmd, long maxTimeoutForCommand, TimeUnit timeUnit)

adb シェルコマンドを実行します。コマンドの動作を制御するパラメータが追加されています。

CommandResult executeShellV2Command(String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

adb シェルコマンドを実行します。コマンドの動作を制御するパラメータが追加されています。

CommandResult executeShellV2Command(String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

adb シェルコマンドを実行します。コマンドの動作を制御するパラメータが追加されています。

CommandResult fastbootWipePartition(String partition)

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

getActiveApexes()

デバイスで有効化された APEX に関する情報を取得します。

String getAdbPath()

使用されている adb バイナリのパスを返します。

getAllSettings(String namespace)

リクエストされた Namespace の Key-Value ペアを返します。

DeviceAllocationState getAllocationState()

デバイスの現在の割り当て状態を返します。

String getAndroidId(int userId)

userId に関連付けられた android-id を検索して返します。見つからない場合は null を返します。

getAndroidIds()

一致するユーザー ID が見つかった Android ID のマップを作成します。

int getApiLevel()

デバイスの API レベルを取得します。

PackageInfo getAppPackageInfo(String packageName)

デバイスにインストールされているパッケージに関する情報を取得します。

getAppPackageInfos()

デバイスにインストールされているパッケージの情報を取得します。

String getBasebandVersion()

このデバイスのベースバンド(ラジオ)バージョンを取得する便利なメソッド。

Integer getBattery()

デバイスの現在のバッテリー残量を返します。バッテリー残量が利用できない場合は Null を返します。

boolean getBooleanProperty(String name, boolean defaultValue)

指定されたプロパティのブール値を返します。

getBootHistory()

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

getBootHistorySince(long utcEpochTime, TimeUnit timeUnit)

ヘルパー メソッドは、デバイスから指定されたエポック以降の時間と指定された時間単位で、起動時間と起動理由を含む起動履歴マップを収集します。

String getBootloaderVersion()

このデバイスのブートローダー バージョンを取得する便利なメソッド。

InputStreamSource getBugreport()

デバイスからバグレポートを取得します。

InputStreamSource getBugreportz()

デバイスから bugreportz を取得します。

String getBuildAlias()

デバイスが現在実行しているビルドのエイリアスを取得します。

String getBuildFlavor()

デバイスのビルド フレーバーを取得します。

String getBuildId()

デバイスが現在実行しているビルドを取得します。

String getBuildSigningKeys()

デバイス イメージの署名に使用された鍵の種類を返します

通常、Android デバイスはテストキー(AOSP の場合など)またはリリースキー(個々のデバイス メーカーが管理)で署名されます。

DeviceDescriptor getCachedDeviceDescriptor()

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

DeviceDescriptor getCachedDeviceDescriptor(boolean shortDescriptor)

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

String[] getChildren(String path)

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

AbstractConnection getConnection()

デバイスに関連付けられた現在の接続。

ContentProviderHandler getContentProvider(int userId)

ContentProviderHandler を返します。利用できない場合は null を返します。

DeviceFoldableState getCurrentFoldableState()

デバイスの現在の折りたたみ状態を返します。問題が発生した場合は null を返します。

int getCurrentUser()

現在実行中のユーザーの ID を返します。

String getDeviceClass()

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

long getDeviceDate()

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

DeviceDescriptor getDeviceDescriptor()

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

DeviceDescriptor getDeviceDescriptor(boolean shortDescriptor)

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

TestDeviceState getDeviceState()

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

long getDeviceTimeOffset(Date date)

デバイスと指定された ERROR(/Date) の間の時間差を取得するヘルパー。

InputStreamSource getEmulatorOutput()

エミュレータの stdout と stderr のストリームを取得します。

Process getEmulatorProcess()

このエミュレータに対応する Process を返します。

final File getExecuteShellCommandLog()

すべての executeShellCommand(String) ログを含むログ。

long getExternalStoreFreeSpace()

デバイスの外部ストレージの空き容量を判断するヘルパー メソッド。

String getFastbootPath()

使用されている fastboot バイナリのパスを返します。

String getFastbootProductType()

デバイスが fastboot モードのときに、そのデバイスのプロダクト タイプを取得する便利なメソッド。

String getFastbootProductVariant()

デバイスが fastboot モードのときに、そのデバイスのプロダクト タイプを取得する便利なメソッド。

String getFastbootSerialNumber()

Fastboot モードのシリアル番号を返します。

String getFastbootVariable(String variableName)

指定された fastboot 変数の値をデバイスから取得します。

String getFastbootVersion()

使用されている fastboot バイナリのバージョン文字列を返します。

IFileEntry getFileEntry(String path)

デバイス上のリモート ファイルへの参照を取得します。

IFileEntry getFileEntry(FileListingService.FileEntry entry)

非ルートパスから FileEntry を取得する非公式のヘルパー。

getFoldableStates()

デバイスの折りたたみ状態のリストを返します。

IDevice getIDevice()

関連付けられた ddmlib IDevice への参照を返します。

getInstalledPackageNames()

デバイスに存在するアプリのパッケージ名を取得します。

long getIntProperty(String name, long defaultValue)

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

String getIpAddress()

デバイスの IP アドレスを取得します。

KeyguardControllerState getKeyguardState()

キーガードの現在の状態を取得するオブジェクトを返します。サポートされていない場合は null を返します。

long getLastExpectedRebootTimeMillis()

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

int getLaunchApiLevel()

デバイスの初回リリース時の API レベルを取得します。

InputStreamSource getLogcat()

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

InputStreamSource getLogcat(int maxBytes)

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

InputStreamSource getLogcatDump()

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

InputStreamSource getLogcatSince(long date)

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

String getMacAddress()

デバイスの MAC アドレスを返します。デバイスからのクエリに失敗した場合は null を返します。

Integer getMainUserId()

メイン ユーザー ID を返します。

getMainlineModuleInfo()

デバイスにインストールされている Mainline モジュールに関する情報を取得します。

int getMaxNumberOfRunningUsersSupported()

同時に実行できるユーザーの最大数を取得します。

int getMaxNumberOfUsersSupported()

サポートされている最大ユーザー数を取得します。

Process getMicrodroidProcess()
IDeviceStateMonitor getMonitor()

デバイスに関連付けられた IDeviceStateMonitor を返します。

String getMountPoint(String mountName)

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

ITestDevice.MountPointInfo getMountPointInfo(String mountpoint)

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

getMountPointInfo()

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

TestDeviceOptions getOptions()

デバイスのテスト オプションを取得します。

long getPartitionFreeSpace(String partition)

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

Integer getPrimaryUserId()

プライマリ ユーザー ID を返します。

ProcessInfo getProcessByName(String processName)

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

String getProcessPid(String process)

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

String getProductType()

このデバイスのプロダクト タイプを取得するコンビニエンス メソッド。

String getProductVariant()

このデバイスのプロダクト バリエーションを取得するコンビニエンス メソッド。

String getProperty(String name)

デバイスから指定されたプロパティ値を取得します。

ITestDevice.RecoveryMode getRecoveryMode()

デバイスで使用されている現在の復元モードを取得します。

InputStreamSource getScreenshot(long displayId)

指定されたディスプレイ ID のデバイスからスクリーンショットを取得します。

InputStreamSource getScreenshot(String format)

デバイスからスクリーンショットを取得します。

InputStreamSource getScreenshot(String format, boolean rescale)

デバイスからスクリーンショットを取得します。

InputStreamSource getScreenshot()

デバイスからスクリーンショットを取得します。

String getSerialNumber()

このデバイスのシリアル番号を取得する便利なメソッド。

String getSetting(int userId, String namespace, String key)

リクエストされた設定の値を返します。

String getSetting(String namespace, String key)

getSetting(int, String, String) を参照し、システム ユーザーで実行されます。

String getSimOperator()

SIM カードの通信事業者を返します。利用できない場合、またはデバイスが利用できない場合は null を返します。

String getSimState()

SIM カードの状態を返します。利用できない場合やデバイスが利用できない場合は null を返します。

getTombstones()

デバイスから墓石のリストを取得して返します。

long getTotalMemory()

物理メモリの合計サイズをバイト単位で返します。内部エラーの場合は -1 を返します。

String getTrackingSerial()

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

getUninstallablePackageNames()

アンインストール可能なアプリのパッケージ名を取得します。

boolean getUseFastbootErase()

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

int getUserFlags(int userId)

指定されたユーザーのフラグを見つけて返します。

getUserInfos()

デバイス上の useId と UserInfo のマップを取得します。

int getUserSerialNumber(int userId)

見つかった場合は userId に関連付けられたシリアル番号を返し、それ以外の場合は -10000 を返します。

IManagedTestDevice.DeviceEventResponse handleAllocationEvent(DeviceEvent event)

指定された DeviceEvent を処理します。

DeviceEvent を処理します。このデバイスが新しい割り当て状態に移行するかどうかは、この処理によって決まります。

boolean hasFeature(String feature)

デバイスで機能が利用可能かどうかを確認します。

void initializeConnection(IBuildInfo info, MultiMap<String, String> attributes)

デバイスへの接続を初期化します。

String installPackage(File packageFile, boolean reinstall, String... extraArgs)

デバイスに Android パッケージをインストールします。

String installPackage(File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs)

デバイスに Android パッケージをインストールします。

String installPackageForUser(File packageFile, boolean reinstall, int userId, String... extraArgs)

指定されたユーザーのデバイスに Android パッケージをインストールします。

String installPackageForUser(File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)

指定されたユーザーのデバイスに Android パッケージをインストールします。

boolean installPackageWithIncrementalMode(File[] apkFiles, String[] extraArgs, String userId)

増分モードで apk をインストールします。

void invalidatePropertyCache()
boolean isAdbRoot()

boolean isAdbTcp()
boolean isAppEnumerationSupported()

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

boolean isBypassLowTargetSdkBlockSupported()

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

boolean isDebugfsMounted()

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

boolean isDeviceEncrypted()

デバイスが暗号化されているかどうかを返します。

boolean isDirectory(String path)

デバイス上のパスがディレクトリの場合は True を返し、それ以外の場合は False を返します。

boolean isEnableAdbRoot()
boolean isEncryptionSupported()

デバイスで暗号化がサポートされているかどうかを返します。

boolean isExecutable(String fullPath)

デバイス上のファイルパスが実行可能ファイルの場合は True を返し、それ以外の場合は False を返します。

boolean isFastbootEnabled()

デバイスで fastboot が利用可能な場合は true を返します。

boolean isHeadless()

デバイスがヘッドレス(画面がない)の場合は true、それ以外の場合は false を返します。

boolean isHeadlessSystemUserMode()

デバイスがヘッドレス システム ユーザー モードを使用しているかどうかを返します。

boolean isMainUserPermanentAdmin()

メインユーザーが永続的な管理者であり、削除したり管理者以外のステータスに降格したりできないかどうかを返します。

boolean isMultiUserSupported()

マルチユーザーがサポートされているかどうかを判断します。

boolean isPackageInstalled(String packageName, String userId)

特定のパッケージ名と特定のユーザー ID を指定してデバイスにクエリを行い、そのユーザーに対して現在インストールされているかどうかを確認します。

boolean isPackageInstalled(String packageName)

特定のパッケージ名についてデバイスにクエリを実行し、現在インストールされているかどうかを確認します。

boolean isRuntimePermissionSupported()

デバイスのプラットフォームが実行時の権限付与をサポートしているかどうかを確認する

boolean isStateBootloaderOrFastbootd()

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

boolean isUserRunning(int userId)

指定されたユーザーが実行中かどうかを確認します。

boolean isUserSecondary(int userId)

指定されたユーザーがフラグに従ってセカンダリ ユーザーであるかどうかを返します。

boolean isUserVisible(int userId)

指定されたユーザーが表示されるかどうかを確認します。

boolean isUserVisibleOnDisplay(int userId, int displayId)

指定されたユーザーが指定されたディスプレイに表示されているかどうかを確認します。

boolean isVisibleBackgroundUsersOnDefaultDisplaySupported()

デバイスで ERROR(/java.android.view.Display#DEFAULT_DISPLAY) のバックグラウンドでユーザーが開始したものを表示できるかどうかを返します。

boolean isVisibleBackgroundUsersSupported()

デバイスでユーザーがバックグラウンドで表示されることを許可するかどうかを返します。

boolean isWifiEnabled()

Wi-Fi が有効になっているかどうかをテストします。

listDisplayIds()

「dumpsys SurfaceFlinger」で報告されたデバイス上の利用可能なディスプレイの ID のリストを収集します。

listDisplayIdsForStartingVisibleBackgroundUsers()

start a user visible in the background に使用できるディスプレイのリストを取得します。

listUsers()

デバイスのユーザーのリストを取得します。

boolean logAnrs(ITestLogger logger)

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

boolean logBugreport(String dataName, ITestLogger listener)

バグレポートを取得して報告者に記録するヘルパー メソッド。

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

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

void mountDebugfs()

debugfs をマウントします。

void nonBlockingReboot()

デバイスを再起動するコマンドを発行し、コマンドが完了したとき、およびデバイスが adb に表示されなくなったときに返します。

void postAdbRootAction()

デバイスが adb root の後、オンラインに戻る前に、特定のアクションを実行する必要がある場合は、オーバーライドします。

void postAdbUnrootAction()

adb のルート解除後、デバイスがオンラインに戻る前に、デバイスで特定のアクションを実行する必要がある場合にオーバーライドします。

void postBootSetup()

ブートごとにテスト用にデバイスを設定する手順を実行します。

void postInvocationTearDown(Throwable exception)

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

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

呼び出しフローの前にデバイスで実行される、デバイス固有の必須セットアップの追加手順。

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

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

boolean pullDir(String deviceFilePath, File localDir)

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

boolean pullFile(String remoteFilePath, File localFile)

デバイスからファイルを取得します。

File pullFile(String remoteFilePath, int userId)

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

File pullFile(String remoteFilePath)

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

boolean pullFile(String remoteFilePath, File localFile, int userId)

デバイスからファイルを取得します。

String pullFileContents(String remoteFilePath)

デバイスからファイルを取得し、その内容を返します。

File pullFileFromExternal(String remoteFilePath)

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

boolean pushDir(File localFileDir, String deviceFilePath, excludedDirectories)

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

boolean pushDir(File localFileDir, String deviceFilePath)

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

boolean pushDir(File localFileDir, String deviceFilePath, int userId)

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

boolean pushFile(File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded)

pushFile(File, String) のバリエーション。コンテンツ プロバイダの必要性を評価するかどうかを任意で検討できます。

boolean pushFile(File localFile, String remoteFilePath)

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

boolean pushFile(File localFile, String remoteFilePath, int userId)

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

boolean pushString(String contents, String remoteFilePath)

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

void reboot(String reason)

指定された reason を使用して、デバイスを adb モードで再起動します。この reason は再起動後も保持されます。

void reboot()

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

void rebootIntoBootloader()

デバイスを再起動してブートローダー モードにします。

void rebootIntoFastbootd()

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

void rebootIntoRecovery()

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

void rebootIntoSideload()

デバイスを adb サイドロード モードで再起動します(これはリカバリの特別なモードです)。

デバイスがサイドロード モードに入るまでブロックします。

void rebootIntoSideload(boolean autoReboot)

デバイスを adb サイドロード モードで再起動します(これはリカバリの特別なモードです)。

デバイスがサイドロード モードに入るまでブロックします。

void rebootUntilOnline()

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

void rebootUntilOnline(String reason)

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

void rebootUserspace()

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

void rebootUserspaceUntilOnline()

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

boolean recoverDevice()

デバイスの通信の復元を試みます。

void registerDeviceActionReceiver(IDeviceActionReceiver deviceActionReceiver)

このデバイスの IDeviceActionReceiver を登録します。

void remountSystemReadOnly()

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

void remountSystemWritable()

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

void remountVendorReadOnly()

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

void remountVendorWritable()

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

boolean removeAdmin(String componentName, int userId)

指定されたユーザーの指定されたデバイス管理者を削除し、成功した場合は true を返し、それ以外の場合は false を返します。

void removeOwners()

既存のデバイス プロファイル オーナーをすべて削除します。

boolean removeUser(int userId)

デバイスから指定されたユーザーを削除します。

void resetContentProviderSetup()

コンテンツ プロバイダの設定のフラグをリセットして、再度トリガーします。

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

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

boolean runInstrumentationTests(IRemoteAndroidTestRunner runner, listeners)

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

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)) と同じですが、指定されたユーザーに対してテストを実行します。

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

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

void setAdbPath(String adbPath)

使用する adb バイナリへのパスを設定します。

void setConfiguration(IConfiguration configuration)

使用中の IConfiguration を挿入します。

final void setConnectionAvdInfo(GceAvdInfo avdInfo)
void setDate(Date date)

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

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

boolean setDeviceOwner(String componentName, int userId)

指定されたユーザーのデバイス オーナーとしてデバイス管理者コンポーネントを設定します。

void setDeviceState(TestDeviceState deviceState)

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

void setEmulatorOutputStream(SizeLimitedOutputStream output)

エミュレータの場合は、SizeLimitedOutputStream をログ出力に設定します。

void setEmulatorProcess(Process p)

このデバイスがエミュレータの場合、Process を設定します。

void setFastbootEnabled(boolean fastbootEnabled)

デバイスの fastboot オプションを設定します。

void setFastbootPath(String fastbootPath)

使用する fastboot バイナリのパスを設定します。

void setIDevice(IDevice newDevice)

この ITestDevice に関連付けられた IDevice を更新します。

void setLogStartDelay(int delay)

オンライン デバイスの logcat キャプチャを開始するまでの待機時間をミリ秒単位で設定します。

void setOptions(TestDeviceOptions options)

デバイスの TestDeviceOptions を設定します。

boolean setProperty(String propKey, String propValue)

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

void setRecovery(IDeviceRecovery recovery)

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

void setRecoveryMode(ITestDevice.RecoveryMode mode)

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

void setSetting(String namespace, String key, String value)

setSetting(int, String, String, String) を参照し、システム ユーザーで実行されます。

void setSetting(int userId, String namespace, String key, String value)

特定のユーザーの Namespace に設定値を追加します。

void setTestLogger(ITestLogger testLogger)

ITestLogger インスタンスを挿入します。

void setTrackingSerial(String trackingSerial)

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

void setUseFastbootErase(boolean useFastbootErase)

デバイスのパーティションを消去する際に fastboot erase を使用するか、fastboot format を使用するかを設定します。

void startLogcat()

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

boolean startTradeInModeTesting(int timeoutMs)

下取りモードのテストを有効にします。

boolean startUser(int userId)

指定されたユーザーが現在停止している場合、バックグラウンドで開始します。

boolean startUser(int userId, boolean waitFlag)

指定されたユーザーが現在停止している場合、バックグラウンドで開始します。

boolean startVisibleBackgroundUser(int userId, int displayId, boolean waitFlag)

指定されたユーザーをバックグラウンドで開始し、指定されたディスプレイに表示します(つまり、ユーザーがそのディスプレイでアクティビティを起動できるようにします)。

void stopEmulatorOutput()

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

void stopLogcat()

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

void stopTradeInModeTesting()

下取りモードのテストを停止します。

boolean stopUser(int userId)

指定されたユーザーを停止します。

boolean stopUser(int userId, boolean waitFlag, boolean forceFlag)

指定されたユーザーを停止します。

String switchToAdbTcp()

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

boolean switchToAdbUsb()

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

boolean switchUser(int userId)

デフォルトのタイムアウトで別の userId に切り替えます。

boolean switchUser(int userId, long timeout)

指定されたタイムアウトを期限として、別の userId に切り替えます。

boolean syncFiles(File localFileDir, String deviceFilePath)

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

Bugreport takeBugreport()

バグレポートを取得し、処理するために Bugreport オブジェクト内で返します。

String uninstallPackage(String packageName)

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

String uninstallPackageForUser(String packageName, int userId)

指定されたユーザーのデバイスから Android パッケージをアンインストールします。

boolean unlockDevice()

デバイスが暗号化された状態の場合、デバイスのロックを解除します。

void unmountDebugfs()

debugfs をアンマウントします。

boolean waitForBootComplete(long timeOut)

デバイスの起動完了フラグが設定されるまでブロックします。

boolean waitForDeviceAvailable()

デバイスが応答可能になり、テストに使用できるようになるまで待機します。

boolean waitForDeviceAvailable(long waitTime)

デバイスが応答可能になり、テストに使用できるようになるまで待機します。

boolean waitForDeviceAvailableInRecoverPath(long waitTime)

復元パスを考慮せずに、デバイスが応答可能になるまで待機します。

void waitForDeviceBootloader()

fastboot でデバイスが認識されるまでブロックします。

void waitForDeviceFastbootD()
boolean waitForDeviceInRecovery(long waitTime)

デバイスが「adb recovery」状態になるのをブロックします(これは IDeviceRecovery とは異なります)。

boolean waitForDeviceInSideload(long waitTime)

デバイスが「adb sideload」状態になるためのブロック

boolean waitForDeviceNotAvailable(long waitTime)

デバイスが利用できない(adb に表示されない)ようにブロックします。

void waitForDeviceOnline()

デバイスが adb 経由で認識されるまでブロックします。

void waitForDeviceOnline(long waitTime)

デバイスが adb 経由で認識されるまでブロックします。

boolean waitForDeviceShell(long waitTime)

デバイスが基本的な adb shell コマンドに応答するまで待機します。

保護されたメソッド

void addExtraConnectionBuilderArgs(DefaultConnection.ConnectionBuilder builder)
String[] buildAdbShellCommand(String command, boolean forceExitStatusDetection)

指定された adb シェル コマンド セッションと引数の OS コマンドをビルドします。

void checkApiLevelAgainst(String feature, int strictMinLevel)
NativeDevice.RebootDeviceAction createRebootDeviceAction(NativeDevice.RebootMode rebootMode, String reason)

再起動アクションの実行時に使用される RebootDeviceAction を作成します。

IRunUtil createRunUtil()
void doAdbReboot(NativeDevice.RebootMode rebootMode, String reason)

adb reboot を実行します。

void ensureRuntimePermissionSupported()

ランタイム権限がサポートされていない場合に例外をスローするヘルパー メソッド

int getApiLevelSafe()
ITestLogger getLogger()
IRunUtil getRunUtil()

使用する RunUtil インスタンスを取得します。

String internalGetProperty(String propName, String fastbootVar, String description)

デバイスが Fastboot モードかどうかによって、デフォルトで ddmlib キャッシュからデバイス プロパティを取得し、`adb shell getprop` または `fastboot getvar` にフォールバックします。

boolean isInRebootCallback()

再起動コールバックが現在実行中かどうかを返します。

boolean isNewer(File localFile, IFileEntry entry)

ローカル ファイルがリモート ファイルよりも新しい場合は true を返します。

void notifyRebootEnded()

すべての IDeviceActionReceiver に再起動終了イベントを通知します。

void notifyRebootStarted()

すべての IDeviceActionReceiver に再起動開始イベントを通知します。

boolean performDeviceAction(String actionDescription, NativeDevice.DeviceAction action, int retryAttempts)

このデバイスでアクションを実行します。

void postAdbReboot(NativeDevice.RebootMode rebootMode)

再起動後に実行できる追加のアクション。

void prePostBootSetup()

各デバイスタイプ(AndroidNativeDevice、TestDevice)が、特定のブート後のセットアップのためにこのメソッドをオーバーライドできるようにします。

boolean pullFileInternal(String remoteFilePath, File localFile)
void setClock(Clock clock)

使用する Clock インスタンスを設定します。

void setMicrodroidProcess(Process process)

TestDevice を microdroid としてマークし、その CID を設定します。

void setTestDeviceOptions( deviceOptions)
CommandResult simpleFastbootCommand(long timeout, envVarMap, String[] fullCmd)

環境変数を使用して簡単な fastboot コマンドを実行し、コマンドのステータスをレポートします。

CommandResult simpleFastbootCommand(long timeout, String[] fullCmd)

シンプルな fastboot コマンドを実行し、コマンドのステータスをレポートします。

boolean waitForDeviceNotAvailable(String operationDesc, long time)

デバイスが利用不可になる(adb へのレポートを停止する)まで待ちます。

定数

DEBUGFS_PATH

public static final String DEBUGFS_PATH

定数値: "/sys/kernel/debug"

INVALID_USER_ID

public static final int INVALID_USER_ID

無効なユーザー ID または見つからないユーザー ID に対して返される値: UserHandle で -10000 の値が定義されています

定数値: -10000 (0xffffd8f0)

MAX_HOST_DEVICE_TIME_OFFSET

protected static final long MAX_HOST_DEVICE_TIME_OFFSET

定数値: 5000 (0x0000000000001388)

MAX_RETRY_ATTEMPTS

protected static final int MAX_RETRY_ATTEMPTS

実行するコマンドの再試行回数のデフォルト値

定数値: 2 (0x00000002)

SD_CARD

protected static final String SD_CARD

定数値: "/sdcard/"

STORAGE_EMULATED

protected static final String STORAGE_EMULATED

定数値: "/storage/emulated/"

フィールド

mOptions

protected TestDeviceOptions mOptions

mStateMonitor

protected final IDeviceStateMonitor mStateMonitor

パブリック コンストラクタ

NativeDevice

public NativeDevice (IDevice device, 
                IDeviceStateMonitor stateMonitor, 
                IDeviceMonitor allocationMonitor)

TestDevice を作成します。

パラメータ
device IDevice: 関連付けられた IDevice

stateMonitor IDeviceStateMonitor: 使用する IDeviceStateMonitor メカニズム

allocationMonitor IDeviceMonitor: 割り当て状態の変更を通知する IDeviceMonitor。null の場合もあります

パブリック メソッド

batchPrefetchStartupBuildProps

public void batchPrefetchStartupBuildProps ()

必要なすべてのプロパティをプリフェッチすることで、各プロパティに対して「adb getprop」を呼び出すよりも、マイクロ最適化(約 400 ミリ秒)を実現します。つまり、1 つのプロパティをフェッチするのと同じくらい速く、すべてのプロパティをフェッチできます。device.getApiLevel()、checkApiLevelAgainstNextRelease、getBuildAlias などは、すべて内部で `adb getprop` を呼び出します。1 回の呼び出しで取得し、NativeDevice.setProperty を呼び出します。この処理を行わなくても、NativeDevice が setProperty を呼び出し、今後の呼び出しのために結果をキャッシュに保存します。少し早めに実施しているだけです。デバイスが復元中の場合や、プロパティの取得で他のエラーが発生した場合は、無視します。

canSwitchToHeadlessSystemUser

public boolean canSwitchToHeadlessSystemUser ()

ヘッドレスの SYSTEM ユーザーに切り替えることが許可されているかどうかを返します。

戻り値
boolean

例外
DeviceNotAvailableException

checkApiLevelAgainstNextRelease

public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

最小限サポートされているレベルで、機能が現在サポートされているかどうかを確認します。このメソッドは、API レベルが引き上げられる前に、まだリリースされていない機能も考慮します。

パラメータ
strictMinLevel int: 機能をサポートする厳密な最小レベル。

戻り値
boolean レベルがサポートされている場合は true。それ以外は False が返されます。

例外
DeviceNotAvailableException

checkConnectivity

public boolean checkConnectivity ()

デバイスがネットワークに接続されていることを確認します。

戻り値
boolean デバイスがネットワークに接続している場合は true、そうでない場合は false

例外
DeviceNotAvailableException

clearErrorDialogs

public boolean clearErrorDialogs ()

デバイス UI に現在表示されているエラー ダイアログを閉じようとします。

戻り値
boolean ダイアログが存在しない場合、またはダイアログが正常にクリアされた場合は true。それ以外の場合は false

例外
DeviceNotAvailableException

clearLastConnectedWifiNetwork

public void clearLastConnectedWifiNetwork ()

最後に接続した Wi-Fi ネットワークをクリアします。これは、新しい呼び出しを開始するときに呼び出す必要があります。これにより、デバイスの再起動後に前のテストで使用された Wi-Fi ネットワークに接続することを回避できます。

clearLogcat

public void clearLogcat ()

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

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

connectToWifiNetwork

public boolean connectToWifiNetwork ( wifiSsidToPsk, 
                boolean scanSsid)

Wi-Fi ネットワークに接続します。

Wi-Fi をオンにし、wifiSsidToPsk マップで指定された Wi-Fi ネットワークのいずれかに接続されるまでブロックします。接続が確立されると、インスタンスは ITestDevice.disconnectFromWifi() または ITestDevice.clearLastConnectedWifiNetwork() が呼び出されるまで、再起動のたびに接続の復元を試みます。

パラメータ
wifiSsidToPsk : Wi-Fi SSID とパスワードのマップ。

scanSsid boolean: このネットワークの非表示 SSID をスキャンするかどうか。

戻り値
boolean Wi-Fi ネットワークに正常に接続された場合は truefalse それ以外の場合

例外
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk)

Wi-Fi ネットワークに接続します。

Wi-Fi をオンにし、指定された Wi-Fi ネットワークに接続されるまでブロックします。接続が確立されると、インスタンスは ITestDevice.disconnectFromWifi() または ITestDevice.clearLastConnectedWifiNetwork() が呼び出されるまで、再起動のたびに接続の復元を試みます。

パラメータ
wifiSsid String: 接続する Wi-Fi SSID

wifiPsk String: PSK パスフレーズ。暗号化されていない場合は null

戻り値
boolean Wi-Fi ネットワークに正常に接続された場合は truefalse それ以外の場合

例外
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork ( wifiSsidToPsk)

Wi-Fi ネットワークに接続します。

Wi-Fi をオンにし、wifiSsidToPsk マップで指定された Wi-Fi ネットワークのいずれかに接続されるまでブロックします。接続が確立されると、インスタンスは ITestDevice.disconnectFromWifi() または ITestDevice.clearLastConnectedWifiNetwork() が呼び出されるまで、再起動のたびに接続の復元を試みます。

パラメータ
wifiSsidToPsk : Wi-Fi SSID とパスワードのマップ。

戻り値
boolean Wi-Fi ネットワークに正常に接続された場合は truefalse それ以外の場合

例外
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk, 
                boolean scanSsid)

Wi-Fi ネットワークに接続します。

Wi-Fi をオンにし、指定された Wi-Fi ネットワークに接続されるまでブロックします。接続が確立されると、インスタンスは ITestDevice.disconnectFromWifi() または ITestDevice.clearLastConnectedWifiNetwork() が呼び出されるまで、再起動のたびに接続の復元を試みます。

パラメータ
wifiSsid String: 接続する Wi-Fi SSID

wifiPsk String: PSK パスフレーズ。暗号化されていない場合は null

scanSsid boolean: このネットワークの非表示 SSID をスキャンするかどうか。

戻り値
boolean Wi-Fi ネットワークに正常に接続された場合は truefalse それ以外の場合

例外
DeviceNotAvailableException

connectToWifiNetworkIfNeeded

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk, 
                boolean scanSsid)

デバイスが現在ネットワークに接続されていない場合にのみ接続する connectToWifiNetwork(String, String) のバリエーション。

パラメータ
scanSsid boolean: このネットワークの非表示 SSID をスキャンするかどうか

戻り値
boolean Wi-Fi ネットワークに正常に接続された場合は truefalse それ以外の場合

例外
DeviceNotAvailableException

connectToWifiNetworkIfNeeded

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk)

デバイスが現在ネットワークに接続されていない場合にのみ接続する connectToWifiNetwork(String, String) のバリエーション。

戻り値
boolean Wi-Fi ネットワークに正常に接続された場合は truefalse それ以外の場合

例外
DeviceNotAvailableException

createUser

public int createUser (String name, 
                boolean guest, 
                boolean ephemeral)

指定された名前とフラグを使用してユーザーを作成する

パラメータ
name String: デバイスで作成するユーザーの

guest boolean: 作成時にユーザー フラグ --guest を有効にする

ephemeral boolean: 作成時にユーザー フラグ --ephemeral を有効にする

戻り値
int 作成されたユーザーの ID

例外
DeviceNotAvailableException

createUser

public int createUser (String name, 
                boolean guest, 
                boolean ephemeral, 
                boolean forTesting)

指定された名前とフラグを使用してユーザーを作成する

パラメータ
name String: デバイスで作成するユーザーの

guest boolean: 作成時にユーザー フラグ --guest を有効にする

ephemeral boolean: 作成時にユーザー フラグ --ephemeral を有効にする

forTesting boolean: 作成時にテストフラグ --for-testing を有効にする

戻り値
int 作成されたユーザーの ID

例外
DeviceNotAvailableException

createUser

public int createUser (String name)

指定された名前とデフォルトのフラグ 0 を持つユーザーを作成します。

パラメータ
name String: デバイスで作成するユーザーの

戻り値
int 作成されたユーザー ID の整数

例外
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

指定された名前とデフォルトのフラグ 0 を持つユーザーを作成します。

パラメータ
name String: デバイスで作成するユーザーの

戻り値
int 作成されたユーザー ID の整数、またはエラーの場合は -1。

例外
DeviceNotAvailableException

debugDeviceNotAvailable

public DeviceInspectionResult debugDeviceNotAvailable ()

デバイスを検査し、デバイスが使用不可になったときに詳細情報を返します。

戻り値
DeviceInspectionResult

deleteFile

public void deleteFile (String deviceFilePath, 
                int userId)

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

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

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

例外
DeviceNotAvailableException

deleteFile

public void deleteFile (String deviceFilePath)

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

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

例外
DeviceNotAvailableException

deregisterDeviceActionReceiver

public void deregisterDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)

登録済みの IDeviceActionReceiver を削除します。

パラメータ
deviceActionReceiver IDeviceActionReceiver: 削除される IDeviceActionReceiver

deviceSoftRestarted

public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)

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

パラメータ
prevSystemServerProcess ProcessInfo: 以前の system_server プロセス ProcessInfo

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

例外
DeviceNotAvailableException

deviceSoftRestartedSince

public boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

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

パラメータ
utcEpochTime long: エポックからの経過秒数で表したデバイス時間。

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

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

例外
DeviceNotAvailableException

disableAdbRoot

public boolean disableAdbRoot ()

adb root をオフにします。

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

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

例外
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

キーガードを無効にしようとします。

まず、入力ディスパッチの準備が整うまで待機します。これは、デバイスが BOOT_COMPLETE をレポートするのとほぼ同時に非同期で行われます。現在のフレームワーク実装では、競合状態がまれに発生するためです。キーガードを閉じるコマンドが送信されます(セキュリティ保護されていないキーガードでのみ機能します)。

例外
DeviceNotAvailableException

disableNetworkMonitor

public boolean disableNetworkMonitor ()

デバイスのネットワーク モニタリングを無効にします。

戻り値
boolean モニタリングが無効になった場合は true。失敗した場合は false

例外
DeviceNotAvailableException

disconnectFromWifi

public boolean disconnectFromWifi ()

Wi-Fi ネットワークから切断します。

既知のネットワーク リストからすべてのネットワークを削除し、Wi-Fi を無効にします。

戻り値
boolean Wi-Fi ネットワークから正常に切断された場合は true。切断に失敗した場合は false

例外
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath, 
                int userId)

特定のユーザーのデバイス上のファイルが存在するかどうかを判断するヘルパー メソッド。

パラメータ
deviceFilePath String: チェックするデバイス上のファイルの絶対パス

userId int: ファイルの存在を確認するユーザー ID

戻り値
boolean ファイルが存在する場合は true、それ以外の場合は false

例外
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

デバイス上のファイルが存在するかどうかを判断するヘルパー メソッド。

パラメータ
deviceFilePath String: チェックするデバイス上のファイルの絶対パス

戻り値
boolean ファイルが存在する場合は true、それ以外の場合は false

例外
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

system_server からヒープをダンプしようとします。ダンプされたファイルのクリーンアップは呼び出し元の責任で行います。

パラメータ
process String: dumpheap を実行するデバイス プロセスの名前。

devicePath String: ダンプを配置するデバイス上のパス。これは、権限で許可されている場所である必要があります。

戻り値
File レポートを含む ERROR(/File)。失敗した場合は null。

例外
DeviceNotAvailableException

enableAdbRoot

public boolean enableAdbRoot ()

adb root をオンにします。「enable-root」設定が「false」の場合、メッセージをログに記録し、root を有効にせずに戻ります。

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

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

例外
DeviceNotAvailableException

enableNetworkMonitor

public boolean enableNetworkMonitor ()

デバイスでネットワーク モニタリングを有効にします。

戻り値
boolean モニタリングが正常に有効になった場合は true。失敗した場合は false

例外
DeviceNotAvailableException

executeAdbCommand

public String executeAdbCommand (long timeout, 
                String... cmdArgs)

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

可能な限り executeShellCommand(String) を使用してください。このメソッドは、障害検出とパフォーマンスが優れています。

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

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

戻り値
String コマンドの stdout。コマンドの実行に失敗した場合は null

例外
DeviceNotAvailableException

executeAdbCommand

public String executeAdbCommand (long timeout, 
                 envMap, 
                String... cmdArgs)

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

可能な限り executeShellCommand(String) を使用してください。このメソッドは、障害検出とパフォーマンスが優れています。

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

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

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

戻り値
String コマンドの stdout。コマンドの実行に失敗した場合は null

例外
DeviceNotAvailableException

executeAdbCommand

public String executeAdbCommand (String... cmdArgs)

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

可能な限り executeShellCommand(String) を使用してください。このメソッドは、障害検出とパフォーマンスが優れています。

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

戻り値
String コマンドの stdout。コマンドの実行に失敗した場合は null

例外
DeviceNotAvailableException

executeAdbV2Command

public CommandResult executeAdbV2Command (String... cmdArgs)

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

可能な限り executeShellCommand(String) を使用してください。このメソッドは、障害検出とパフォーマンスが優れています。

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

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

例外
DeviceNotAvailableException

executeAdbV2Command

public CommandResult executeAdbV2Command (long timeout, 
                String... cmdArgs)

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

可能な限り executeShellCommand(String) を使用してください。このメソッドは、障害検出とパフォーマンスが優れています。

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

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

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

例外
DeviceNotAvailableException

executeAdbV2Command

public CommandResult executeAdbV2Command (long timeout, 
                 envMap, 
                String... cmdArgs)

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

可能な限り executeShellCommand(String) を使用してください。このメソッドは、障害検出とパフォーマンスが優れています。

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

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

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

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

例外
DeviceNotAvailableException

executeFastbootCommand

public CommandResult executeFastbootCommand (String... cmdArgs)

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

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

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

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

例外
DeviceNotAvailableException

executeFastbootCommand

public CommandResult executeFastbootCommand (long timeout, 
                String... cmdArgs)

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

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

パラメータ
timeout long: コマンドの有効期限が切れるまでの時間(ミリ秒単位)

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

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

例外
DeviceNotAvailableException

executeLongFastbootCommand

public CommandResult executeLongFastbootCommand (String... cmdArgs)

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

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

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

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

例外
DeviceNotAvailableException

executeLongFastbootCommand

public CommandResult executeLongFastbootCommand ( envVarMap, 
                String... cmdArgs)

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

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

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

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

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

例外
DeviceNotAvailableException

executeShellCommand

public String executeShellCommand (String command)

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

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

戻り値
String シェル出力

例外
DeviceNotAvailableException

executeShellCommand

public 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 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 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 CommandResult executeShellV2Command (String cmd)

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

パラメータ
cmd String: 実行するコマンド。

戻り値
CommandResult 結果は CommandResult になります。

例外
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                OutputStream pipeToOutput)

adb シェルコマンドを実行し、コマンド ステータス出力と stderr が適切に設定された CommandResult として結果を返すヘルパー メソッド。stdout は指定されたストリームに転送されます。

パラメータ
cmd String: 実行するコマンド。

pipeToOutput OutputStream: 標準出力がリダイレクトされる ERROR(/OutputStream)。null の場合もあります。

戻り値
CommandResult 結果は CommandResult になります。

例外
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput)

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

パラメータ
cmd String: 実行するコマンド。

pipeAsInput File: コマンドへの入力としてパイプ処理される ERROR(/File)。または null。

戻り値
CommandResult 結果は CommandResult になります。

例外
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

adb シェルコマンドを実行します。コマンドの動作を制御するパラメータが追加されています。

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

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

timeUnit TimeUnit: maxTimeToOutputShellResponse の単位

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

戻り値
CommandResult

例外
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit)

adb シェルコマンドを実行します。コマンドの動作を制御するパラメータが追加されています。

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

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

timeUnit TimeUnit: maxTimeToOutputShellResponse の単位

戻り値
CommandResult

例外
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

adb シェルコマンドを実行します。コマンドの動作を制御するパラメータが追加されています。

パラメータ
cmd 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 CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                OutputStream pipeToError, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

adb シェルコマンドを実行します。コマンドの動作を制御するパラメータが追加されています。

パラメータ
cmd 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 CommandResult fastbootWipePartition (String partition)

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

getUseFastbootErase()true の場合、fastboot erase を使用してパーティションをワイプします。デバイスは、次回起動時にファイル システムを作成する必要があります。それ以外の場合は、fastboot format が使用され、デバイスに新しいファイル システムが作成されます。

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

パラメータ
partition String: ワイプするパーティション

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

例外
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

デバイスで有効化された APEX に関する情報を取得します。

戻り値
デバイスで現在有効になっている ApexInfoERROR(/Set)

例外
DeviceNotAvailableException

getAdbPath

public String getAdbPath ()

使用されている adb バイナリのパスを返します。

戻り値
String

getAllSettings

public  getAllSettings (String namespace)

リクエストされた Namespace の Key-Value ペアを返します。

パラメータ
namespace String: {"system", "secure", "global"} のいずれかである必要があります。

戻り値
Key-Value ペアのマップ。名前空間がサポートされていない場合は null。

例外
DeviceNotAvailableException

getAllocationState

public DeviceAllocationState getAllocationState ()

デバイスの現在の割り当て状態を返す

戻り値
DeviceAllocationState

getAndroidId

public String getAndroidId (int userId)

userId に関連付けられた android-id を検索して返します。見つからない場合は null を返します。

パラメータ
userId int

戻り値
String

例外
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

一致するユーザー ID が見つかった Android ID のマップを作成します。この関数で関連付けられた Android ID が見つかる保証はないため、一部のユーザー ID は null と一致する可能性があります。

戻り値
一致するユーザー ID が見つかった Android ID のマップ。

例外
DeviceNotAvailableException

getApiLevel

public int getApiLevel ()

デバイスの API レベルを取得します。デフォルトは UNKNOWN_API_LEVEL です。

戻り値
int デバイスの API レベルを示す整数

例外
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

デバイスにインストールされているパッケージに関する情報を取得します。

パラメータ
packageName String

戻り値
PackageInfo 情報を取得できなかった場合は PackageInfo または null

例外
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

デバイスにインストールされているパッケージの情報を取得します。

戻り値
デバイスにインストールされている PackageInfoERROR(/List)

例外
DeviceNotAvailableException

getBasebandVersion

public String getBasebandVersion ()

このデバイスのベースバンド(ラジオ)バージョンを取得する便利なメソッド。ラジオ バージョンの取得はデバイス固有であるため、すべてのデバイスで正しい情報が返されるとは限りません。このメソッドは、gsm.version.baseband プロパティに依存して正しいバージョン情報を返します。一部の CDMA デバイスでは正確ではなく、ここで返されるバージョンは fastboot から報告されるバージョンと一致しない場合があり、CDMA 無線のバージョンを返さない場合があります。要するに、このメソッドは gsm.version.baseband プロパティが fastboot getvar version-baseband が返すバージョンと同じ場合にのみ正確なバージョンをレポートします。

戻り値
String String ベースバンド バージョン。特定できない場合は null(デバイスにラジオがない、またはバージョン文字列を読み取れない)

例外
DeviceNotAvailableException

getBattery

public Integer getBattery ()

デバイスの現在のバッテリー残量を返します。バッテリー残量が取得できない場合は Null を返します。

戻り値
Integer

getBooleanProperty

public boolean getBooleanProperty (String name, 
                boolean defaultValue)

指定されたプロパティのブール値を返します。

パラメータ
name String: プロパティ名

defaultValue boolean: プロパティが空の場合、または存在しない場合に返されるデフォルト値。

戻り値
boolean プロパティの値が "1""y""yes""on""true" の場合は true、プロパティの値が "0""n""no""off""false"defaultValue の場合は false、それ以外の場合は true

例外
DeviceNotAvailableException

getBootHistory

public  getBootHistory ()

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

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

例外
DeviceNotAvailableException

getBootHistorySince

public  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

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

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

timeUnit TimeUnit: 時間単位 TimeUnit

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

例外
DeviceNotAvailableException

getBootloaderVersion

public String getBootloaderVersion ()

このデバイスのブートローダー バージョンを取得する便利なメソッド。

デバイスの現在の状態からブートローダーのバージョンを取得しようとします。(デバイスが Fastboot モードの場合、Fastboot からバージョンを取得しようとします)。

戻り値
String String ブートローダー バージョン、または見つからない場合は null

例外
DeviceNotAvailableException

getBugreport

public InputStreamSource getBugreport ()

デバイスからバグレポートを取得します。

この実装は、sdcard のないデバイス(または sdcard がまだマウントされていないデバイス)でも動作し続けることが保証されています。

戻り値
InputStreamSource オンデマンドでバグレポートの内容を生成する InputStreamSource。失敗した場合、InputStreamSource は空の ERROR(/InputStream) を生成します。

getBugreportz

public InputStreamSource getBugreportz ()

デバイスから bugreportz を取得します。ZIP 形式のバグレポートには、メインのバグレポートと、デバッグに役立つその他のログファイルが含まれています。

「adb version」> 1.0.36 でのみサポートされます

戻り値
InputStreamSource バグレポートを含む ZIP ファイルの InputStreamSource。失敗した場合は null を返します。

getBuildAlias

public String getBuildAlias ()

デバイスで現在実行中のビルドのエイリアスを取得します。

通常、ビルド エイリアスはビルド ID よりも読みやすい文字列です(通常、Nexus ビルドの番号)。たとえば、Android 4.2 の最終リリースにはビルド エイリアス JDQ39 とビルド ID 573038 があります。

戻り値
String ビルド エイリアス。取得できなかった場合はビルド ID にフォールバックします。

例外
DeviceNotAvailableException

getBuildFlavor

public String getBuildFlavor ()

デバイスのビルド フレーバーを取得します。

戻り値
String ビルド フレーバー。取得できなかった場合は null

例外
DeviceNotAvailableException

getBuildId

public String getBuildId ()

デバイスで現在実行中のビルドを取得します。

戻り値
String ビルド ID。取得できなかった場合は IBuildInfo.UNKNOWN_BUILD_ID

例外
DeviceNotAvailableException

getBuildSigningKeys

public String getBuildSigningKeys ()

デバイス イメージの署名に使用された鍵の種類を返します

通常、Android デバイスはテストキー(AOSP の場合など)またはリリースキー(個々のデバイス メーカーが管理)で署名されます。

戻り値
String 署名鍵(見つかった場合)。見つからなかった場合は null。

例外
DeviceNotAvailableException

getCachedDeviceDescriptor

public DeviceDescriptor getCachedDeviceDescriptor ()

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

戻り値
DeviceDescriptor

getCachedDeviceDescriptor

public DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

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

パラメータ
shortDescriptor boolean: 記述子を最小限の情報に制限するかどうか

戻り値
DeviceDescriptor

getChildren

public String[] getChildren (String path)

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

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

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

例外
DeviceNotAvailableException

getConnection

public AbstractConnection getConnection ()

デバイスに関連付けられている現在の接続。

戻り値
AbstractConnection

getContentProvider

public ContentProviderHandler getContentProvider (int userId)

ContentProviderHandler を返します。利用できない場合は null を返します。

同じ userId で以前に構築されたコンテンツ プロバイダは再利用できます。

パラメータ
userId int: コンテンツ プロバイダの初期化に使用するユーザー ID。

戻り値
ContentProviderHandler

例外
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

デバイスの現在の折りたたみ状態を返します。問題が発生した場合は null を返します。

戻り値
DeviceFoldableState

例外
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

現在実行中のユーザーの ID を返します。エラーの場合は、-10000 を返します。

戻り値
int

例外
DeviceNotAvailableException

getDeviceClass

public String getDeviceClass ()

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

戻り値
String String デバイス クラス。

getDeviceDate

public long getDeviceDate ()

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

戻り値
long デバイスの日付(エポック形式)。

例外
DeviceNotAvailableException

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor ()

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

戻り値
DeviceDescriptor

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

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

パラメータ
shortDescriptor boolean: 記述子を最小限の情報に制限するかどうか

戻り値
DeviceDescriptor

getDeviceState

public TestDeviceState getDeviceState ()

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

戻り値
TestDeviceState

getDeviceTimeOffset

public long getDeviceTimeOffset (Date date)

デバイスと指定された ERROR(/Date) の間の時間差を取得するヘルパー。内部でエポック時間を使用します。

パラメータ
date Date

戻り値
long ミリ秒単位の差

例外
DeviceNotAvailableException

getEmulatorOutput

public InputStreamSource getEmulatorOutput ()

エミュレータの stdout と stderr のストリームを取得する

戻り値
InputStreamSource エミュレータの出力

getEmulatorProcess

public Process getEmulatorProcess ()

このエミュレータに対応する Process を返します。

戻り値
Process Process または null

getExecuteShellCommandLog

public final File getExecuteShellCommandLog ()

すべての executeShellCommand(String) ログを含むログ。

戻り値
File

getExternalStoreFreeSpace

public long getExternalStoreFreeSpace ()

デバイスの外部ストレージの空き容量を判断するヘルパー メソッド。

戻り値
long 空き容量(KB)

例外
DeviceNotAvailableException

getFastbootPath

public String getFastbootPath ()

使用されている fastboot バイナリのパスを返します。fastboot 関数を有効にするには、isFastbootEnabled() が true である必要があります。

戻り値
String

getFastbootProductType

public String getFastbootProductType ()

デバイスが fastboot モードのときに、そのデバイスのプロダクト タイプを取得する便利なメソッド。

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

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

例外
DeviceNotAvailableException

getFastbootProductVariant

public String getFastbootProductVariant ()

デバイスが fastboot モードのときに、そのデバイスのプロダクト タイプを取得する便利なメソッド。

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

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

例外
DeviceNotAvailableException

getFastbootSerialNumber

public String getFastbootSerialNumber ()

fastboot モードのシリアル番号を返します。

戻り値
String

getFastbootVariable

public String getFastbootVariable (String variableName)

指定された fastboot 変数の値をデバイスから取得します。

パラメータ
variableName String: 変数名

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

例外
DeviceNotAvailableException

getFastbootVersion

public String getFastbootVersion ()

使用されている fastboot バイナリのバージョン文字列を返します。エラーが発生した場合は null。

戻り値
String

getFileEntry

public IFileEntry getFileEntry (String path)

デバイス上のリモート ファイルへの参照を取得します。

パラメータ
path String: 取得するファイルパス。絶対パスまたは「/」からの相対パスを指定できます(「/system」と「system」の両方の構文がサポートされています)。

戻り値
IFileEntry 指定された path のファイルが見つからない場合は IFileEntry または null

例外
DeviceNotAvailableException

getFileEntry

public IFileEntry getFileEntry (FileListingService.FileEntry entry)

非ルートパスから FileEntry を取得する非公式のヘルパー。FIXME: 任意のパスから利用できるように、FileEntry システムをリファクタリングします。(root 権限がない場合でも)。

パラメータ
entry FileListingService.FileEntry: Ddmlib が必要とする root 権限を必ずしも持たない FileEntry

戻り値
IFileEntry FileEntry を表す FileEntryWrapper。

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

getFoldableStates

public  getFoldableStates ()

デバイスの折りたたみ状態のリストを返します。「cmd device_state print-states」で取得できます。

戻り値

例外
DeviceNotAvailableException

getIDevice

public IDevice getIDevice ()

関連付けられた ddmlib IDevice への参照を返します。

デバイスが adb から切断されて再接続されるたびに、DDMS によって新しい IDevice が割り当てられることがあります。そのため、呼び出し元は IDevice への参照を保持すべきではありません。参照が古くなる可能性があるためです。

戻り値
IDevice IDevice

getInstalledPackageNames

public  getInstalledPackageNames ()

デバイスに存在するアプリのパッケージ名を取得します。

戻り値
デバイスに現在インストールされている String パッケージ名の ERROR(/Set)

例外
DeviceNotAvailableException

getIntProperty

public long getIntProperty (String name, 
                long defaultValue)

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

パラメータ
name String: プロパティ名

defaultValue long: プロパティが空の場合、または存在しない場合に返されるデフォルト値。

戻り値
long プロパティの値。プロパティが空、存在しない、または整数値を持たない場合は defaultValue

例外
DeviceNotAvailableException

getIpAddress

public String getIpAddress ()

デバイスの IP アドレスを取得します。

戻り値
String デバイスの IP アドレス。デバイスに IP アドレスがない場合は null

例外
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

キーガードの現在の状態を取得するオブジェクトを返します。サポートされていない場合は null を返します。

戻り値
KeyguardControllerState キーガードの状態のスナップショットを含む KeyguardControllerState。Keyguard クエリがサポートされていない場合は Null を返します。

例外
DeviceNotAvailableException

getLastExpectedRebootTimeMillis

public long getLastExpectedRebootTimeMillis ()

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

戻り値
long

getLaunchApiLevel

public int getLaunchApiLevel ()

デバイスの初回リリース時の API レベルを取得します。デフォルトは UNKNOWN_API_LEVEL です。

戻り値
int デバイスの最初のリリース時の API レベルを示す整数

例外
DeviceNotAvailableException

getLogcat

public InputStreamSource getLogcat ()

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

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

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

    戻り値
    InputStreamSource

  • getLogcat

    public InputStreamSource getLogcat (int maxBytes)

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

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

    パラメータ
    maxBytes int: 返されるデータの最大量。メモリに収まる程度の量にする必要があります

    戻り値
    InputStreamSource

    getLogcatDump

    public InputStreamSource getLogcatDump ()

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

    デバイスにアクセスできない場合は何も返されないというデメリットがあります。

    戻り値
    InputStreamSource ログキャットデータの InputStreamSource です。logcat データのキャプチャに失敗した場合は、空のストリームが返されます。

    getLogcatSince

    public InputStreamSource getLogcatSince (long date)

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

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

    戻り値
    InputStreamSource

    getMacAddress

    public String getMacAddress ()

    デバイスの MAC アドレスを返します。デバイスからのクエリに失敗した場合は null を返します。

    戻り値
    String

    getMainUserId

    public Integer getMainUserId ()

    メイン ユーザー ID を返します。

    戻り値
    Integer メインユーザーがいる場合はその userId、いない場合は null。

    例外
    DeviceNotAvailableException

    getMainlineModuleInfo

    public  getMainlineModuleInfo ()

    デバイスにインストールされている Mainline モジュールに関する情報を取得します。

    戻り値
    デバイスに現在インストールされている String mainline モジュールの ERROR(/Set)

    例外
    DeviceNotAvailableException

    getMaxNumberOfRunningUsersSupported

    public int getMaxNumberOfRunningUsersSupported ()

    同時に実行できるユーザーの最大数を取得します。デフォルトは 0 です。

    戻り値
    int 同時に実行されているユーザー数を示す整数

    例外
    DeviceNotAvailableException

    getMaxNumberOfUsersSupported

    public int getMaxNumberOfUsersSupported ()

    サポートされているユーザーの最大数を取得します。デフォルトは 0 です。

    戻り値
    int サポートされているユーザー数を示す整数

    例外
    DeviceNotAvailableException

    getMicrodroidProcess

    public Process getMicrodroidProcess ()

    戻り値
    Process Microdroid VM のプロセスを返します。TestDevice が Microdroid でない場合は、null を返します。

    getMonitor

    public IDeviceStateMonitor getMonitor ()

    デバイスに関連付けられた IDeviceStateMonitor を返します。

    戻り値
    IDeviceStateMonitor

    getMountPoint

    public String getMountPoint (String mountName)

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

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

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

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

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

    getMountPointInfo

    public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

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

    パラメータ
    mountpoint String

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

    例外
    DeviceNotAvailableException

    getMountPointInfo

    public  getMountPointInfo ()

    デバイスの /proc/mounts の情報の解析済みバージョンを返します

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

    例外
    DeviceNotAvailableException

    getOptions

    public TestDeviceOptions getOptions ()

    デバイスのテスト オプションを取得します。

    戻り値
    TestDeviceOptions テスト対象デバイスに関連する TestDeviceOptions

    getPartitionFreeSpace

    public long getPartitionFreeSpace (String partition)

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

    パラメータ
    partition String

    戻り値
    long 空き容量(KB)

    例外
    DeviceNotAvailableException

    getPrimaryUserId

    public Integer getPrimaryUserId ()

    プライマリ ユーザー ID を返します。

    戻り値
    Integer メインユーザーが存在する場合はその userId、メインユーザーが存在しない場合は null。

    例外
    DeviceNotAvailableException

    getProcessByName

    public ProcessInfo getProcessByName (String processName)

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

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

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

    例外
    DeviceNotAvailableException

    getProcessPid

    public String getProcessPid (String process)

    サービスが正常に動作した場合はサービスの pid を返し、それ以外の場合は null を返します。

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

    戻り値
    String

    例外
    DeviceNotAvailableException

    getProductType

    public String getProductType ()

    このデバイスのプロダクト タイプを取得するコンビニエンス メソッド。

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

    戻り値
    String String 商品タイプの名前。null にはなりません

    例外
    DeviceNotAvailableException

    getProductVariant

    public String getProductVariant ()

    このデバイスのプロダクト バリエーションを取得する便利なメソッド。

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

    戻り値
    String String(商品のバリエーション名)または null(判別できない場合)

    例外
    DeviceNotAvailableException

    getProperty

    public String getProperty (String name)

    デバイスから指定されたプロパティ値を取得します。

    パラメータ
    name String: プロパティ名

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

    例外
    DeviceNotAvailableException

    getRecoveryMode

    public ITestDevice.RecoveryMode getRecoveryMode ()

    デバイスで使用されている現在の復元モードを取得します。

    戻り値
    ITestDevice.RecoveryMode デバイスで使用されている現在の復元モード。

    getScreenshot

    public InputStreamSource getScreenshot (long displayId)

    指定されたディスプレイ ID のデバイスからスクリーンショットを取得します。形式は PNG です。

    TODO: 上記の実装を拡張して「format」と「rescale」をサポートする

    パラメータ
    displayId long: スクリーンショットを取得する画面のディスプレイ ID。

    戻り値
    InputStreamSource スクリーンショットが成功しなかった場合は、スクリーンショットの InputStreamSource を形式で、または null を返します。

    例外
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot (String format)

    デバイスからスクリーンショットを取得します。サイズを小さくするために、代わりに JPEG エンコードで getScreenshot(format) を使用することをおすすめします

    パラメータ
    format String: PNG、JPEG をサポート

    戻り値
    InputStreamSource スクリーンショットが成功した場合は、そのスクリーンショットの InputStreamSource を形式で、成功しなかった場合は null を返します。

    例外
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot (String format, 
                    boolean rescale)

    デバイスからスクリーンショットを取得します。サイズを小さくするために、代わりに JPEG エンコードで getScreenshot(String) を使用することをおすすめします。

    パラメータ
    format String: PNG、JPEG をサポート

    rescale boolean: スクリーンショットを再スケーリングして、結果の画像のサイズを縮小するかどうか

    戻り値
    InputStreamSource スクリーンショットが成功しなかった場合は、スクリーンショットの InputStreamSource を形式で、または null を返します。

    例外
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot ()

    デバイスからスクリーンショットを取得します。

    戻り値
    InputStreamSource スクリーンショットが成功した場合は、png 形式のスクリーンショットの InputStreamSource。スクリーンショットが成功しなかった場合は、null

    例外
    DeviceNotAvailableException

    getSerialNumber

    public String getSerialNumber ()

    このデバイスのシリアル番号を取得する便利なメソッド。

    戻り値
    String String のシリアル番号

    getSetting

    public String getSetting (int userId, 
                    String namespace, 
                    String key)

    リクエストされた設定の値を返します。namespace は {"system", "secure", "global"} のいずれかである必要があります

    パラメータ
    userId int

    namespace String

    key String

    戻り値
    String ユーザーの namespace:key に関連付けられた値。見つからない場合は Null。

    例外
    DeviceNotAvailableException

    getSetting

    public String getSetting (String namespace, 
                    String key)

    getSetting(int, String, String) を参照し、システム ユーザーで実行します。

    パラメータ
    namespace String

    key String

    戻り値
    String

    例外
    DeviceNotAvailableException

    getSimOperator

    public String getSimOperator ()

    SIM カードの通信事業者を返します。利用できない場合やデバイスが利用できない場合は null を返します。

    戻り値
    String

    getSimState

    public String getSimState ()

    SIM カードの状態を返します。利用できない場合やデバイスが利用できない場合は null を返します。

    戻り値
    String

    getTombstones

    public  getTombstones ()

    デバイスから墓石のリストを取得して返します。ルート権限が必要です。

    メソッドはベスト エフォート型であるため、何らかの理由で 1 つのトゥームストーンの取得に失敗すると、そのトゥームストーンはリストから欠落します。DeviceNotAvailableException のみでメソッドが早期に終了します。

    戻り値
    墓石ファイルのリスト。墓石がない場合は空。

    例外
    DeviceNotAvailableException

    getTotalMemory

    public long getTotalMemory ()

    物理メモリの合計サイズをバイト単位で返します。内部エラーの場合は -1 を返します。

    戻り値
    long

    getTrackingSerial

    public String getTrackingSerial ()

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

    戻り値
    String

    getUninstallablePackageNames

    public  getUninstallablePackageNames ()

    アンインストール可能なアプリのパッケージ名を取得します。現在、これはシステム以外のパッケージと更新されたシステム パッケージとして定義されています。

    戻り値
    デバイスに現在インストールされているアンインストール不可の String パッケージ名の ERROR(/Set)

    例外
    DeviceNotAvailableException

    getUseFastbootErase

    public boolean getUseFastbootErase ()

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

    戻り値
    boolean fastboot erase を使用する場合は true、fastboot format を使用する場合は false

    getUserFlags

    public int getUserFlags (int userId)

    指定されたユーザーのフラグを検索して返します。フラグは、Android オープンソース プロジェクトの「android.content.pm.UserInfo」クラスで定義されています。

    パラメータ
    userId int

    戻り値
    int 指定された userId に関連付けられたフラグ(見つかった場合)。それ以外の場合は -10000。

    例外
    DeviceNotAvailableException

    getUserInfos

    public  getUserInfos ()

    デバイス上の useId と UserInfo のマップを取得します。デバイスからの出力が想定どおりでない場合は、DeviceRuntimeException をスローします。

    戻り値
    UserInfo オブジェクトのリスト。

    例外
    DeviceNotAvailableException

    getUserSerialNumber

    public int getUserSerialNumber (int userId)

    userId に関連付けられたシリアル番号が見つかった場合はその番号を返し、それ以外の場合は -10000 を返します。

    パラメータ
    userId int

    戻り値
    int

    例外
    DeviceNotAvailableException

    handleAllocationEvent

    public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

    指定された DeviceEvent を処理します。デバイスを新しい状態に移行する可能性があります。状態遷移を IDeviceMonitor に通知します。

    DeviceEvent を処理します。このデバイスが新しい割り当て状態に移行するかどうかは、この処理によって決まります。

    パラメータ
    event DeviceEvent

    戻り値
    IManagedTestDevice.DeviceEventResponse

    hasFeature

    public boolean hasFeature (String feature)

    デバイスで機能が利用可能かどうかを確認します。

    パラメータ
    feature String: 形式は「feature:」または「」に直接する必要があります。

    戻り値
    boolean 機能が見つかった場合は true、それ以外の場合は false。

    例外
    DeviceNotAvailableException

    initializeConnection

    public void initializeConnection (IBuildInfo info, 
                    MultiMap<String, String> attributes)

    デバイスへの接続を初期化します。これは preInvocationSetup によって呼び出されますが、まれにデバイスのセットアップ中に接続を作成するときに個別に呼び出す必要がある場合があります。

    パラメータ
    info IBuildInfo

    attributes MultiMap

    例外
    DeviceNotAvailableException
    TargetSetupError

    installPackage

    public String installPackage (File packageFile, 
                    boolean reinstall, 
                    String... extraArgs)

    デバイスに Android パッケージをインストールします。

    パラメータ
    packageFile File: インストールする APK ファイル

    reinstall boolean: 再インストールを実行する必要がある場合は true

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

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

    例外
    DeviceNotAvailableException

    installPackage

    public String installPackage (File packageFile, 
                    boolean reinstall, 
                    boolean grantPermissions, 
                    String... extraArgs)

    デバイスに Android パッケージをインストールします。

    注: この関数は、インストール時に実行時の権限の付与を明示的に制御する必要があるユースケースでのみ呼び出す必要があります。

    パラメータ
    packageFile File: インストールする APK ファイル

    reinstall boolean: 再インストールを実行する必要がある場合は true

    grantPermissions boolean: インストール時にすべてのランタイム権限を付与する必要があるかどうか

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

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

    例外
    DeviceNotAvailableException

    installPackageForUser

    public String installPackageForUser (File packageFile, 
                    boolean reinstall, 
                    int userId, 
                    String... extraArgs)

    指定されたユーザーのデバイスに Android パッケージをインストールします。

    パラメータ
    packageFile File: インストールする APK ファイル

    reinstall boolean: 再インストールを実行する必要がある場合は true

    userId int: インストールする整数ユーザー ID。

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

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

    例外
    DeviceNotAvailableException

    installPackageForUser

    public String installPackageForUser (File packageFile, 
                    boolean reinstall, 
                    boolean grantPermissions, 
                    int userId, 
                    String... extraArgs)

    指定されたユーザーのデバイスに Android パッケージをインストールします。

    注: この関数は、インストール時に実行時の権限の付与を明示的に制御する必要があるユースケースでのみ呼び出す必要があります。

    パラメータ
    packageFile File: インストールする APK ファイル

    reinstall boolean: 再インストールを実行する必要がある場合は true

    grantPermissions boolean: インストール時にすべてのランタイム権限を付与する必要があるかどうか

    userId int: インストールする整数ユーザー ID。

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

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

    例外
    DeviceNotAvailableException

    installPackageWithIncrementalMode

    public boolean installPackageWithIncrementalMode (File[] apkFiles, 
                    String[] extraArgs, 
                    String userId)

    増分モードで apk をインストールします。

    パラメータ
    apkFiles File: インストールする APK ファイル。

    extraArgs String

    userId String

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    invalidatePropertyCache

    public void invalidatePropertyCache ()

    isAdbRoot

    public boolean isAdbRoot ()

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    isAdbTcp

    public boolean isAdbTcp ()

    戻り値
    boolean

    isAppEnumerationSupported

    public boolean isAppEnumerationSupported ()

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

    戻り値
    boolean アプリの列挙がサポートされている場合は true、そうでない場合は false

    例外
    DeviceNotAvailableException

    isBypassLowTargetSdkBlockSupported

    public boolean isBypassLowTargetSdkBlockSupported ()

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

    戻り値
    boolean 低いターゲット SDK ブロックのバイパスがサポートされている場合は true、それ以外の場合は false

    例外
    DeviceNotAvailableException

    isDebugfsMounted

    public boolean isDebugfsMounted ()

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

    戻り値
    boolean debugfs がマウントされている場合: true

    例外
    DeviceNotAvailableException

    isDeviceEncrypted

    public boolean isDeviceEncrypted ()

    デバイスが暗号化されているかどうかを返します。

    戻り値
    boolean デバイスが暗号化されている場合は true

    例外
    DeviceNotAvailableException

    isDirectory

    public boolean isDirectory (String path)

    デバイス上のパスがディレクトリの場合は True、それ以外の場合は False を返します。

    パラメータ
    path String

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    isEnableAdbRoot

    public boolean isEnableAdbRoot ()

    戻り値
    boolean デバイスで adb root を有効にする必要がある場合は true

    isEncryptionSupported

    public boolean isEncryptionSupported ()

    デバイスで暗号化がサポートされているかどうかを返します。

    戻り値
    boolean true: デバイスが暗号化をサポートしている場合。

    例外
    DeviceNotAvailableException

    isExecutable

    public boolean isExecutable (String fullPath)

    デバイス上のファイルパスが実行可能ファイルの場合は True を返し、それ以外の場合は False を返します。

    パラメータ
    fullPath String

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    isFastbootEnabled

    public boolean isFastbootEnabled ()

    デバイスで fastboot が利用できるかどうかを返します。

    戻り値
    boolean

    isHeadless

    public boolean isHeadless ()

    デバイスがヘッドレス(画面がない)の場合は true を返し、それ以外の場合は false を返します。

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    isHeadlessSystemUserMode

    public boolean isHeadlessSystemUserMode ()

    デバイスがヘッドレス システム ユーザー モードを使用しているかどうかを返します。

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    isMainUserPermanentAdmin

    public boolean isMainUserPermanentAdmin ()

    メインユーザーが永続的な管理者であり、削除したり管理者以外のステータスに降格したりできないかどうかを返します。

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    isMultiUserSupported

    public boolean isMultiUserSupported ()

    マルチユーザーがサポートされているかどうかを判断します。

    戻り値
    boolean マルチユーザーがサポートされている場合は true、そうでない場合は false

    例外
    DeviceNotAvailableException

    isPackageInstalled

    public boolean isPackageInstalled (String packageName, 
                    String userId)

    特定のパッケージ名と特定のユーザー ID を指定してデバイスにクエリを行い、そのユーザーに対して現在インストールされているかどうかを確認します。

    パラメータ
    packageName String: インストールされているかどうかを確認するパッケージ。

    userId String: パッケージがインストールされているかどうかを確認するユーザー ID。null の場合、プライマリ ユーザー 0 が使用されます。

    戻り値
    boolean パッケージがインストール済みとして報告されている場合は true。それ以外は False が返されます。

    例外
    DeviceNotAvailableException

    isPackageInstalled

    public boolean isPackageInstalled (String packageName)

    特定のパッケージ名についてデバイスにクエリを実行し、現在インストールされているかどうかを確認します。

    パラメータ
    packageName String

    戻り値
    boolean パッケージがインストール済みとして報告されている場合は true。それ以外は False が返されます。

    例外
    DeviceNotAvailableException

    isRuntimePermissionSupported

    public boolean isRuntimePermissionSupported ()

    デバイスのプラットフォームが実行時の権限付与をサポートしているかどうかを確認する

    戻り値
    boolean 実行時の権限がサポートされている場合は true、そうでない場合は false。

    例外
    DeviceNotAvailableException

    isStateBootloaderOrFastbootd

    public boolean isStateBootloaderOrFastbootd ()

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

    戻り値
    boolean

    isUserRunning

    public boolean isUserRunning (int userId)

    特定のユーザーが実行中かどうかを確認します。

    パラメータ
    userId int

    戻り値
    boolean ユーザーが走行中の場合は true、それ以外の場合は false。

    例外
    DeviceNotAvailableException

    isUserSecondary

    public boolean isUserSecondary (int userId)

    指定されたユーザーがフラグに従ってセカンダリ ユーザーであるかどうかを返します。

    パラメータ
    userId int

    戻り値
    boolean ユーザーがセカンダリの場合は true、それ以外の場合は false。

    例外
    DeviceNotAvailableException

    isUserVisible

    public boolean isUserVisible (int userId)

    指定されたユーザーが表示されるかどうかを確認します。

    「可視」ユーザーとは、「人間」ユーザーとやり取りしているユーザーであり、起動アクティビティ(通常はデフォルトのディスプレイ)を起動できます。

    パラメータ
    userId int

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    isUserVisibleOnDisplay

    public boolean isUserVisibleOnDisplay (int userId, 
                    int displayId)

    指定されたユーザーが指定されたディスプレイに表示されているかどうかを確認します。

    「可視」ユーザーとは、「人間」ユーザーとやり取りしているユーザーであり、そのディスプレイで起動アクティビティを起動できます。

    パラメータ
    userId int

    displayId int

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    isVisibleBackgroundUsersOnDefaultDisplaySupported

    public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported ()

    デバイスで ERROR(/java.android.view.Display#DEFAULT_DISPLAY) のバックグラウンドでユーザーが開始したものを表示できるかどうかを返します。

    その場合は、startVisibleBackgroundUser(int, int, boolean) を呼び出し、listDisplayIdsForStartingVisibleBackgroundUsers() から返されたディスプレイ(ERROR(/java.android.view.Display#DEFAULT_DISPLAY) を含む)を渡すことができます。

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    isVisibleBackgroundUsersSupported

    public boolean isVisibleBackgroundUsersSupported ()

    デバイスでユーザーがバックグラウンドで表示されることを許可するかどうかを返します。

    その場合は、listDisplayIdsForStartingVisibleBackgroundUsers() から返されたディスプレイを渡して startVisibleBackgroundUser(int, int, boolean) を呼び出すことができます。

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    isWifiEnabled

    public boolean isWifiEnabled ()

    Wi-Fi が有効になっているかどうかをテストします。

    デバイスで Wi-Fi が有効になっているかどうかを確認します。Wi-Fi を使用して実行すべきでないテスト(モバイルデータ テストなど)の前に Wi-Fi のステータスをアサートするのに便利です。

    戻り値
    boolean Wi-Fi が有効な場合は true。無効の場合の false

    例外
    DeviceNotAvailableException

    listDisplayIds

    public  listDisplayIds ()

    「dumpsys SurfaceFlinger」で報告されたデバイス上の利用可能なディスプレイの ID のリストを収集します。

    戻り値
    ディスプレイのリスト。Default は常にデフォルトのディスプレイ 0 を返します。

    例外
    DeviceNotAvailableException

    listDisplayIdsForStartingVisibleBackgroundUsers

    public  listDisplayIdsForStartingVisibleBackgroundUsers ()

    start a user visible in the background に使用できるディスプレイのリストを取得します。

    戻り値

    例外
    DeviceNotAvailableException

    listUsers

    public  listUsers ()

    デバイスのユーザーのリストを取得します。デバイスからの出力が想定どおりでない場合は、DeviceRuntimeException をスローします。

    戻り値
    ユーザー ID のリスト。

    例外
    DeviceNotAvailableException

    logAnrs

    public boolean logAnrs (ITestLogger logger)

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

    パラメータ
    logger ITestLogger: ANR をログに記録する ITestLogger

    戻り値
    boolean ロギングが成功した場合は true、それ以外の場合は false。

    例外
    DeviceNotAvailableException

    logBugreport

    public boolean logBugreport (String dataName, 
                    ITestLogger listener)

    バグレポートを取得して報告者に記録するヘルパー メソッド。

    パラメータ
    dataName String: バグレポートが報告される名前。

    listener ITestLogger: バグレポートをログに記録する ITestLogger

    戻り値
    boolean ロギングが成功した場合は true、それ以外の場合は false。

    logOnDevice

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

    デバイスの logcat にメッセージを記録します。これは、ロギングが失敗した場合でも例外をスローしない安全な呼び出しです。

    パラメータ
    tag String: logcat にメッセージを記録する際のタグ。

    level Log.LogLevel: logcat のメッセージのデバッグレベル。

    format String: メッセージ形式。

    args Object: String.format() で置き換える引数。

    mountDebugfs

    public void mountDebugfs ()

    debugfs をマウントします。

    例外
    DeviceNotAvailableException

    nonBlockingReboot

    public void nonBlockingReboot ()

    デバイスを再起動するコマンドを発行し、コマンドが完了したとき、およびデバイスが adb に表示されなくなったときに返します。

    例外
    DeviceNotAvailableException

    postAdbRootAction

    public void postAdbRootAction ()

    デバイスが adb root の後、オンラインに戻る前に特定のアクションを必要とする場合は、オーバーライドします。デフォルトの実装には追加のアクションは含まれていません。この段階では、adb root が有効になっているとは限りません。

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

    postAdbUnrootAction

    public void postAdbUnrootAction ()

    adb のルート解除後、デバイスがオンラインに戻る前に、デバイスで特定の操作が必要な場合にオーバーライドします。デフォルトの実装には追加のアクションは含まれていません。この段階では、adb root が無効になっていることは保証されません。

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

    postBootSetup

    public void postBootSetup ()

    ブートごとにテスト用にデバイスを構成する手順を実行します。

    デバイスが完全に起動して使用可能になった後に呼び出す必要があります。

    通常、このメソッドを明示的に呼び出す必要はありません。実装では、再起動時にこれらの手順が自動的に実行されるはずです。

    この呼び出しが必要になるのは、他のイベント(fastboot 更新コマンドの完了など)によってデバイスが再起動される場合です。

    例外
    DeviceNotAvailableException

    postInvocationTearDown

    public void postInvocationTearDown (Throwable exception)

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

    パラメータ
    exception Throwable: 呼び出しの失敗によって発生した最終的な例外(ある場合)。

    preInvocationSetup

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

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

    パラメータ
    info IBuildInfo: デバイスの IBuildInfo

    attributes MultiMap: 呼び出しコンテキストに保存されている属性

    例外
    DeviceNotAvailableException
    TargetSetupError

    pullDir

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

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

    パラメータ
    deviceFilePath String: リモート ソースの絶対ファイルパス

    localDir File: ファイルをプルするローカル ディレクトリ

    userId int: プルするユーザー ID

    戻り値
    boolean ファイルが正常に取得された場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    pullDir

    public boolean pullDir (String deviceFilePath, 
                    File localDir)

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

    パラメータ
    deviceFilePath String: リモート ソースの絶対ファイルパス

    localDir File: ファイルをプルするローカル ディレクトリ

    戻り値
    boolean ファイルが正常に取得された場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    pullFile

    public boolean pullFile (String remoteFilePath, 
                    File localFile)

    デバイスからファイルを取得します。

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

    localFile File: コンテンツを保存するローカル ファイル。空でない場合、内容は置き換えられます。

    戻り値
    boolean ファイルが正常に取得された場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    pullFile

    public File pullFile (String remoteFilePath, 
                    int userId)

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

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

    userId int: 取得元のユーザー ID

    戻り値
    File デバイス ファイルの内容を含む ERROR(/File)。コピーが何らかの理由で失敗した場合は null(ホスト ファイル システムの問題を含む)

    例外
    DeviceNotAvailableException

    pullFile

    public File pullFile (String remoteFilePath)

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

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

    戻り値
    File デバイス ファイルの内容を含む ERROR(/File)。コピーが何らかの理由で失敗した場合は null(ホスト ファイル システムの問題を含む)

    例外
    DeviceNotAvailableException

    pullFile

    public boolean pullFile (String remoteFilePath, 
                    File localFile, 
                    int userId)

    デバイスからファイルを取得します。

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

    localFile File: コンテンツを保存するローカル ファイル。空でない場合、内容は置き換えられます。

    userId int: 取得元のユーザー ID

    戻り値
    boolean ファイルが正常に取得された場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    pullFileContents

    public String pullFileContents (String remoteFilePath)

    デバイスからファイルを取得し、その内容を返します。

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

    戻り値
    String デバイス ファイルの内容を含む String。コピーが何らかの理由で失敗した場合は null(ホスト ファイル システムの問題を含む)

    例外
    DeviceNotAvailableException

    pullFileFromExternal

    public File pullFileFromExternal (String remoteFilePath)

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

    パラメータ
    remoteFilePath String: デバイスの外部ストレージ マウントポイントを基準とした、デバイス上のファイルのパス

    戻り値
    File デバイス ファイルの内容を含む ERROR(/File)。コピーが何らかの理由で失敗した場合は null(ホスト ファイル システムの問題を含む)

    例外
    DeviceNotAvailableException

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath, 
                     excludedDirectories)

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

    パラメータ
    localFileDir File: push するローカル ディレクトリ

    deviceFilePath String: リモート宛先の絶対ファイルパス

    excludedDirectories : プッシュしない除外ディレクトリ名のセット。

    戻り値
    boolean ファイルが正常にプッシュされた場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath)

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

    パラメータ
    localFileDir File: push するローカル ディレクトリ

    deviceFilePath String: リモート宛先の絶対ファイルパス

    戻り値
    boolean ファイルが正常にプッシュされた場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath, 
                    int userId)

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

    パラメータ
    localFileDir File: push するローカル ディレクトリ

    deviceFilePath String: リモート宛先の絶対ファイルパス

    userId int: プッシュするユーザー ID

    戻り値
    boolean ファイルが正常にプッシュされた場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath, 
                    boolean evaluateContentProviderNeeded)

    コンテンツ プロバイダのニーズの評価をオプションで考慮できる pushFile(File, String) のバリエーション。

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

    remoteFilePath String: リモートの宛先の絶対ファイルパス

    evaluateContentProviderNeeded boolean: コンテンツ プロバイダが必要かどうかを確認するかどうか

    戻り値
    boolean ファイルが正常にプッシュされた場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath)

    ファイルをデバイスにプッシュします。デフォルトでは、コンテンツ プロバイダを使用します。

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

    remoteFilePath String: リモートの宛先の絶対ファイルパス

    戻り値
    boolean ファイルが正常にプッシュされた場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath, 
                    int userId)

    ファイルをデバイスにプッシュします。デフォルトでは、コンテンツ プロバイダを使用します。

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

    remoteFilePath String: リモートの宛先の絶対ファイルパス

    userId int: プッシュ先の userId

    戻り値
    boolean ファイルが正常にプッシュされた場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    pushString

    public boolean pushString (String contents, 
                    String remoteFilePath)

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

    パラメータ
    contents String: プッシュするファイルの内容

    remoteFilePath String: リモートの宛先の絶対ファイルパス

    戻り値
    boolean 文字列が正常に push された場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    再起動

    public void reboot (String reason)

    指定された reason を使用して、再起動後も保持される adb モードでデバイスを再起動します。

    デバイスが利用可能になるまでブロックします。

    前回の再起動の理由は、sys.boot.reason プロパティをクエリすることで取得できます。

    パラメータ
    reason String: この再起動の理由。理由が指定されていない場合は null

    例外
    DeviceNotAvailableException

    再起動

    public void reboot ()

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

    デバイスが利用可能になるまでブロックします。

    例外
    DeviceNotAvailableException

    rebootIntoBootloader

    public void rebootIntoBootloader ()

    デバイスを再起動してブートローダー モードにします。

    デバイスがブートローダー モードになるまでブロックします。

    例外
    DeviceNotAvailableException

    rebootIntoFastbootd

    public void rebootIntoFastbootd ()

    デバイスを再起動して fastbootd モードにします。

    デバイスが fastbootd モードになるまでブロックします。

    例外
    DeviceNotAvailableException

    rebootIntoRecovery

    public void rebootIntoRecovery ()

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

    デバイスがリカバリに入るまでブロック

    例外
    DeviceNotAvailableException

    rebootIntoSideload

    public void rebootIntoSideload ()

    デバイスを adb サイドロード モードで再起動します(これはリカバリの特別なモードです)。

    デバイスがサイドロード モードになるまでブロック

    例外
    DeviceNotAvailableException

    rebootIntoSideload

    public void rebootIntoSideload (boolean autoReboot)

    デバイスを adb サイドロード モードで再起動します(これはリカバリの特別なモードです)。

    デバイスがサイドロード モードになるまでブロック

    パラメータ
    autoReboot boolean: サイドロード後にデバイスを自動的に再起動するかどうか

    例外
    DeviceNotAvailableException

    rebootUntilOnline

    public void rebootUntilOnline ()

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

    例外
    DeviceNotAvailableException

    rebootUntilOnline

    public void rebootUntilOnline (String reason)

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

    パラメータ
    reason String: この再起動の理由。理由が指定されていない場合は null

    例外
    DeviceNotAvailableException

    rebootUserspace

    public void rebootUserspace ()

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

    デバイスが利用可能になるまでブロックします。

    警告。ユーザースペースの再起動は現在開発中であり、自己責任で使用してください。

    例外
    DeviceNotAvailableException

    rebootUserspaceUntilOnline

    public void rebootUserspaceUntilOnline ()

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

    例外
    DeviceNotAvailableException

    recoverDevice

    public boolean recoverDevice ()

    デバイスの通信の復元を試みます。

    戻り値
    boolean 復元が試行され、成功した場合は True、復元がスキップされた場合は False を返します

    例外
    DeviceNotAvailableException デバイスが利用できなくなった場合

    registerDeviceActionReceiver

    public void registerDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)

    このデバイスの IDeviceActionReceiver を登録します。

    登録されているすべての IDeviceActionReceiver は、デバイス アクションの開始前と終了後に通知を受け取ります。

    パラメータ
    deviceActionReceiver IDeviceActionReceiver: 登録される IDeviceActionReceiver

    remountSystemReadOnly

    public void remountSystemReadOnly ()

    デバイスのシステム パーティションを読み取り専用にします。デバイスを再起動する場合があります。

    例外
    DeviceNotAvailableException

    remountSystemWritable

    public void remountSystemWritable ()

    デバイスのシステム パーティションを書き込み可能にします。デバイスを再起動する場合があります。

    例外
    DeviceNotAvailableException

    remountVendorReadOnly

    public void remountVendorReadOnly ()

    デバイスのベンダー パーティションを読み取り専用にします。デバイスを再起動する場合があります。

    例外
    DeviceNotAvailableException

    remountVendorWritable

    public void remountVendorWritable ()

    デバイスのベンダー パーティションを書き込み可能にします。デバイスを再起動する場合があります。

    例外
    DeviceNotAvailableException

    removeAdmin

    public boolean removeAdmin (String componentName, 
                    int userId)

    指定されたユーザーの指定されたデバイス管理者を削除し、成功した場合は true を、それ以外の場合は false を返します。

    パラメータ
    componentName String: 削除するデバイス管理者の。

    userId int: デバイス管理者が属するユーザーの。

    戻り値
    boolean 成功した場合は true、それ以外の場合は false。

    例外
    DeviceNotAvailableException

    removeOwners

    public void removeOwners ()

    ベスト エフォートで既存のデバイス プロファイル オーナーをすべて削除します。

    例外
    DeviceNotAvailableException

    removeUser

    public boolean removeUser (int userId)

    指定されたユーザーをデバイスから削除します。

    パラメータ
    userId int: 削除するユーザーの

    戻り値
    boolean ユーザーの削除に成功した場合は true、それ以外の場合は false。

    例外
    DeviceNotAvailableException

    resetContentProviderSetup

    public void resetContentProviderSetup ()

    コンテンツ プロバイダの設定のフラグをリセットして、再度トリガーします。

    runInstrumentationTests

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

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

    パラメータ
    runner IRemoteAndroidTestRunner: テストを実行する IRemoteAndroidTestRunner

    listeners ITestLifeCycleReceiver: テスト結果リスナー

    戻り値
    boolean テストコマンドが完了した場合 true完了に失敗したが復元に成功した場合は false

    例外
    DeviceNotAvailableException

    runInstrumentationTests

    public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                     listeners)

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

    テスト実行が完了する前にデバイスとの接続が失われ、復元が成功した場合、すべてのリスナーに testRunFailed が通知され、「false」が返されます。テストコマンドは再実行されません。必要に応じて再試行するのは呼び出し側の責任です。

    テスト実行が完了する前にデバイスとの接続が失われ、復元に失敗すると、すべてのリスナーに testRunFailed が通知され、DeviceNotAvailableException がスローされます。

    パラメータ
    runner IRemoteAndroidTestRunner: テストを実行する IRemoteAndroidTestRunner

    listeners : テスト結果リスナー

    戻り値
    boolean テストコマンドが完了した場合 trueデバイス通信例外が原因で完了できなかったが、復元に成功した場合は false

    例外
    DeviceNotAvailableException

    runInstrumentationTestsAsUser

    public 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)) と同じですが、指定されたユーザーに対してテストを実行します。

    パラメータ
    runner IRemoteAndroidTestRunner

    userId int

    listeners

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    runInstrumentationTestsAsUser

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

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

    パラメータ
    runner IRemoteAndroidTestRunner

    userId int

    listeners ITestLifeCycleReceiver

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    setAdbPath

    public void setAdbPath (String adbPath)

    使用する adb バイナリへのパスを設定します。

    パラメータ
    adbPath String

    setConfiguration

    public void setConfiguration (IConfiguration configuration)

    使用中の IConfiguration を挿入します。

    パラメータ
    configuration IConfiguration

    setConnectionAvdInfo

    public final void setConnectionAvdInfo (GceAvdInfo avdInfo)

    パラメータ
    avdInfo GceAvdInfo

    setDate

    public void setDate (Date date)

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

    注: デバイスの日付を設定するにはルートが必要です

    パラメータ
    date Date: 特定の日付を指定します。null の場合はホストの日付を使用します。

    例外
    DeviceNotAvailableException

    setDeviceOwner

    public boolean setDeviceOwner (String componentName, 
                    int userId)

    特定のユーザーのデバイス オーナーとしてデバイス管理者コンポーネントを設定します。

    パラメータ
    componentName String: デバイス オーナーになるデバイス管理者の。

    userId int: デバイス所有者が住んでいる国。

    戻り値
    boolean 成功した場合は true、それ以外の場合は false。

    例外
    DeviceNotAvailableException

    setDeviceState

    public void setDeviceState (TestDeviceState deviceState)

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

    パラメータ
    deviceState TestDeviceState: TestDeviceState

    setEmulatorOutputStream

    public void setEmulatorOutputStream (SizeLimitedOutputStream output)

    エミュレータの場合、SizeLimitedOutputStream をログ出力に設定します

    パラメータ
    output SizeLimitedOutputStream: 出力をログに記録します

    setEmulatorProcess

    public void setEmulatorProcess (Process p)

    このデバイスがエミュレータの場合、Process を設定します。

    パラメータ
    p Process

    setFastbootEnabled

    public void setFastbootEnabled (boolean fastbootEnabled)

    デバイスの fastboot オプションを設定します。デバイスが最初に割り当てられたときに設定する必要があります。

    パラメータ
    fastbootEnabled boolean: デバイスで fastboot が利用可能かどうか

    setFastbootPath

    public void setFastbootPath (String fastbootPath)

    使用する fastboot バイナリのパスを設定します。fastboot 関数を有効にするには、isFastbootEnabled() が true である必要があります。

    パラメータ
    fastbootPath String

    setIDevice

    public void setIDevice (IDevice newDevice)

    この ITestDevice に関連付けられた IDevice を更新します。

    新しい IDevice は、現在の参照と同じ物理デバイスを参照する必要があります。このメソッドは、DDMS が新しい IDevice を割り当てた場合に呼び出されます。

    パラメータ
    newDevice IDevice: IDevice

    setLogStartDelay

    public void setLogStartDelay (int delay)

    オンライン デバイスの logcat キャプチャを開始するまでの待機時間をミリ秒単位で設定します。

    パラメータ
    delay int: 遅延(ミリ秒単位)

    setOptions

    public void setOptions (TestDeviceOptions options)

    デバイスの TestDeviceOptions を設定する

    パラメータ
    options TestDeviceOptions

    setProperty

    public boolean setProperty (String propKey, 
                    String propValue)

    デバイスに指定されたプロパティ値を設定します。adb root が true である必要があります。

    パラメータ
    propKey String: 設定対象のキー。

    propValue String: 設定するプロパティ値。

    戻り値
    boolean setprop コマンドが成功した場合は True を返し、それ以外の場合は False を返します。

    例外
    DeviceNotAvailableException

    setRecovery

    public void setRecovery (IDeviceRecovery recovery)

    このデバイスで使用する IDeviceRecovery を設定します。デバイスが最初に割り当てられたときに設定する必要があります。

    パラメータ
    recovery IDeviceRecovery: IDeviceRecovery

    setRecoveryMode

    public void setRecoveryMode (ITestDevice.RecoveryMode mode)

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

    デバイス通信の問題が発生した場合に使用する復元方法を制御するために使用されます。このメソッドは、必要な場合にのみ(フレームワークがダウンしている場合など)慎重に使用することをおすすめします。

    パラメータ
    mode ITestDevice.RecoveryMode: 「オンラインになるまでのみ復元」モードをオンにするかどうか。

    setSetting

    public void setSetting (String namespace, 
                    String key, 
                    String value)

    setSetting(int, String, String, String) を参照し、システム ユーザーで実行します。

    パラメータ
    namespace String

    key String

    value String

    例外
    DeviceNotAvailableException

    setSetting

    public void setSetting (int userId, 
                    String namespace, 
                    String key, 
                    String value)

    特定のユーザーの Namespace に設定値を追加します。一部の設定は再起動後にのみ利用可能になります。namespace は {"system", "secure", "global"} のいずれかである必要があります

    パラメータ
    userId int

    namespace String

    key String

    value String

    例外
    DeviceNotAvailableException

    setTestLogger

    public void setTestLogger (ITestLogger testLogger)

    ITestLogger インスタンスを挿入します

    パラメータ
    testLogger ITestLogger

    setTrackingSerial

    public void setTrackingSerial (String trackingSerial)

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

    パラメータ
    trackingSerial String

    setUseFastbootErase

    public void setUseFastbootErase (boolean useFastbootErase)

    デバイスのパーティションをワイプする際に fastboot erase を使用するか、fastboot format を使用するかを設定します。

    パラメータ
    useFastbootErase boolean: fastboot erase を使用する場合は true、fastboot format を使用する場合は false

    startLogcat

    public void startLogcat ()

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

    logcat 出力がすでにキャプチャされている場合、効果はありません。データは後で getLogcat を介して取得できます。

    デバイスが使用されなくなったら、stopLogcat() を呼び出す必要があります。

    通常、TF 呼び出しコンテキスト内では startLogcat()stopLogcat() を呼び出す必要はありません。TF フレームワークが logcat を開始および停止するためです。

    startTradeInModeTesting

    public boolean startTradeInModeTesting (int timeoutMs)

    下取りモードのテストを有効にします。デバイスがワイプされ、再起動します。

    パラメータ
    timeoutMs int

    戻り値
    boolean 成功した場合は true、それ以外の場合は false

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

    startUser

    public boolean startUser (int userId)

    指定されたユーザーが現在停止している場合、バックグラウンドで開始します。ユーザーがすでにバックグラウンドで実行されている場合、このメソッドは NOOP です。

    パラメータ
    userId int: バックグラウンドで開始するユーザーの

    戻り値
    boolean ユーザーがバックグラウンドで正常に開始された場合は true。

    例外
    DeviceNotAvailableException

    startUser

    public boolean startUser (int userId, 
                    boolean waitFlag)

    指定されたユーザーが現在停止している場合、バックグラウンドで開始します。ユーザーがすでにバックグラウンドで実行されている場合、このメソッドは NOOP です。オペレーションが有効になるまで待機するための追加フラグを指定できます。

    パラメータ
    userId int: バックグラウンドで開始するユーザーの

    waitFlag boolean: ユーザーが起動してロック解除されるまでコマンドを待機させます。

    戻り値
    boolean ユーザーがバックグラウンドで正常に開始された場合は true。

    例外
    DeviceNotAvailableException

    startVisibleBackgroundUser

    public boolean startVisibleBackgroundUser (int userId, 
                    int displayId, 
                    boolean waitFlag)

    指定されたユーザーをバックグラウンドで開始し、指定されたディスプレイに表示します(つまり、ユーザーがそのディスプレイでアクティビティを起動できるようにします)。

    注: このコマンドは、ユーザーが存在するかどうか、ディスプレイが使用可能かどうか、device supports such feature などを確認しません。

    パラメータ
    userId int: バックグラウンドで開始するユーザーの

    displayId int: ユーザーに表示を開始するディスプレイ

    waitFlag boolean: ユーザーが起動してロック解除されるまでコマンドを待機させます。

    戻り値
    boolean ユーザーがバックグラウンドで正常に起動された場合は true

    例外
    DeviceNotAvailableException

    stopEmulatorOutput

    public void stopEmulatorOutput ()

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

    stopLogcat

    public void stopLogcat ()

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

    logcat 出力がキャプチャされていない場合、効果はありません。

    stopTradeInModeTesting

    public void stopTradeInModeTesting ()

    下取りモードのテストを停止します。

    例外
    DeviceNotAvailableException

    stopUser

    public boolean stopUser (int userId)

    指定されたユーザーを停止します。ユーザーがすでに停止している場合、このメソッドは NOOP です。現在のユーザーとシステム ユーザーを停止できません。

    パラメータ
    userId int: 停止するユーザーの。

    戻り値
    boolean ユーザーが正常に停止された場合は true。

    例外
    DeviceNotAvailableException

    stopUser

    public boolean stopUser (int userId, 
                    boolean waitFlag, 
                    boolean forceFlag)

    指定されたユーザーを停止します。オペレーションが有効になるまで待機し、ユーザーを強制終了するための追加フラグを指定できます。現在のユーザーとシステム ユーザーを停止できません。

    パラメータ
    userId int: 停止するユーザーの。

    waitFlag boolean: ユーザーが停止するまでコマンドを待機させます。

    forceFlag boolean: ユーザーを強制停止します。

    戻り値
    boolean ユーザーが正常に停止された場合は true。

    例外
    DeviceNotAvailableException

    switchToAdbTcp

    public String switchToAdbTcp ()

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

    戻り値
    String tcp シリアル番号。デバイスを切り替えられなかった場合は null

    例外
    DeviceNotAvailableException

    switchToAdbUsb

    public boolean switchToAdbUsb ()

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

    戻り値
    boolean 切り替えが成功した場合は true、それ以外の場合は false

    例外
    DeviceNotAvailableException

    switchUser

    public boolean switchUser (int userId)

    デフォルトのタイムアウトで別の userId に切り替えます。switchUser(int, long)

    パラメータ
    userId int

    戻り値
    boolean 新しい userId が userId プロバイダと一致する場合は true。それ以外は False が返されます。

    例外
    DeviceNotAvailableException

    switchUser

    public boolean switchUser (int userId, 
                    long timeout)

    指定されたタイムアウトを期限として、別の userId に切り替えます。ユーザーの変更が成功したら、キーガードを無効にしようとします。

    パラメータ
    userId int

    timeout long: ユーザー切り替えの失敗に対して false を返す前に待機する時間。

    戻り値
    boolean 新しい userId が userId プロバイダと一致する場合は true。それ以外は False が返されます。

    例外
    DeviceNotAvailableException

    syncFiles

    public boolean syncFiles (File localFileDir, 
                    String deviceFilePath)

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

    ローカル ファイルのタイムスタンプとリモート ファイルのタイムスタンプを比較して、プッシュするファイルを決定します。「新しい」ファイルまたは存在しないファイルのみがデバイスにプッシュされます。そのため、デバイス上のファイルセットがすでに最新の状態であれば、オーバーヘッドは比較的小さくなります。

    隠しファイル(名前が「.」で始まるファイル)は無視されます。

    使用例: syncFiles("/tmp/files", "/sdcard") は、/sdcard/files ディレクトリが存在しない場合は作成し、/tmp/files のコンテンツを /sdcard/files に再帰的に push します。

    パラメータ
    localFileDir File: 再帰的にプッシュするファイルを含むローカル ファイル ディレクトリ。

    deviceFilePath String: リモートの宛先絶対ファイルパスのルート。このファイルパス内のすべてのディレクトリが読み取り可能である必要があります。つまり、adb が root ではないときに /data/local/tmp にプッシュすると失敗します。

    戻り値
    boolean ファイルが正常に同期された場合は true。それ以外の場合は false

    例外
    DeviceNotAvailableException

    takeBugreport

    public Bugreport takeBugreport ()

    バグレポートを取得し、それを Bugreport オブジェクト内で返して処理します。問題が発生した場合は null を返します。Bugreport オブジェクトで参照されるファイルは、Bugreport.close() を介してクリーンアップする必要があります。

    戻り値
    Bugreport

    uninstallPackage

    public String uninstallPackage (String packageName)

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

    パラメータ
    packageName String: アンインストールする Android パッケージ

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

    例外
    DeviceNotAvailableException

    uninstallPackageForUser

    public String uninstallPackageForUser (String packageName, 
                    int userId)

    指定されたユーザーのデバイスから Android パッケージをアンインストールします。

    パラメータ
    packageName String: アンインストールする Android パッケージ

    userId int: アンインストールする整数ユーザー ID。

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

    例外
    DeviceNotAvailableException

    unlockDevice

    public boolean unlockDevice ()

    デバイスが暗号化された状態の場合、デバイスのロックを解除します。

    このメソッドはフレームワークを再起動する可能性がありますが、postBootSetup() は呼び出しません。そのため、このメソッドが戻るときに、デバイスのテストの準備が完全に整っていない可能性があります。

    戻り値
    boolean 成功した場合、またはデバイスが暗号化されていない場合は true

    例外
    DeviceNotAvailableException

    unmountDebugfs

    public void unmountDebugfs ()

    debugfs をアンマウントします。

    例外
    DeviceNotAvailableException

    waitForBootComplete

    public boolean waitForBootComplete (long timeOut)

    デバイスの起動完了フラグが設定されるまでブロックします。

    パラメータ
    timeOut long: フラグが設定されるのを待つ時間(ミリ秒単位)

    戻り値
    boolean デバイスのブート完了フラグがタイムアウト内に設定されている場合は true

    例外
    DeviceNotAvailableException

    waitForDeviceAvailable

    public boolean waitForDeviceAvailable ()

    デバイスが応答し、テストに使用できるようになるまで待機します。デフォルトのタイムアウトを使用します。

    戻り値
    boolean デバイスが利用可能な場合は True、復元が無効で利用できない場合は False。

    例外
    DeviceNotAvailableException

    waitForDeviceAvailable

    public boolean waitForDeviceAvailable (long waitTime)

    デバイスが応答し、テストに使用できるようになるまで待機します。

    パラメータ
    waitTime long: 待機する時間(ミリ秒単位)

    戻り値
    boolean デバイスが利用可能な場合は True、復元が無効で利用できない場合は False。

    例外
    DeviceNotAvailableException

    waitForDeviceAvailableInRecoverPath

    public boolean waitForDeviceAvailableInRecoverPath (long waitTime)

    復元パスを考慮せずに、デバイスが応答可能で利用可能になるまで待機します。

    パラメータ
    waitTime long

    戻り値
    boolean デバイスが利用可能な場合は True、利用不可の場合は False。

    例外
    DeviceNotAvailableException

    waitForDeviceBootloader

    public void waitForDeviceBootloader ()

    fastboot でデバイスが認識されるまでブロックします。デフォルトのタイムアウトを使用します。

    例外
    DeviceNotAvailableException

    waitForDeviceFastbootD

    public void waitForDeviceFastbootD ()

    例外
    DeviceNotAvailableException

    waitForDeviceInRecovery

    public boolean waitForDeviceInRecovery (long waitTime)

    デバイスが「adb recovery」状態になるのをブロックします(これは IDeviceRecovery とは異なります)。

    パラメータ
    waitTime long: 待機する時間(ミリ秒単位)

    戻り値
    boolean true(デバイスがタイムアウト前にリカバリ モードで起動した場合)。その他は false

    waitForDeviceInSideload

    public boolean waitForDeviceInSideload (long waitTime)

    デバイスが「adb sideload」状態になるためのブロック

    パラメータ
    waitTime long: 待機する時間(ミリ秒単位)

    戻り値
    boolean true(デバイスがタイムアウト前にサイドローディングで起動した場合)。その他は false

    waitForDeviceNotAvailable

    public boolean waitForDeviceNotAvailable (long waitTime)

    デバイスが利用できない(adb に表示されない)ブロック

    パラメータ
    waitTime long: 待機する時間(ミリ秒単位)

    戻り値
    boolean 時間が経過する前にデバイスが利用できなくなった場合は true。その他は false

    waitForDeviceOnline

    public void waitForDeviceOnline ()

    adb 経由でデバイスが認識されるまでブロックします。デフォルトのタイムアウトを使用します。

    完了時にデバイスがコマンドに応答しないことがあります。代わりに waitForDeviceAvailable() を使用してください。

    例外
    DeviceNotAvailableException

    waitForDeviceOnline

    public void waitForDeviceOnline (long waitTime)

    adb 経由でデバイスが認識されるまでブロックします。

    完了時にデバイスがコマンドに応答しないことがあります。代わりに waitForDeviceAvailable() を使用してください。

    パラメータ
    waitTime long: 待機する時間(ミリ秒単位)

    例外
    DeviceNotAvailableException

    waitForDeviceShell

    public boolean waitForDeviceShell (long waitTime)

    デバイスが基本的な adb shell コマンドに応答するまで待機します。

    パラメータ
    waitTime long: 待機する時間(ミリ秒単位)

    戻り値
    boolean waitTime が経過する前にデバイスが応答するようになった場合は true

    保護されたメソッド

    addExtraConnectionBuilderArgs

    protected void addExtraConnectionBuilderArgs (DefaultConnection.ConnectionBuilder builder)

    パラメータ
    builder DefaultConnection.ConnectionBuilder

    buildAdbShellCommand

    protected String[] buildAdbShellCommand (String command, 
                    boolean forceExitStatusDetection)

    指定された adb シェル コマンド セッションと引数の OS コマンドをビルドします

    パラメータ
    command String

    forceExitStatusDetection boolean

    戻り値
    String[]

    checkApiLevelAgainst

    protected void checkApiLevelAgainst (String feature, 
                    int strictMinLevel)

    パラメータ
    feature String

    strictMinLevel int

    createRebootDeviceAction

    protected NativeDevice.RebootDeviceAction createRebootDeviceAction (NativeDevice.RebootMode rebootMode, 
                    String reason)

    再起動アクションの実行時に使用する RebootDeviceAction を作成します。

    パラメータ
    rebootMode NativeDevice.RebootMode: この再起動のモード。

    reason String: この再起動用。

    戻り値
    NativeDevice.RebootDeviceAction 作成された RebootDeviceAction

    createRunUtil

    protected IRunUtil createRunUtil ()

    戻り値
    IRunUtil

    doAdbReboot

    protected void doAdbReboot (NativeDevice.RebootMode rebootMode, 
                    String reason)

    adb reboot を実行します。

    パラメータ
    rebootMode NativeDevice.RebootMode: この再起動のモード。

    reason String: この再起動用。

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

    ensureRuntimePermissionSupported

    protected void ensureRuntimePermissionSupported ()

    ランタイム権限がサポートされていない場合に例外をスローするヘルパー メソッド

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

    getApiLevelSafe

    protected int getApiLevelSafe ()

    戻り値
    int

    getLogger

    protected ITestLogger getLogger ()

    戻り値
    ITestLogger

    getRunUtil

    protected IRunUtil getRunUtil ()

    使用する RunUtil インスタンスを取得します。

    戻り値
    IRunUtil

    internalGetProperty

    protected String internalGetProperty (String propName, 
                    String fastbootVar, 
                    String description)

    デバイスが Fastboot モードかどうかによって、デフォルトで ddmlib キャッシュからデバイス プロパティを取得し、`adb shell getprop` または `fastboot getvar` にフォールバックします。

    パラメータ
    propName String: `adb shell getprop` で返されるデバイス プロパティの名前

    fastbootVar String: クエリする同等の fastboot 変数の名前。null の場合、fastboot クエリは試行されません。

    description String: 変数の簡単な説明。最初の文字は大文字にする必要があります。

    戻り値
    String 指定されたプロパティの値を含む文字列(null または空の可能性あり)

    例外
    DeviceNotAvailableException

    isInRebootCallback

    protected boolean isInRebootCallback ()

    再起動コールバックが現在実行中かどうかを返します。true の場合、再起動のすべての公開 API を無効にする必要があります。

    戻り値
    boolean

    isNewer

    protected boolean isNewer (File localFile, 
                    IFileEntry entry)

    ローカル ファイルがリモート ファイルより新しい場合は true を返します。IFileEntry が正確に分単位で比較され、時間が同じ場合は、ファイルが新しいと見なされます。

    パラメータ
    localFile File

    entry IFileEntry

    戻り値
    boolean

    notifyRebootEnded

    protected void notifyRebootEnded ()

    すべての IDeviceActionReceiver に再起動終了イベントを通知します。

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

    notifyRebootStarted

    protected void notifyRebootStarted ()

    すべての IDeviceActionReceiver に再起動開始イベントを通知します。

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

    performDeviceAction

    protected boolean performDeviceAction (String actionDescription, 
                    NativeDevice.DeviceAction action, 
                    int retryAttempts)

    このデバイスでアクションを実行します。デバイスの復元を試み、アクションが失敗した場合はコマンドを再試行します(オプション)。

    パラメータ
    actionDescription String: 実行するアクションの簡単な説明。ロギングの目的にのみ使用されます。

    action NativeDevice.DeviceAction: 実行するアクション

    retryAttempts int: アクションが失敗したが復元が成功した場合にアクションを再試行する回数

    戻り値
    boolean アクションが正常に実行された場合は true

    例外
    DeviceNotAvailableException 復元試行が失敗した場合、または最大試行回数に達しても成功しなかった場合

    postAdbReboot

    protected void postAdbReboot (NativeDevice.RebootMode rebootMode)

    再起動後に実行できる追加のアクション。

    パラメータ
    rebootMode NativeDevice.RebootMode

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

    prePostBootSetup

    protected void prePostBootSetup ()

    各デバイスタイプ(AndroidNativeDevice、TestDevice)が、特定のブート後のセットアップのためにこのメソッドをオーバーライドできるようにします。

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

    pullFileInternal

    protected boolean pullFileInternal (String remoteFilePath, 
                    File localFile)

    パラメータ
    remoteFilePath String

    localFile File

    戻り値
    boolean

    例外
    DeviceNotAvailableException

    setClock

    protected void setClock (Clock clock)

    使用する Clock インスタンスを設定します。

    パラメータ
    clock Clock

    setMicrodroidProcess

    protected void setMicrodroidProcess (Process process)

    TestDevice を microdroid としてマークし、その CID を設定します。

    パラメータ
    process Process: Microdroid VM のプロセス。

    setTestDeviceOptions

    protected void setTestDeviceOptions ( deviceOptions)

    パラメータ
    deviceOptions

    simpleFastbootCommand

    protected CommandResult simpleFastbootCommand (long timeout, 
                     envVarMap, 
                    String[] fullCmd)

    環境変数を使用して簡単な fastboot コマンドを実行し、コマンドのステータスをレポートします。

    パラメータ
    timeout long

    envVarMap

    fullCmd String

    戻り値
    CommandResult

    simpleFastbootCommand

    protected CommandResult simpleFastbootCommand (long timeout, 
                    String[] fullCmd)

    シンプルな fastboot コマンドを実行し、コマンドのステータスをレポートします。

    パラメータ
    timeout long

    fullCmd String

    戻り値
    CommandResult

    waitForDeviceNotAvailable

    protected boolean waitForDeviceNotAvailable (String operationDesc, 
                    long time)

    デバイスが利用不可になる(adb へのレポートを停止する)まで待ちます。

    パラメータ
    operationDesc String: 使用不可を待機しているオペレーションの名前。

    time long: 使用不可が発生するまで待機する時間。

    戻り値
    boolean デバイスが使用できなくなった場合は true。