NativeDevice

public class NativeDevice
extends Object implements IManagedTestDevice, IConfigurationReceiver, 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): デバイスを再起動します。 

定数

int INVALID_USER_ID

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

long MAX_HOST_DEVICE_TIME_OFFSET

int MAX_RETRY_ATTEMPTS

コマンドの再試行のデフォルト回数

フィールド

public static final String DEBUGFS_PATH

protected static final String SD_CARD

protected static final 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 ネットワークに接続します。

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 を使用して、ユーザーを作成します。

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 ルートをオフにします。

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 ルートを有効にします。

boolean enableNetworkMonitor()

デバイスでネットワーク監視を有効にします。

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

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

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

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

String executeAdbCommand(String... cmdArgs)

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

CommandResult executeFastbootCommand(String... cmdArgs)

fastboot コマンドを実行するヘルパー メソッド。デフォルトのタイムアウトは 2 分です。

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

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

CommandResult executeLongFastbootCommand(String... cmdArgs)

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

CommandResult executeLongFastbootCommand( envVarMap, String... cmdArgs)

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

String executeShellCommand(String command)

adb シェルコマンドを実行し、出力を 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 に関する情報を取得します。

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

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

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

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

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

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

InputStreamSource getScreenshot(long displayId)

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

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

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

long getTotalMemory()

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

getUninstallablePackageNames()

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

boolean getUseFastbootErase()

デバイスのパーティションのワイプに fastboot の消去形式と fastboot 形式のどちらを使用するかを確認します。

int getUserFlags(int userId)

指定したユーザーのフラグを検索して返します。

getUserInfos()

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

int getUserSerialNumber(int userId)

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

IManagedTestDevice.DeviceEventResponse handleAllocationEvent(DeviceEvent event)

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

DeviceEvent を処理します。これにより、このデバイスを新しい割り当て状態に移行できます。

boolean hasFeature(String feature)

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

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 パッケージをデバイスにインストールします。

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 を使用できる場合に返されます。

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 unroot の後、デバイスがオンラインに戻る前に、デバイスで特定のアクションを実行する必要がある場合はオーバーライドします。

void postBootSetup()

起動のたびにテストするようにデバイスを設定する手順を実施します。

void postInvocationTearDown(Throwable exception)

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

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

呼び出しフローの前にデバイスで実行される、デバイス固有の必要な設定のための追加ステップ。

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

ディレクトリの内容をデバイスから再帰的に pull する。

boolean pullDir(String deviceFilePath, File localDir)

ディレクトリの内容をデバイスから再帰的に pull する。

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)

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

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

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

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)

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

void reboot(String reason)

指定された reason を使用してデバイスを adb モードで再起動し、再起動しても保持されるようにします。

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

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

void remountSystemWritable()

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

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

特定のユーザーの名前空間に設定値を追加します。

void setTestLogger(ITestLogger testLogger)

ITestLogger インスタンスを挿入する

void setUseFastbootErase(boolean useFastbootErase)

デバイスのパーティションのワイプに fastboot の消去形式と fastboot 形式のどちらを使用するかを設定します。

void startLogcat()

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

boolean startUser(int userId)

特定のユーザーが現在停止している場合に、バックグラウンドで起動します。

boolean startUser(int userId, boolean waitFlag)

特定のユーザーが現在停止している場合に、バックグラウンドで起動します。

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

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

void stopEmulatorOutput()

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

void stopLogcat()

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

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 で認識されるまでブロックします。

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 シェルコマンドに反応するまで待機する。

保護されたメソッド

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 の再起動を行います。

void ensureRuntimePermissionSupported()

実行時の権限がサポートされていない場合に例外をスローするヘルパー メソッド

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

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

void initializeConnection(IBuildInfo info, MultiMap<String, String> attributes)
String internalGetProperty(String propName, String fastbootVar, String description)

デフォルトで ddmlib キャッシュからデバイスのプロパティを取得し、デバイスが fastboot に設定されているかどうかに応じて「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()

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

void prePostBootSetup()

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

boolean pullFileInternal(String remoteFilePath, File localFile)
void setClock(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 へのレポートを停止します)。

定数

INVALID_USER_ID(無効なユーザー ID)

public static final int INVALID_USER_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)

フィールド

DEBUGFS_PATH

public static final String DEBUGFS_PATH

SD_CARD

protected static final String SD_CARD

ストレージ エミュレータ

protected static final String 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 ミリ秒)。つまり、すべてのプロパティをフェッチするのとほぼ同じ速度でフェッチします。 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 true(Wi-Fi ネットワークに正常に接続された場合)。それ以外の場合は false

例外
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk)

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

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

パラメータ
wifiSsid String: 接続先の Wi-Fi SID

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

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

例外
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork ( wifiSsidToPsk)

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

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

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

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

例外
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 SID

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

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

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

例外
DeviceNotAvailableException

connectToWifiNetworkIfNeeded

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

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

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

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

例外
DeviceNotAvailableException

connectToWifiNetworkIfNeeded

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk)

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

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

例外
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

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

デバイスのソフト再起動

public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)

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

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

戻り値
boolean true: デバイスがソフトリブートした場合

例外
DeviceNotAvailableException

deviceSoftRestarted since

public boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

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

パラメータ
utcEpochTime long: エポックを経過したデバイス時刻(秒)。

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

戻り値
boolean true: デバイスがソフトリブートした場合

例外
DeviceNotAvailableException

disableAdbRoot

public boolean disableAdbRoot ()

adb ルートをオフにします。

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

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

例外
DeviceNotAvailableException

Keyguard を無効にする

public void disableKeyguard ()

キーガードの無効化を試みます。

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

例外
DeviceNotAvailableException

ネットワーク モニタリングを無効にする

public boolean disableNetworkMonitor ()

デバイスでネットワーク監視を無効にします。

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

例外
DeviceNotAvailableException

接続解除 FromWifi

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

ダンプヒープ

public File dumpHeap (String process, 
                String devicePath)

system_server からのヒープのダンプを試みます。ダンプされたファイルのクリーンアップは、呼び出し元が行います。

パラメータ
process String: ダンプヒープのデバイス プロセスの名前。

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

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

例外
DeviceNotAvailableException

enableAdbRoot

public boolean enableAdbRoot ()

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

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

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

例外
DeviceNotAvailableException

EnableNetworkMonitor

public boolean enableNetworkMonitor ()

デバイスでネットワーク監視を有効にします。

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

例外
DeviceNotAvailableException

runAdbCommand

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

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

可能な限り、障害の検出とパフォーマンスを向上させるため、executeShellCommand(String) を使用することをおすすめします。

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

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

戻り値
String コマンドから stdout を取得します。コマンドの実行が失敗した場合は null

例外
DeviceNotAvailableException

runAdbCommand

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

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

可能な限り、障害の検出とパフォーマンスを向上させるため、executeShellCommand(String) を使用することをおすすめします。

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

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

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

戻り値
String コマンドから stdout を取得します。コマンドの実行が失敗した場合は null

例外
DeviceNotAvailableException

runAdbCommand

public String executeAdbCommand (String... cmdArgs)

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

可能な限り、障害の検出とパフォーマンスを向上させるため、executeShellCommand(String) を使用することをおすすめします。

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

戻り値
String コマンドから stdout を取得します。コマンドの実行が失敗した場合は null

例外
DeviceNotAvailableException

runFastbootCommand

public CommandResult executeFastbootCommand (String... cmdArgs)

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

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

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

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

例外
DeviceNotAvailableException

runFastbootCommand

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

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

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

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

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

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

例外
DeviceNotAvailableException

runLongFastbootCommand

public CommandResult executeLongFastbootCommand (String... cmdArgs)

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

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

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

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

例外
DeviceNotAvailableException

runLongFastbootCommand

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

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

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

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

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

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

例外
DeviceNotAvailableException

runShellCommand

public String executeShellCommand (String command)

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

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

戻り値
String シェルの出力が

例外
DeviceNotAvailableException

runShellCommand

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 が成功せずに実行された場合は、DeviceNotRespondException がスローされます。

例外
DeviceNotAvailableException

runShellCommand

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 が成功せずに実行された場合は、DeviceNotRespondException がスローされます。

例外
DeviceNotAvailableException

runShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver)

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

デフォルト値を含む executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int) の簡単な形式。

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

receiver IShellOutputReceiver: シェル出力の転送先の IShellOutputReceiver

例外
DeviceNotAvailableException

runShellV2Command

public CommandResult executeShellV2Command (String cmd)

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

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

戻り値
CommandResult CommandResult での結果。

例外
DeviceNotAvailableException

runShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                OutputStream pipeToOutput)

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

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

pipeToOutput OutputStream: 標準出力がリダイレクトされる ERROR(/OutputStream)、または null。

戻り値
CommandResult CommandResult での結果。

例外
DeviceNotAvailableException

runShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput)

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

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

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

戻り値
CommandResult CommandResult での結果。

例外
DeviceNotAvailableException

runShellV2Command

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

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

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

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

timeUnit TimeUnit: maxTimeToOutputShellResponse の単位

retryAttempts int: 例外によりコマンドが失敗した場合に再試行する最大回数。retryAttempts が成功せずに実行された場合は、DeviceNotRespondException がスローされます。

戻り値
CommandResult

例外
DeviceNotAvailableException

runShellV2Command

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

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

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

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

timeUnit TimeUnit: maxTimeToOutputShellResponse の単位

戻り値
CommandResult

例外
DeviceNotAvailableException

runShellV2Command

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 が成功せずに実行された場合は、DeviceNotRespondException がスローされます。

戻り値
CommandResult

例外
DeviceNotAvailableException

runShellV2Command

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 が成功せずに実行された場合は、DeviceNotRespondException がスローされます。

戻り値
CommandResult

例外
DeviceNotAvailableException

fastbootWipePartition

public CommandResult fastbootWipePartition (String partition)

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

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

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

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

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

例外
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

デバイスで有効になっている APEX に関する情報を取得します。

戻り値
ApexInfo 個中 ERROR(/Set) 個がデバイスで現在有効です

例外
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String 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 で見つかる保証がないため、一部のユーザー 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" の場合は false、それ以外の場合は defaultValue

例外
DeviceNotAvailableException

getBootHistory

public  getBootHistory ()

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

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

例外
DeviceNotAvailableException

getBootHistoryBefore

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

バグレポートを取得

public InputStreamSource getBugreport ()

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

この実装は、SD カードがないデバイス(または SD カードがマウントされていないデバイス)でも引き続き動作することを保証します。

戻り値
InputStreamSource オンデマンドでバグレポート コンテンツを生成する InputStreamSource。エラーが発生した場合、InputStreamSource は空の ERROR(/InputStream) を生成します。

バグレポートの取得

public InputStreamSource getBugreportz ()

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

「adb version」> 1.0.36 の場合にのみサポート

戻り値
InputStreamSource bugreportz を含む zip ファイルの InputStreamSource。失敗した場合は null を返します。

getBuildAlias

public String getBuildAlias ()

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

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

戻り値
String ビルド エイリアスを使用するか、ビルド ID を取得できなかった場合はビルド 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 を取得するための非公式のヘルパー。修正: FileEntry システムをリファクタリングして、任意のパスから使用できるようにします。(root 以外も含む)。

パラメータ
entry FileListingService.FileEntry: FileEntry。Ddmlib で必要なように、root とは限りません。

戻り値
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。キーガード クエリがサポートされていない場合は Null を返します。

例外
DeviceNotAvailableException

getLastexpectedRebootTimeMillis

public long getLastExpectedRebootTimeMillis ()

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

戻り値
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 logcat データの InputStreamSource。logcat データのキャプチャに失敗した場合は、空のストリームが返されます。

    getLogcat since

    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 個中 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 (String format)

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

    パラメータ
    format String: サポートされている PNG、JPEG

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

    例外
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot (long displayId)

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

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

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

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

    getTombstone

    public  getTombstones ()

    デバイスから Tombstone のリストを取得して返します。root が必要です。

    メソッドがベスト エフォート型であるため、なんらかの理由で 1 つの Tombstone を pull できない場合は、リストに表示されません。メソッドを早期に終了できるのは DeviceNotAvailableException のみです。

    戻り値
    Tombstone ファイルのリスト。Tombstone がない場合は空になります。

    例外
    DeviceNotAvailableException

    getTotalMemory

    public long getTotalMemory ()

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

    戻り値
    long

    getUninstallablePackageNames

    public  getUninstallablePackageNames ()

    アンインストールできるアプリのパッケージ名を取得します。これは現在、非システム パッケージ、および更新されたシステム パッケージと定義されています。

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

    例外
    DeviceNotAvailableException

    getUseFastbootErase

    public boolean getUseFastbootErase ()

    デバイスのパーティションのワイプに fastboot の消去形式と fastboot 形式のどちらを使用するかを確認します。

    戻り値
    boolean fastboot の消去機能を使用する場合は true、fastboot 形式を使用する場合は false です。

    getUserFlags

    public int getUserFlags (int userId)

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

    パラメータ
    userId int

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

    例外
    DeviceNotAvailableException

    getUserInfo

    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

    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

    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 true(デバイスで adb ルートを有効にする必要がある場合)

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

    デバイスで、バックグラウンドでの表示をユーザーに許可するかどうかを返します。

    含まれている場合は、startVisibleBackgroundUser(int, int, boolean) を呼び出して、listDisplayIdsForStartingVisibleBackgroundUsers() から返されたディスプレイを渡します。

    戻り値
    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 のリストを収集します。

    戻り値
    ディスプレイのリスト。デフォルトでは、常にデフォルトのディスプレイ 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 ルートが有効になることは保証されません。

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

    postAdbUnrootAction

    public void postAdbUnrootAction ()

    adb unroot を実行した後、デバイスがオンラインに戻る前に、デバイスで特定のアクションを実行する必要がある場合はオーバーライドします。 デフォルトの実装には追加のアクションは含まれていません。この段階で adb ルートが無効になる保証はありません。

    例外
    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)

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

    パラメータ
    deviceFilePath String: リモートソースの絶対ファイルパス

    localDir File: ファイルを pull するローカル ディレクトリ

    userId int: pull 元のユーザー ID

    戻り値
    boolean ファイルが正常に pull された場合は true。そうでない場合は false

    例外
    DeviceNotAvailableException

    pullDir

    public boolean pullDir (String deviceFilePath, 
                    File localDir)

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

    パラメータ
    deviceFilePath String: リモートソースの絶対ファイルパス

    localDir File: ファイルを pull するローカル ディレクトリ

    戻り値
    boolean ファイルが正常に pull された場合は 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: pull 元のユーザー 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: pull 元のユーザー 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 : push 対象外の除外ディレクトリ名のセット。

    戻り値
    boolean ファイルが正常に push された場合は true。そうでない場合は false

    例外
    DeviceNotAvailableException

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath)

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

    パラメータ
    localFileDir File: push するローカル ディレクトリ

    deviceFilePath String: リモート デスティネーションの絶対ファイルパス

    戻り値
    boolean ファイルが正常に push された場合は true。そうでない場合は false

    例外
    DeviceNotAvailableException

    pushDir

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

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

    パラメータ
    localFileDir File: push するローカル ディレクトリ

    deviceFilePath String: リモート デスティネーションの絶対ファイルパス

    userId int: push 先のユーザー ID

    戻り値
    boolean ファイルが正常に push された場合は true。そうでない場合は false

    例外
    DeviceNotAvailableException

    pushFile

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

    pushFile(File, String) のバリアント。必要に応じてコンテンツ プロバイダのニーズの評価を含めることができます。

    パラメータ
    localFile File: push するローカル ファイル

    remoteFilePath String: リモート デスティネーションの絶対ファイルパス

    evaluateContentProviderNeeded boolean: コンテンツ プロバイダが必要かどうかをチェックする

    戻り値
    boolean ファイルが正常に push された場合は true。そうでない場合は false

    例外
    DeviceNotAvailableException

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath)

    ファイルをデバイスにプッシュします。デフォルトではコンテンツ プロバイダを使用します。

    パラメータ
    localFile File: push するローカル ファイル

    remoteFilePath String: リモート デスティネーションの絶対ファイルパス

    戻り値
    boolean ファイルが正常に push された場合は true。そうでない場合は false

    例外
    DeviceNotAvailableException

    pushFile

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

    ファイルをデバイスにプッシュします。デフォルトではコンテンツ プロバイダを使用します。

    パラメータ
    localFile File: push するローカル ファイル

    remoteFilePath String: リモート デスティネーションの絶対ファイルパス

    userId int: push 先の userId

    戻り値
    boolean ファイルが正常に push された場合は true。そうでない場合は false

    例外
    DeviceNotAvailableException

    pushString

    public boolean pushString (String contents, 
                    String remoteFilePath)

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

    パラメータ
    contents String: push するファイルの内容

    remoteFilePath String: リモート デスティネーションの絶対ファイルパス

    戻り値
    boolean 文字列が正常にプッシュされた場合は true。そうでない場合は false

    例外
    DeviceNotAvailableException

    再起動

    public void reboot (String reason)

    指定された reason を使用してデバイスを adb モードで再起動し、再起動しても保持されるようにします。

    デバイスが使用可能になるまでブロックされます。

    最終再起動の理由を取得するには、sys.boot.reason プロパティをクエリします。

    パラメータ
    reason String: この再起動の理由。指定されていない場合は null

    例外
    DeviceNotAvailableException

    再起動

    public void reboot ()

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

    デバイスが利用できるようになるまでブロックされます。

    例外
    DeviceNotAvailableException

    rememberIntoBootloader

    public void rebootIntoBootloader ()

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

    デバイスがブートローダー モードになるまでブロックします。

    例外
    DeviceNotAvailableException

    restartIntoFastbootd

    public void rebootIntoFastbootd ()

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

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

    例外
    DeviceNotAvailableException

    launchIntoRecovery

    public void rebootIntoRecovery ()

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

    デバイスがリカバリ状態になるまでブロック

    例外
    DeviceNotAvailableException

    returnIntoSideload

    public void rebootIntoSideload ()

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

    デバイスがサイドロード モードになるまでブロック

    例外
    DeviceNotAvailableException

    returnIntoSideload

    public void rebootIntoSideload (boolean autoReboot)

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

    デバイスがサイドロード モードになるまでブロック

    パラメータ
    autoReboot boolean: サイドロード後にデバイスを自動的に再起動するかどうか

    例外
    DeviceNotAvailableException

    restartUntilOnline

    public void rebootUntilOnline ()

    reboot() に代わるもので、デバイスがオンライン(adb に認識される)になるまでブロックする。

    例外
    DeviceNotAvailableException

    restartUntilOnline

    public void rebootUntilOnline (String reason)

    reboot() に代わるもので、デバイスがオンライン(adb に認識される)になるまでブロックする。

    パラメータ
    reason String: この再起動の理由。指定されていない場合は null

    例外
    DeviceNotAvailableException

    ユーザー空間を再起動

    public void rebootUserspace ()

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

    デバイスが使用可能になるまでブロックされます。

    警告。ユーザー空間の再起動は現在開発中です。自己責任でご利用ください。

    例外
    DeviceNotAvailableException

    returnUserspaceUntilOnline

    public void rebootUserspaceUntilOnline ()

    rebootUserspace() ()} の代替機能。デバイスがオンラインになるまで(つまり、adb で認識できるまで)ブロックします。

    例外
    DeviceNotAvailableException

    recoveryDevice

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

    デバイスの system パーティションを書き込み可能にします。デバイスを再起動する可能性があります。

    例外
    DeviceNotAvailableException

    remountVendorReadOnly

    public void remountVendorReadOnly ()

    デバイスのベンダー パーティションを読み取り専用にします。デバイスを再起動する可能性があります。

    例外
    DeviceNotAvailableException

    remountVendorWritable

    public void remountVendorWritable ()

    デバイスのベンダー パーティションを書き込み可能にします。デバイスを再起動する可能性があります。

    例外
    DeviceNotAvailableException

    deleteAdmin

    public boolean removeAdmin (String componentName, 
                    int userId)

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

    パラメータ
    componentName 削除するデバイス管理の String

    userId int: デバイス管理が存在するユーザーの

    戻り値
    boolean 成功した場合は true、それ以外の場合は false。

    例外
    DeviceNotAvailableException

    オーナーを削除

    public void removeOwners ()

    既存のデバイス プロファイル所有者をすべて削除します。

    例外
    DeviceNotAvailableException

    ユーザーを削除

    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 テストコマンドが完了した場合は truefalse: 完了しなかったが、復元は成功した場合

    例外
    DeviceNotAvailableException

    runInstrumentationTests

    public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                     listeners)

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

    テスト実行が完了する前にデバイスとの接続が失われ、復元が成功すると、すべてのリスナーに testRunFailed が通知され、「false」が返されます。テストコマンドは再実行されません。必要に応じて、呼び出し元が再試行します。

    テスト実行が完了する前にデバイスとの接続が失われ、復元が失敗した場合、すべてのリスナーに testRunFailed が通知され、DeviceNotAvailableException がスローされます。

    パラメータ
    runner IRemoteAndroidTestRunner: テストを実行する IRemoteAndroidTestRunner

    listeners : テスト結果リスナー

    戻り値
    boolean テストコマンドが完了した場合は truefalse: デバイス通信例外が原因で完了できなかったが、復元は成功した場合

    例外
    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

    setConfiguration

    public void setConfiguration (IConfiguration configuration)

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

    パラメータ
    configuration IConfiguration

    setConnectionAvdInfo

    public final void setConnectionAvdInfo (GceAvdInfo avdInfo)

    パラメータ
    avdInfo GceAvdInfo

    setDate

    public void setDate (Date date)

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

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

    パラメータ
    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 は、{"system"、"secure"、"global"} のいずれかである必要があります

    パラメータ
    userId int

    namespace String

    key String

    value String

    例外
    DeviceNotAvailableException

    setTestLogger

    public void setTestLogger (ITestLogger testLogger)

    ITestLogger インスタンスを注入する

    パラメータ
    testLogger ITestLogger

    setUseFastbootErase

    public void setUseFastbootErase (boolean useFastbootErase)

    デバイスのパーティションのワイプに fastboot の消去形式と fastboot 形式のどちらを使用するかを設定します。

    パラメータ
    useFastbootErase boolean: fastboot の消去を使用する必要がある場合は true、fastboot 形式を使用する必要がある場合は false

    startLogcat

    public void startLogcat ()

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

    logcat 出力がすでにキャプチャされている場合、影響はありません。 データは後で getLogcat を使用して取得できます。

    デバイスを使用しなくなった場合は、stopLogcat() を呼び出す必要があります。

    TF フレームワークは logcat の開始と停止を行うため、通常、TF 呼び出しコンテキスト内で startLogcat()stopLogcat() を呼び出す必要はありません。

    開始ユーザー

    public boolean startUser (int userId)

    特定のユーザーが現在停止している場合に、バックグラウンドで起動します。ユーザーがすでにバックグラウンドで実行されている場合、このメソッドは NOOP です。

    パラメータ
    userId int: バックグラウンドで開始するユーザーの

    戻り値
    boolean ユーザーがバックグラウンドで正常に起動した場合は true を返します。

    例外
    DeviceNotAvailableException

    開始ユーザー

    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 出力がキャプチャされていない場合、影響はありません。

    停止ユーザー

    public boolean stopUser (int userId)

    指定したユーザーを停止します。ユーザーがすでに停止している場合、このメソッドは NOOP です。現在のユーザーとシステム ユーザーを停止できません。

    パラメータ
    userId int: 停止するユーザーの。

    戻り値
    boolean ユーザーが正常に停止された場合は true を返します。

    例外
    DeviceNotAvailableException

    停止ユーザー

    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 に再帰的にプッシュします。

    パラメータ
    localFileDir File: 再帰的に push するファイルを含むローカル ファイル ディレクトリ。

    deviceFilePath String: リモート デスティネーションの絶対ファイルパスのルート。そのファイルパス内のすべてのディレクトリが読み取り可能である必要があります。たとえば、adb が root でない場合に /data/local/tmp に push すると失敗します。

    戻り値
    boolean ファイルが正常に同期された場合は true。そうでない場合は false

    例外
    DeviceNotAvailableException

    バグレポートを取得

    public Bugreport takeBugreport ()

    バグレポートを取得し、Bugreport オブジェクト内で返します。問題がある場合は null を返します。バグレポート オブジェクトで参照されているファイルは、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

    デバイスのロックを解除

    public boolean unlockDevice ()

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

    このメソッドはフレームワークを再起動できますが、postBootSetup() は呼び出されません。そのため、このメソッドが戻ったときに、デバイスはテストの準備ができていない可能性があります。

    戻り値
    boolean 成功したか、デバイスが暗号化されていない場合は true

    例外
    DeviceNotAvailableException

    DebugFS のマウント解除

    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

    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 シェルコマンドに応答するまで待機します。

    パラメータ
    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 の再起動を行います。

    パラメータ
    rebootMode NativeDevice.RebootMode: この再起動のモード。

    reason String: この再起動用。

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

    ConfirmRuntimePermissionSupported

    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

    初期化接続

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

    パラメータ
    info IBuildInfo

    attributes MultiMap

    例外
    DeviceNotAvailableException
    TargetSetupError

    InternalGetProperty

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

    デフォルトで ddmlib キャッシュからデバイスのプロパティを取得し、デバイスが Fastboot を使用しているかどうかに応じて「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

    notificationRebootEnded

    protected void notifyRebootEnded ()

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

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

    notificationRebootStarted

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

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

    例外
    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。