ネイティブデバイス
public class NativeDevice
extends Object
implements IManagedTestDevice , IConfigurationReceiver , ITestLoggerReceiver
java.lang.Object | |
↳ | com.android.tradefed.device.NativeDevice |
ITestDevice
非フルスタック Android デバイスのデフォルト実装。
まとめ
ネストされたクラス | |
---|---|
class | NativeDevice.AdbAction OS の「adb ....」コマンドを実行するための |
class | NativeDevice.AdbShellAction |
class | NativeDevice.RebootDeviceAction デバイスの再起動の |
定数 | |
---|---|
int | INVALID_USER_ID 無効な/見つからないユーザー ID に対して返される値: UserHandle は -10000 値を定義しました |
long | MAX_HOST_DEVICE_TIME_OFFSET |
int | MAX_RETRY_ATTEMPTS 実行するコマンド再試行のデフォルト回数 |
田畑 | |
---|---|
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) |
公開メソッド | |
---|---|
boolean | canSwitchToHeadlessSystemUser () ヘッドレス SYSTEM ユーザーへの切り替えが許可されているかどうかを返します。 |
boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) 最低限サポートされているレベルで機能が現在サポートされているかどうかを確認します。 |
boolean | checkConnectivity () デバイスがネットワークに接続されていることを確認します。 |
boolean | clearErrorDialogs () デバイス UI に現在表示されているエラー ダイアログを閉じようとします。 |
void | clearLastConnectedWifiNetwork () 最後に接続された Wi-Fi ネットワークをクリアします。 |
void | clearLogcat () 蓄積された logcat データを削除します。 |
boolean | connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) Wi-Fi ネットワークに接続します。 |
boolean | connectToWifiNetwork (String wifiSsid, String wifiPsk) Wi-Fi ネットワークに接続します。 |
boolean | connectToWifiNetwork ( wifiSsidToPsk) connectToWifiNetwork ( wifiSsidToPsk) wifi ネットワークに接続します。 |
boolean | connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid) Wi-Fi ネットワークに接続します。 |
boolean | connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid) デバイスが現在ネットワークに接続されていない場合にのみ接続する |
boolean | connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk) デバイスが現在ネットワークに接続されていない場合にのみ接続する |
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) デバイス上のファイルまたはディレクトリを削除するヘルパー メソッド。 |
void | deregisterDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver) 登録された |
boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) 現在の system_server と以前の system_server |
boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit 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) 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) executeLongFastbootCommand ( envVarMap, String... cmdArgs) システム環境変数を使用して、長時間実行される fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。 |
String | executeShellCommand (String command) adb シェル コマンドを実行し、出力を |
void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
void | executeShellCommand (String command, IShellOutputReceiver receiver) 指定された adb シェル コマンドを実行し、コマンドが失敗した場合は複数回再試行します。 |
CommandResult | executeShellV2Command (String cmd) adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に取り込まれた |
CommandResult | executeShellV2Command (String cmd, OutputStream pipeToOutput) adb シェル コマンドを実行し、コマンド ステータス出力と stderr が適切に入力された |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput) adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に取り込まれた |
CommandResult | executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
CommandResult | executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。 |
CommandResult | fastbootWipePartition (String partition) デバイスのパーティションをワイプするヘルパー メソッド。 |
getActiveApexes () デバイスでアクティブ化された APEX に関する情報を取得します。 | |
getAllSettings (String namespace) 要求された名前空間のキーと値のペアを返します。 | |
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 | getCachedDeviceDescriptor (boolean shortDescriptor) デバイスが割り当てられている場合はキャッシュされた |
String[] | getChildren (String path) アクセス許可のために時々機能しない |
AbstractConnection | getConnection () デバイスに関連付けられている現在の接続。 |
DeviceFoldableState | getCurrentFoldableState () デバイスの現在の折りたたみ可能な状態を返すか、問題が発生した場合は null を返します。 |
int | getCurrentUser () 現在実行中のユーザーの ID を返します。 |
String | getDeviceClass () デバイス クラスを取得します。 |
long | getDeviceDate () エポックからのミリ秒単位でデバイスの日付を返します。 |
DeviceDescriptor | getDeviceDescriptor () デバイス情報から |
DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) デバイス情報から |
TestDeviceState | getDeviceState () デバイスの状態を取得します。 |
long | getDeviceTimeOffset (Date date) デバイスと特定の |
InputStreamSource | getEmulatorOutput () エミュレータの stdout と stderr のストリームを取得します |
Process | getEmulatorProcess () このエミュレータに対応する |
final File | getExecuteShellCommandLog () すべての |
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) 非ルート パスから |
getFoldableStates () デバイスの折りたたみ可能な状態のリストを返します。 | |
IDevice | getIDevice () 関連する ddmlib |
getInstalledPackageNames () デバイスに存在するアプリケーション パッケージ名を取得します。 | |
long | getIntProperty (String name, long defaultValue) デバイスから指定されたプロパティの整数値を返します。 |
String | getIpAddress () デバイスの IP アドレスを取得します。 |
KeyguardControllerState | getKeyguardState () キーガードの現在の状態を取得するオブジェクトを返すか、サポートされていない場合は null を返します。 |
long | getLastExpectedRebootTimeMillis () |
int | getLaunchApiLevel () デバイスの最初に起動された API レベルを取得します。 |
InputStreamSource | getLogcat () logcat データのスナップショット ストリームを取得します。 |
InputStreamSource | getLogcat (int maxBytes) キャプチャされた logcat データの最後の |
InputStreamSource | getLogcatDump () デバイスの現在の logcat のダンプを取得します。 |
InputStreamSource | getLogcatSince (long date) 指定された日付から始まるキャプチャされた logcat データのスナップショット ストリームを取得します。 |
String | getMacAddress () デバイスの MAC アドレスを返します。デバイスからのクエリに失敗した場合は null です。 |
Integer | getMainUserId () メインのユーザー ID を返します。 |
getMainlineModuleInfo () デバイスにインストールされているメインライン モジュールに関する情報を取得します。 | |
int | getMaxNumberOfRunningUsersSupported () サポートされている同時実行ユーザーの最大数を取得します。 |
int | getMaxNumberOfUsersSupported () サポートされているユーザーの最大数を取得します。 |
Process | getMicrodroidProcess () |
IDeviceStateMonitor | getMonitor () デバイスに関連付けられた |
String | getMountPoint (String mountName) マウント ポイントを返します。 |
ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) 指定されたマウントポイント パスに対応する |
getMountPointInfo () デバイスの /proc/mounts にある情報の解析済みバージョンを返します | |
TestDeviceOptions | getOptions () デバイスのテスト オプションを取得します。 |
long | getPartitionFreeSpace (String partition) デバイス パーティションの空き容量を決定するヘルパー メソッド。 |
Integer | getPrimaryUserId () プライマリ ユーザー ID を返します。 |
ProcessInfo | getProcessByName (String processName) ヘルパー メソッドは、「pidof」および「stat」コマンドを実行し、指定されたプロセスの PID とプロセス開始時刻を含む |
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) |
String | getSimOperator () 利用できない場合、またはデバイスが利用できない場合は、SIM カードのオペレーターまたは null を返します。 |
String | getSimState () 利用できない場合、またはデバイスが利用できない場合は、SIM カードの状態または null を返します。 |
getTombstones () デバイスからトゥームストーンのリストを取得して返します。 | |
long | getTotalMemory () 物理メモリの合計サイズをバイト単位で返すか、内部エラーの場合は -1 を返します |
getUninstallablePackageNames () アンインストールできるアプリケーション パッケージ名を取得します。 | |
boolean | getUseFastbootErase () デバイス上のパーティションをワイプするために fastboot erase または fastboot format を使用するかどうかを取得します。 |
int | getUserFlags (int userId) 特定のユーザーのフラグを見つけて返します。 |
getUserInfos () デバイスの useId から | |
int | getUserSerialNumber (int userId) 見つかった場合は userId に関連付けられたシリアル番号を返し、それ以外の場合は -10000 を返します。 |
IManagedTestDevice.DeviceEventResponse | handleAllocationEvent (DeviceEvent event) 指定された このデバイスを新しい割り当て状態に移行する場合と移行しない場合がある 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 パッケージをインストールします。 |
boolean | isAdbRoot () |
boolean | isAdbTcp () |
boolean | isAppEnumerationSupported () デバイス上のプラットフォームがアプリの列挙をサポートしているかどうかを確認する |
boolean | isBypassLowTargetSdkBlockSupported () デバイスのプラットフォームが、アプリのインストール時に低ターゲット sdk ブロックのバイパスをサポートしているかどうかを確認します |
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 () デバイスが |
boolean | isUserRunning (int userId) 特定のユーザーが実行中かどうかを確認します。 |
boolean | isUserSecondary (int userId) フラグに従って、指定されたユーザーがセカンダリ ユーザーであるかどうかを返します。 |
boolean | isUserVisible (int userId) 指定されたユーザーが表示されているかどうかを確認します。 |
boolean | isUserVisibleOnDisplay (int userId, int displayId) 指定されたユーザーが指定されたディスプレイに表示されているかどうかを確認します。 |
boolean | isVisibleBackgroundUsersOnDefaultDisplaySupported () |
boolean | isVisibleBackgroundUsersSupported () バックグラウンドでのユーザーの可視化をデバイスが許可するかどうかを返します。 |
boolean | isWifiEnabled () Wi-Fi が有効になっているかどうかをテストします。 |
listDisplayIds () 「dumpsys SurfaceFlinger」によって報告された、デバイスで使用可能なディスプレイ ID のリストを収集します。 | |
listDisplayIdsForStartingVisibleBackgroundUsers () | |
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 | 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) デバイスからディレクトリの内容を再帰的にプルします。 |
boolean | pullFile (String remoteFilePath, File localFile) デバイスからファイルを取得します。 |
File | pullFile (String remoteFilePath, int userId) デバイスからファイルを取得し、ローカルの一時的な |
File | pullFile (String remoteFilePath) デバイスからファイルを取得し、ローカルの一時的な |
boolean | pullFile (String remoteFilePath, File localFile, int userId) デバイスからファイルを取得します。 |
String | pullFileContents (String remoteFilePath) デバイスからファイルを取得し、コンテンツを返します。 |
File | pullFileFromExternal (String remoteFilePath) デバイスの外部ストレージからファイルを取得し、それをローカルの一時的な |
boolean | pushDir (File localFileDir, String deviceFilePath, excludedDirectories) pushDir (File localFileDir, String deviceFilePath, excludedDirectories) フィルタリングされた一部のディレクトリを除外しながら、ディレクトリの内容をデバイスに再帰的にプッシュします。 |
boolean | pushDir (File localFileDir, String deviceFilePath) ディレクトリの内容を再帰的にデバイスにプッシュします。 |
boolean | pushFile (File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded) コンテンツ プロバイダーの必要性の評価をオプションで検討できる |
boolean | pushFile (File localFile, String remoteFilePath) ファイルをデバイスにプッシュします。 |
boolean | pushString (String contents, String remoteFilePath) 文字列から作成されたファイルをデバイスにプッシュする |
void | reboot (String reason) 再起動後も保持される特定の |
void | reboot () デバイスを adb モードで再起動します。 |
void | rebootIntoBootloader () デバイスをブートローダー モードで再起動します。 |
void | rebootIntoFastbootd () デバイスを fastbootd モードで再起動します。 |
void | rebootIntoRecovery () デバイスを adb リカバリ モードで再起動します。 |
void | rebootIntoSideload () デバイスを adb sideload モードで再起動します (これはリカバリ中の特別なモードであることに注意してください) デバイスがサイドロード モードになるまでブロックする |
void | rebootIntoSideload (boolean autoReboot) デバイスを adb sideload モードで再起動します (これはリカバリ中の特別なモードであることに注意してください) デバイスがサイドロード モードになるまでブロックする |
void | rebootUntilOnline () デバイスがオンラインになるまで、つまり adb に表示されるまでのみブロックする、 |
void | rebootUntilOnline (String reason) デバイスがオンラインになるまで、つまり adb に表示されるまでのみブロックする、 |
void | rebootUserspace () デバイスのユーザー空間部分のみを再起動します。 |
void | rebootUserspaceUntilOnline () デバイスがオンラインになるまで、つまり adb に表示されるまでのみブロックする、 |
boolean | recoverDevice () デバイス通信の回復を試みます。 |
void | registerDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver) このデバイスの |
void | remountSystemWritable () デバイスのシステム パーティションを書き込み可能にします。 |
void | remountVendorWritable () デバイスのベンダー パーティションを書き込み可能にします。 |
boolean | removeAdmin (String componentName, int userId) 指定されたユーザーの指定されたデバイス管理者を削除し、成功した場合は |
void | removeOwners () 最善を尽くして、既存のデバイス プロファイル所有者をすべて削除します。 |
boolean | removeUser (int userId) 特定のユーザーをデバイスから削除します。 |
void | resetContentProviderSetup () 再度トリガーするには、コンテンツ プロバイダーのセットアップのフラグをリセットします。 |
boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) パラメータとして渡された 1 つ以上のリスナーを |
boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) インストルメンテーション テストを実行し、デバイス リカバリを提供します。 |
boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) |
boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) |
void | setConfiguration ( IConfiguration configuration) 使用中の |
void | setDate (Date date) デバイスの日付を設定します 注: デバイスで日付を設定するには root が必要です |
boolean | setDeviceOwner (String componentName, int userId) 特定のユーザーのデバイス所有者としてデバイス管理コンポーネントを設定します。 |
void | setDeviceState ( TestDeviceState deviceState) デバイスの状態を更新します。 |
void | setEmulatorOutputStream ( SizeLimitedOutputStream output) エミュレーターの場合、出力をログに記録するように |
void | setEmulatorProcess (Process p) このデバイスがエミュレータの場合、 |
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) デバイスの |
boolean | setProperty (String propKey, String propValue) デバイスに指定されたプロパティ値を設定します。 |
void | setRecovery ( IDeviceRecovery recovery) このデバイスに使用する |
void | setRecoveryMode ( ITestDevice.RecoveryMode mode) デバイスに使用する現在の回復モードを設定します。 |
void | setSetting (String namespace, String key, String value) |
void | setSetting (int userId, String namespace, String key, String value) 特定のユーザーの名前空間に設定値を追加します。 |
void | setTestLogger ( ITestLogger testLogger) |
void | setUseFastbootErase (boolean useFastbootErase) デバイスのパーティションをワイプするために fastboot erase または fastboot format を使用するかどうかを設定します。 |
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 () バグレポートを取得し、それを処理するために |
String | uninstallPackage (String packageName) デバイスから Android パッケージをアンインストールします。 |
String | uninstallPackageForUser (String packageName, int userId) 特定のユーザーのデバイスから Android パッケージをアンインストールします。 |
boolean | unlockDevice () デバイスが暗号化された状態の場合、デバイスのロックを解除します。 |
boolean | waitForBootComplete (long timeOut) デバイスの起動完了フラグが設定されるまでブロックします。 |
boolean | waitForDeviceAvailable () デバイスが応答してテストできるようになるまで待機します。 |
boolean | waitForDeviceAvailable (long waitTime) デバイスが応答してテストできるようになるまで待機します。 |
boolean | waitForDeviceAvailableInRecoverPath (long waitTime) 回復パスを考慮せずに、デバイスが応答して使用可能になるまで待機します。 |
void | waitForDeviceBootloader () fastboot 経由でデバイスが表示されるまでブロックします。 |
boolean | waitForDeviceInRecovery (long waitTime) デバイスが「adb recovery」状態になることをブロックします (これは |
boolean | waitForDeviceInSideload (long waitTime) デバイスが「adb sideload」状態になるためのブロック |
boolean | waitForDeviceNotAvailable (long waitTime) デバイスが利用できないためのブロック、つまり adb から欠落している |
void | waitForDeviceOnline () デバイスが adb 経由で表示されるまでブロックします。 |
void | waitForDeviceOnline (long waitTime) デバイスが adb 経由で表示されるまでブロックします。 |
boolean | waitForDeviceShell (long waitTime) デバイスが基本的な adb シェル コマンドに応答するまで待機します。 |
保護されたメソッド | |
---|---|
String[] | buildAdbShellCommand (String command, boolean forceExitStatusDetection) 指定された adb shell コマンド セッションと引数の OS コマンドをビルドします |
void | checkApiLevelAgainst (String feature, int strictMinLevel) |
NativeDevice.RebootDeviceAction | createRebootDeviceAction ( NativeDevice.RebootMode rebootMode, String reason) 再起動アクションの実行時に使用する |
IRunUtil | createRunUtil () |
void | doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason) adb 再起動を実行します。 |
void | ensureRuntimePermissionSupported () ランタイム権限がサポートされていない場合に例外をスローするヘルパー メソッド |
int | getApiLevelSafe () |
ITestLogger | getLogger () |
IRunUtil | getRunUtil () 使用する |
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) ローカル ファイルがリモート ファイルより新しい場合は |
void | notifyRebootEnded () すべての |
void | notifyRebootStarted () すべての |
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) setTestDeviceOptions ( deviceOptions) |
CommandResult | simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) 環境変数を使用して単純な fastboot コマンドを実行し、コマンドのステータスを報告します。 |
CommandResult | simpleFastbootCommand (long timeout, String[] fullCmd) 簡単な fastboot コマンドを実行し、コマンドのステータスを報告します。 |
boolean | waitForDeviceNotAvailable (String operationDesc, long time) デバイスが利用できなくなるのを待ちます (adb へのレポートを停止します)。 |
定数
INVALID_USER_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)
田畑
SDカード
protected static final String SD_CARD
STORAGE_EMULATED
protected static final String STORAGE_EMULATED
mオプション
protected TestDeviceOptions mOptions
パブリック コンストラクター
ネイティブデバイス
public NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
TestDevice
を作成します。
パラメーター | |
---|---|
device | IDevice : 関連するIDevice |
stateMonitor | IDeviceStateMonitor : 使用するIDeviceStateMonitor メカニズム |
allocationMonitor | IDeviceMonitor : 割り当て状態の変更を通知するIDeviceMonitor 。ヌルにすることができます |
公開メソッド
canSwitchToHeadlessSystemUser
public boolean canSwitchToHeadlessSystemUser ()
ヘッドレス SYSTEM ユーザーへの切り替えが許可されているかどうかを返します。
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
checkApiLevelAgainstNextRelease
public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
最低限サポートされているレベルで機能が現在サポートされているかどうかを確認します。このメソッドは、API レベルを上げる前に、まだリリースされていない機能を考慮に入れています。
パラメーター | |
---|---|
strictMinLevel | int : 機能をサポートする厳密な最小可能レベル。 |
戻り値 | |
---|---|
boolean | レベルがサポートされている場合は true。それ以外の場合は偽。 |
スロー | |
---|---|
DeviceNotAvailableException |
チェック接続性
public boolean checkConnectivity ()
デバイスがネットワークに接続されていることを確認します。
戻り値 | |
---|---|
boolean | デバイスのネットワーク接続が機能している場合はtrue 、そうでない場合はfalse 。 |
スロー | |
---|---|
DeviceNotAvailableException |
clearErrorDialogs
public boolean clearErrorDialogs ()
デバイス UI に現在表示されているエラー ダイアログを閉じようとします。
戻り値 | |
---|---|
boolean | ダイアログが存在しない場合、またはダイアログが正常にクリアされた場合はtrue 。それ以外の場合はfalse 。 |
スロー | |
---|---|
DeviceNotAvailableException |
clearLastConnectedWifiNetwork
public void clearLastConnectedWifiNetwork ()
最後に接続された Wi-Fi ネットワークをクリアします。これは、デバイスの再起動後に前のテストで使用された wifi ネットワークへの接続を回避するために、新しい呼び出しを開始するときに呼び出す必要があります。
clearLogcat
public void clearLogcat ()
蓄積された logcat データを削除します。
これは、ITestDevice#getLogcat()
が特定の時点以降 (新しいデバイス ビルドのフラッシュ後など) に生成されたログ データのみを返すようにしたい場合に役立ちます。 connectToWifiNetwork
public boolean connectToWifiNetwork (wifiSsidToPsk, boolean scanSsid)
Wi-Fi ネットワークに接続します。
wifiSsidToPsk マップで指定された wifi ネットワークの 1 つとの接続が成功するまで、wifi をオンにしてブロックします。接続が確立されると、インスタンスはITestDevice#disconnectFromWifi()
またはITestDevice#clearLastConnectedWifiNetwork()
が呼び出されるまで、再起動のたびに接続の復元を試みます。
パラメーター | |
---|---|
wifiSsidToPsk | |
scanSsid | boolean : このネットワークの非表示の SSID をスキャンするかどうか。 |
戻り値 | |
---|---|
boolean | WiFi ネットワークに正常に接続されている場合はtrue 。それ以外の場合はfalse |
スロー | |
---|---|
DeviceNotAvailableException |
connectToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid, String wifiPsk)
Wi-Fi ネットワークに接続します。
wifi をオンにし、指定された wifi ネットワークへの接続が成功するまでブロックします。接続が確立されると、インスタンスはITestDevice#disconnectFromWifi()
またはITestDevice#clearLastConnectedWifiNetwork()
が呼び出されるまで、再起動のたびに接続の復元を試みます。パラメーター | |
---|---|
wifiSsid | String : 接続先の wifi ssid |
wifiPsk | String : PSK パスフレーズ、または暗号化されていない場合は null |
戻り値 | |
---|---|
boolean | WiFi ネットワークに正常に接続されている場合はtrue 。それ以外の場合はfalse |
スロー | |
---|---|
DeviceNotAvailableException |
connectToWifiNetwork
public boolean connectToWifiNetwork (wifiSsidToPsk)
Wi-Fi ネットワークに接続します。
wifiSsidToPsk マップで指定された wifi ネットワークの 1 つとの接続が成功するまで、wifi をオンにしてブロックします。接続が確立されると、インスタンスはITestDevice#disconnectFromWifi()
またはITestDevice#clearLastConnectedWifiNetwork()
が呼び出されるまで、再起動のたびに接続の復元を試みます。
パラメーター | |
---|---|
wifiSsidToPsk |
戻り値 | |
---|---|
boolean | WiFi ネットワークに正常に接続されている場合はtrue 。それ以外の場合はfalse |
スロー | |
---|---|
DeviceNotAvailableException |
connectToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid)
Wi-Fi ネットワークに接続します。
wifi をオンにし、指定された wifi ネットワークへの接続が成功するまでブロックします。接続が確立されると、インスタンスはITestDevice#disconnectFromWifi()
またはITestDevice#clearLastConnectedWifiNetwork()
が呼び出されるまで、再起動のたびに接続の復元を試みます。パラメーター | |
---|---|
wifiSsid | String : 接続先の wifi ssid |
wifiPsk | String : PSK パスフレーズ、または暗号化されていない場合は null |
scanSsid | boolean : このネットワークの隠し SSID をスキャンするかどうか。 |
戻り値 | |
---|---|
boolean | WiFi ネットワークに正常に接続されている場合はtrue 。それ以外の場合はfalse |
スロー | |
---|---|
DeviceNotAvailableException |
connectToWifiNetworkIfNeeded
public boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid)
デバイスが現在ネットワークに接続されていない場合にのみ接続するconnectToWifiNetwork(String, String)
のバリアントです。
パラメーター | |
---|---|
scanSsid | boolean : このネットワークの非表示の SSID をスキャンするかどうか |
戻り値 | |
---|---|
boolean | WiFi ネットワークに正常に接続されている場合はtrue 。それ以外の場合はfalse |
スロー | |
---|---|
DeviceNotAvailableException |
connectToWifiNetworkIfNeeded
public boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk)
デバイスが現在ネットワークに接続されていない場合にのみ接続するconnectToWifiNetwork(String, String)
のバリアントです。
戻り値 | |
---|---|
boolean | WiFi ネットワークに正常に接続されている場合はtrue 。それ以外の場合はfalse |
スロー | |
---|---|
DeviceNotAvailableException |
ユーザーを作成
public int createUser (String name, boolean guest, boolean ephemeral)
指定された名前と提供されたフラグでユーザーを作成します
パラメーター | |
---|---|
name | String : デバイスで作成するユーザーの |
guest | boolean : 作成時にユーザー フラグ --guest を有効にします |
ephemeral | boolean : 作成中にユーザーフラグ --ephemeral を有効にします |
戻り値 | |
---|---|
int | 作成したユーザーのID |
スロー | |
---|---|
DeviceNotAvailableException |
ユーザーを作成
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 |
ユーザーを作成
public int createUser (String name)
指定された名前とデフォルトのフラグ 0 を持つユーザーを作成します。
パラメーター | |
---|---|
name | String : デバイスで作成するユーザーの |
戻り値 | |
---|---|
int | 作成されたユーザー ID の整数 |
スロー | |
---|---|
DeviceNotAvailableException |
createUserNoThrow
public int createUserNoThrow (String name)
指定された名前とデフォルトのフラグ 0 を持つユーザーを作成します。
パラメーター | |
---|---|
name | String : デバイスで作成するユーザーの |
戻り値 | |
---|---|
int | 作成されたユーザー ID の整数またはエラーの場合は -1。 |
スロー | |
---|---|
DeviceNotAvailableException |
ファイルを削除する
public void deleteFile (String deviceFilePath)
デバイス上のファイルまたはディレクトリを削除するヘルパー メソッド。
パラメーター | |
---|---|
deviceFilePath | String : デバイス上のファイルの絶対パス。 |
スロー | |
---|---|
DeviceNotAvailableException |
deregisterDeviceActionReceiver
public void deregisterDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)
登録されたIDeviceActionReceiver
を削除します。
パラメーター | |
---|---|
deviceActionReceiver | IDeviceActionReceiver : 削除されるIDeviceActionReceiver 。 |
deviceSoftRestarted
public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
現在の system_server と以前の system_server ProcessInfo
を比較して、デバイスがソフト リスタートしたかどうかを確認するヘルパー メソッド。 getProcessByName(String)
を使用してProcessInfo
を取得します。
パラメーター | |
---|---|
prevSystemServerProcess | ProcessInfo : 以前の system_server プロセスProcessInfo 。 |
戻り値 | |
---|---|
boolean | デバイスのソフト リスタートの場合はtrue |
スロー | |
---|---|
DeviceNotAvailableException |
deviceSoftRestartedSince
public boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
デバイスとそのERROR(/TimeUnit)
からのエポック以降の UTC 時間以降にデバイスがソフト リスタートしたかどうかを確認するヘルパー メソッド。ソフト再起動は、デバイスのハード再起動以外で再起動された system_server を指します (例: 要求された再起動)。ミリ秒単位の現在のデバイス utcEpochTime は、メソッドgetDeviceDate()
で取得できます。
パラメーター | |
---|---|
utcEpochTime | long : エポックからの秒単位のデバイス時間。 |
timeUnit | TimeUnit : 指定された utcEpochTime の時間単位TimeUnit 。 |
戻り値 | |
---|---|
boolean | デバイスのソフト リスタートの場合はtrue |
スロー | |
---|---|
DeviceNotAvailableException |
disableAdbRoot
public boolean disableAdbRoot ()
adb ルートをオフにします。
adb root を無効にすると、デバイスが adb から切断される可能性があります。このメソッドは、デバイスが使用可能になるまでブロックされます。戻り値 | |
---|---|
boolean | 成功した場合はtrue 。 |
スロー | |
---|---|
DeviceNotAvailableException |
キーガードを無効にする
public void disableKeyguard ()
キーガードを無効にしようとします。
最初に、入力ディスパッチの準備が整うのを待ちます。これは、デバイスが BOOT_COMPLETE を報告するのとほぼ同時に発生します。これは、現在のフレームワークの実装では競合状態が発生することがあるため、明らかに非同期です。次に、キーガードを解除するコマンドが送信されます (安全でないものでのみ機能します)。
スロー | |
---|---|
DeviceNotAvailableException |
disableNetworkMonitor
public boolean disableNetworkMonitor ()
デバイスでのネットワーク監視を無効にします。
戻り値 | |
---|---|
boolean | 監視が正常に無効化された場合はtrue 。失敗した場合はfalse 。 |
スロー | |
---|---|
DeviceNotAvailableException |
wifiから切断
public boolean disconnectFromWifi ()
Wi-Fi ネットワークから切断します。
既知のネットワーク リストからすべてのネットワークを削除し、wifi を無効にします。戻り値 | |
---|---|
boolean | WiFi ネットワークから正常に切断された場合はtrue 。切断に失敗した場合はfalse 。 |
スロー | |
---|---|
DeviceNotAvailableException |
dosFileExist
public boolean doesFileExist (String deviceFilePath, int userId)
特定のユーザーのファイルがデバイス上に存在するかどうかを判断するヘルパー メソッド。
パラメーター | |
---|---|
deviceFilePath | String : チェックするデバイス上のファイルの絶対パス |
userId | int : ファイルの存在を確認する対象のユーザー ID |
戻り値 | |
---|---|
boolean | ファイルが存在する場合はtrue 、そうでない場合はfalse 。 |
スロー | |
---|---|
DeviceNotAvailableException |
dosFileExist
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 root を有効にすると、デバイスが adb から切断される場合があります。このメソッドは、デバイスが使用可能になるまでブロックされます。戻り値 | |
---|---|
boolean | 成功した場合はtrue 。 |
スロー | |
---|---|
DeviceNotAvailableException |
enableNetworkMonitor
public boolean enableNetworkMonitor ()
デバイスでネットワーク監視を有効にします。
戻り値 | |
---|---|
boolean | 監視が正常に有効化されている場合はtrue 。失敗した場合はfalse 。 |
スロー | |
---|---|
DeviceNotAvailableException |
executeAdbCommand
public String executeAdbCommand (long timeout, String... cmdArgs)
指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。
executeShellCommand(String)
より優れた障害検出とパフォーマンスを提供するため、可能な限り代わりに使用する必要があります。
パラメーター | |
---|---|
timeout | long : デバイスが応答していないと見なされるまでのミリ秒単位の時間。タイムアウトなしの場合は 0L |
cmdArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
スロー | |
---|---|
DeviceNotAvailableException |
executeAdbCommand
public String executeAdbCommand (long timeout,envMap, String... cmdArgs)
指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。
executeShellCommand(String)
より優れた障害検出とパフォーマンスを提供するため、可能な限り代わりに使用する必要があります。
パラメーター | |
---|---|
timeout | long : デバイスが応答していないと見なされるまでのミリ秒単位の時間。タイムアウトなしの場合は 0L |
envMap | |
cmdArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
スロー | |
---|---|
DeviceNotAvailableException |
executeAdbCommand
public String executeAdbCommand (String... cmdArgs)
システムコマンドとしてadbコマンドを実行するヘルパーメソッド。
executeShellCommand(String)
より優れた障害検出とパフォーマンスを提供するため、可能な限り代わりに使用する必要があります。パラメーター | |
---|---|
cmdArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
スロー | |
---|---|
DeviceNotAvailableException |
executeFastbootCommand
public CommandResult executeFastbootCommand (String... cmdArgs)
fastboot コマンドをシステム コマンドとして実行するヘルパー メソッドで、デフォルトのタイムアウトは 2 分です。
デバイスが既に fastboot モードになっている場合に使用されると予想されます。
パラメーター | |
---|---|
cmdArgs | String : 実行する fastboot コマンドと引数 |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
スロー | |
---|---|
DeviceNotAvailableException |
executeFastbootCommand
public CommandResult executeFastbootCommand (long timeout, String... cmdArgs)
fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。
デバイスが既に fastboot モードになっている場合に使用されると予想されます。パラメーター | |
---|---|
timeout | long : コマンドの有効期限が切れるまでのミリ秒単位の時間 |
cmdArgs | String : 実行する fastboot コマンドと引数 |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
スロー | |
---|---|
DeviceNotAvailableException |
executeLongFastboot コマンド
public CommandResult executeLongFastbootCommand (String... cmdArgs)
長時間実行される fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。
より長いタイムアウトを使用することを除いて、executeFastbootCommand(String)
と同じです。パラメーター | |
---|---|
cmdArgs | String : 実行する fastboot コマンドと引数 |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
スロー | |
---|---|
DeviceNotAvailableException |
executeLongFastboot コマンド
public CommandResult executeLongFastbootCommand (envVarMap, String... cmdArgs)
システム環境変数を使用して、長時間実行される fastboot コマンドをシステム コマンドとして実行するヘルパー メソッド。
より長いタイムアウトを使用することを除いて、 executeFastbootCommand(String)
と同じです。
パラメーター | |
---|---|
envVarMap | |
cmdArgs | String : 実行する fastboot コマンドと引数 |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public String executeShellCommand (String command)
adb シェル コマンドを実行し、出力をERROR(/String)
として返すヘルパー メソッド。
パラメーター | |
---|---|
command | String : 実行する adb shell コマンド |
戻り値 | |
---|---|
String | シェル出力 |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
コマンドの動作を制御するためのパラメーターを追加して、adb shell コマンドを実行します。
パラメーター | |
---|---|
command | String : 実行する adb shell コマンド |
receiver | IShellOutputReceiver : シェル出力を送信するIShellOutputReceiver 。 |
maxTimeToOutputShellResponse | long : コマンドが応答を出力しない最大時間。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse の単位 |
retryAttempts | int : 例外が原因で失敗した場合にコマンドを再試行する最大回数。 retryAttempts成功しない場合、DeviceNotResponsiveException がスローされます。 |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
パラメーター | |
---|---|
command | String : the adb shell command to run |
receiver | IShellOutputReceiver : the IShellOutputReceiver to direct shell output to. |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
maxTimeToOutputShellResponse | long : the maximum amount of time during which the command is allowed to not output any response; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver)
Executes the given adb shell command, retrying multiple times if command fails.
A simpler form ofexecuteShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
with default values.パラメーター | |
---|---|
command | String : the adb shell command to run |
receiver | IShellOutputReceiver : the IShellOutputReceiver to direct shell output to. |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd)
Helper method which executes a adb shell command and returns the results as a CommandResult
properly populated with the command status output, stdout and stderr.
パラメーター | |
---|---|
cmd | String : The command that should be run. |
戻り値 | |
---|---|
CommandResult | The result in CommandResult . |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, OutputStream pipeToOutput)
Helper method which executes an adb shell command and returns the results as a CommandResult
properly populated with the command status output and stderr. stdout is directed to the specified stream.
パラメーター | |
---|---|
cmd | String : The command that should be run. |
pipeToOutput | OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null. |
戻り値 | |
---|---|
CommandResult | The result in CommandResult . |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput)
Helper method which executes an adb shell command and returns the results as a CommandResult
properly populated with the command status output, stdout and stderr.
パラメーター | |
---|---|
cmd | String : The command that should be run. |
pipeAsInput | File : A ERROR(/File) that will be piped as input to the command, or null. |
戻り値 | |
---|---|
CommandResult | The result in CommandResult . |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
パラメーター | |
---|---|
cmd | String : the adb shell command to run |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
戻り値 | |
---|---|
CommandResult |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit)
Executes a adb shell command, with more parameters to control command behavior.
パラメーター | |
---|---|
cmd | String : the adb shell command to run |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
戻り値 | |
---|---|
CommandResult |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
パラメーター | |
---|---|
cmd | String : the adb shell command to run |
pipeAsInput | File : A ERROR(/File) that will be piped as input to the command, or null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null. |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
戻り値 | |
---|---|
CommandResult |
スロー | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
パラメーター | |
---|---|
cmd | String : the adb shell command to run |
pipeAsInput | File : A ERROR(/File) that will be piped as input to the command, or null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null. |
pipeToError | OutputStream : ERROR(/OutputStream) where the std error will be redirected, or null. |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
戻り値 | |
---|---|
CommandResult |
スロー | |
---|---|
DeviceNotAvailableException |
fastbootWipePartition
public CommandResult fastbootWipePartition (String partition)
Helper method which wipes a partition for the device.
IfgetUseFastbootErase()
is true
, then fastboot erase will be used to wipe the partition. The device must then create a filesystem the next time the device boots. Otherwise, fastboot format is used which will create a new filesystem on the device. Expected to be used when device is already in fastboot mode.パラメーター | |
---|---|
partition | String : the partition to wipe |
戻り値 | |
---|---|
CommandResult | the CommandResult containing output of command |
スロー | |
---|---|
DeviceNotAvailableException |
getActiveApexes
publicgetActiveApexes ()
Fetch the information about APEXes activated on the device.
戻り値 | |
---|---|
ERROR(/Set) of ApexInfo currently activated on the device |
スロー | |
---|---|
DeviceNotAvailableException |
getAllSettings
publicgetAllSettings (String namespace)
Return key value pairs of requested namespace.
パラメーター | |
---|---|
namespace | String : must be one of {"system", "secure", "global"} |
戻り値 | |
---|---|
the map of key value pairs. Null if namespace is not supported. |
スロー | |
---|---|
DeviceNotAvailableException |
getAllocationState
public DeviceAllocationState getAllocationState ()
Return the current allocation state of device
戻り値 | |
---|---|
DeviceAllocationState |
getAndroidId
public String getAndroidId (int userId)
Find and return the android-id associated to a userId, null if not found.
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
String |
スロー | |
---|---|
DeviceNotAvailableException |
getAndroidIds
publicgetAndroidIds ()
Create a Map of android ids found matching user ids. There is no insurance that each user id will found an android id associated in this function so some user ids may match null.
戻り値 | |
---|---|
Map of android ids found matching user ids. |
スロー | |
---|---|
DeviceNotAvailableException |
getApiLevel
public int getApiLevel ()
Get the device API Level. Defaults to UNKNOWN_API_LEVEL
.
戻り値 | |
---|---|
int | an integer indicating the API Level of device |
スロー | |
---|---|
DeviceNotAvailableException |
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
Fetch information about a package installed on device.
パラメーター | |
---|---|
packageName | String |
戻り値 | |
---|---|
PackageInfo | the PackageInfo or null if information could not be retrieved |
スロー | |
---|---|
DeviceNotAvailableException |
getAppPackageInfos
publicgetAppPackageInfos ()
Fetch information of packages installed on the device.
戻り値 | |
---|---|
ERROR(/List) of PackageInfo s installed on the device. |
スロー | |
---|---|
DeviceNotAvailableException |
getBasebandVersion
public String getBasebandVersion ()
Convenience method to get baseband (radio) version of this device. Getting the radio version is device specific, so it might not return the correct information for all devices. This method relies on the gsm.version.baseband propery to return the correct version information. This is not accurate for some CDMA devices and the version returned here might not match the version reported from fastboot and might not return the version for the CDMA radio. TL;DR this method only reports accurate version if the gsm.version.baseband property is the same as the version returned by fastboot getvar version-baseband
.
戻り値 | |
---|---|
String | the ERROR(/String) baseband version or null if it cannot be determined (device has no radio or version string cannot be read) |
スロー | |
---|---|
DeviceNotAvailableException |
getBattery
public Integer getBattery ()
Returns the current battery level of a device or Null if battery level unavailable.
戻り値 | |
---|---|
Integer |
getBooleanProperty
public boolean getBooleanProperty (String name, boolean defaultValue)
Returns boolean value of the given property.
パラメーター | |
---|---|
name | String : the property name |
defaultValue | boolean : default value to return if property is empty or doesn't exist. |
戻り値 | |
---|---|
boolean | true if the property has value "1" , "y" , "yes" , "on" , or "true" , false if the property has value of "0" , "n" , "no" , "off" , "false" , or defaultValue otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
getBootHistory
publicgetBootHistory ()
Helper method collects the boot history map with boot time and boot reason.
戻り値 | |
---|---|
Map of boot time (UTC time in second since Epoch) and boot reason |
スロー | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
publicgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
Helper method collects the boot history map with boot time and boot reason since the given time since epoch from device and the time unit specified. The current device utcEpochTime in Millisecond can be obtained by method getDeviceDate()
.
パラメーター | |
---|---|
utcEpochTime | long : the device time since Epoch. |
timeUnit | TimeUnit : the time unit TimeUnit . |
戻り値 | |
---|---|
Map of boot time (UTC time in second since Epoch) and boot reason |
スロー | |
---|---|
DeviceNotAvailableException |
getBootloaderVersion
public String getBootloaderVersion ()
Convenience method to get the bootloader version of this device.
Will attempt to retrieve bootloader version from the device's current state. (ie if device is in fastboot mode, it will attempt to retrieve version from fastboot)戻り値 | |
---|---|
String | the ERROR(/String) bootloader version or null if it cannot be found |
スロー | |
---|---|
DeviceNotAvailableException |
getBugreport
public InputStreamSource getBugreport ()
Retrieves a bugreport from the device.
The implementation of this is guaranteed to continue to work on a device without an sdcard (or where the sdcard is not yet mounted).
戻り値 | |
---|---|
InputStreamSource | An InputStreamSource which will produce the bugreport contents on demand. In case of failure, the InputStreamSource will produce an empty ERROR(/InputStream) . |
getBugreportz
public InputStreamSource getBugreportz ()
Retrieves a bugreportz from the device. Zip format bugreport contains the main bugreport and other log files that are useful for debugging.
Only supported for 'adb version' > 1.0.36
戻り値 | |
---|---|
InputStreamSource | a InputStreamSource of the zip file containing the bugreportz, return null in case of failure. |
getBuildAlias
public String getBuildAlias ()
Retrieve the alias of the build that the device is currently running.
Build alias is usually a more readable string than build id (typically a number for Nexus builds). For example, final Android 4.2 release has build alias JDQ39, and build id 573038
戻り値 | |
---|---|
String | the build alias or fall back to build id if it could not be retrieved |
スロー | |
---|---|
DeviceNotAvailableException |
getBuildFlavor
public String getBuildFlavor ()
Retrieve the build flavor for the device.
戻り値 | |
---|---|
String | the build flavor or null if it could not be retrieved |
スロー | |
---|---|
DeviceNotAvailableException |
getBuildId
public String getBuildId ()
Retrieve the build the device is currently running.
戻り値 | |
---|---|
String | the build id or IBuildInfo#UNKNOWN_BUILD_ID if it could not be retrieved |
スロー | |
---|---|
DeviceNotAvailableException |
getBuildSigningKeys
public String getBuildSigningKeys ()
Returns the key type used to sign the device image
Typically Android devices may be signed with test-keys (like in AOSP) or release-keys (controlled by individual device manufacturers)
戻り値 | |
---|---|
String | The signing key if found, null otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
getCachedDeviceDescriptor
public DeviceDescriptor getCachedDeviceDescriptor ()
Returns a cached DeviceDescriptor
if the device is allocated, otherwise returns the current DeviceDescriptor
.
戻り値 | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
Returns a cached DeviceDescriptor
if the device is allocated, otherwise returns the current DeviceDescriptor
.
パラメーター | |
---|---|
shortDescriptor | boolean : Whether or not to limit descriptor to bare minimum info |
戻り値 | |
---|---|
DeviceDescriptor |
getChildren
public String[] getChildren (String path)
Alternative to using IFileEntry
that sometimes won't work because of permissions.
パラメーター | |
---|---|
path | String : is the path on the device where to do the search |
戻り値 | |
---|---|
String[] | Array of string containing all the file in a path on the device. |
スロー | |
---|---|
DeviceNotAvailableException |
getConnection
public AbstractConnection getConnection ()
The current connection associated with the device.
戻り値 | |
---|---|
AbstractConnection |
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
Returns the current foldable state of the device or null if some issues occurred.
戻り値 | |
---|---|
DeviceFoldableState |
スロー | |
---|---|
DeviceNotAvailableException |
getCurrentUser
public int getCurrentUser ()
Return the id of the current running user. In case of error, return -10000.
戻り値 | |
---|---|
int |
スロー | |
---|---|
DeviceNotAvailableException |
getDeviceClass
public String getDeviceClass ()
Get the device class.
戻り値 | |
---|---|
String | the ERROR(/String) device class. |
getDeviceDate
public long getDeviceDate ()
Return the date of the device in millisecond since epoch.
戻り値 | |
---|---|
long | the date of the device in epoch format. |
スロー | |
---|---|
DeviceNotAvailableException |
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor ()
Return a DeviceDescriptor
from the device information to get info on it without passing the actual device object.
戻り値 | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
Return a DeviceDescriptor
from the device information to get info on it without passing the actual device object.
パラメーター | |
---|---|
shortDescriptor | boolean : Whether or not to limit descriptor to bare minimum info |
戻り値 | |
---|---|
DeviceDescriptor |
getDeviceTimeOffset
public long getDeviceTimeOffset (Date date)
Helper to get the time difference between the device and a given ERROR(/Date)
. Use Epoch time internally.
パラメーター | |
---|---|
date | Date |
戻り値 | |
---|---|
long | the difference in milliseconds |
スロー | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public InputStreamSource getEmulatorOutput ()
Get the stream of emulator stdout and stderr
戻り値 | |
---|---|
InputStreamSource | emulator output |
getEmulatorProcess
public Process getEmulatorProcess ()
Return the ERROR(/Process)
corresponding to this emulator.
戻り値 | |
---|---|
Process | the ERROR(/Process) or null |
getExecuteShellCommandLog
public final File getExecuteShellCommandLog ()
The log that contains all the executeShellCommand(String)
logs.
戻り値 | |
---|---|
File |
getExternalStoreFreeSpace
public long getExternalStoreFreeSpace ()
Helper method to determine amount of free space on device external storage.
戻り値 | |
---|---|
long | the amount of free space in KB |
スロー | |
---|---|
DeviceNotAvailableException |
getFastbootPath
public String getFastbootPath ()
Returns the path of the fastboot binary being used. Still requires isFastbootEnabled()
to be true, to have fastboot functions enabled.
戻り値 | |
---|---|
String |
getFastbootProductType
public String getFastbootProductType ()
Convenience method to get the product type of this device when its in fastboot mode.
This method should only be used if device should be in fastboot. Its a bit safer variant than the genericgetProductType()
method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.戻り値 | |
---|---|
String | the ERROR(/String) product type name or null if it cannot be determined |
スロー | |
---|---|
DeviceNotAvailableException |
getFastbootProductVariant
public String getFastbootProductVariant ()
Convenience method to get the product type of this device when its in fastboot mode.
This method should only be used if device should be in fastboot. Its a bit safer variant than the genericgetProductType()
method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.戻り値 | |
---|---|
String | the ERROR(/String) product type name or null if it cannot be determined |
スロー | |
---|---|
DeviceNotAvailableException |
getFastbootシリアル番号
public String getFastbootSerialNumber ()
Returns the fastboot mode serial number.
戻り値 | |
---|---|
String |
getFastbootVariable
public String getFastbootVariable (String variableName)
Retrieve the given fastboot variable value from the device.
パラメーター | |
---|---|
variableName | String : the variable name |
戻り値 | |
---|---|
String | the property value or null if it does not exist |
スロー | |
---|---|
DeviceNotAvailableException |
getFastbootVersion
public String getFastbootVersion ()
Returns the version string of the fastboot binary being used. Or null if something goes wrong.
戻り値 | |
---|---|
String |
getFileEntry
public IFileEntry getFileEntry (String path)
Retrieve a reference to a remote file on device.
パラメーター | |
---|---|
path | String : the file path to retrieve. Can be an absolute path or path relative to '/'. (ie both "/system" and "system" syntax is supported) |
戻り値 | |
---|---|
IFileEntry | the IFileEntry or null if file at given path cannot be found |
スロー | |
---|---|
DeviceNotAvailableException |
getFileEntry
public IFileEntry getFileEntry (FileListingService.FileEntry entry)
Unofficial helper to get a FileEntry
from a non-root path. FIXME: Refactor the FileEntry system to have it available from any path. (even non root).
パラメーター | |
---|---|
entry | FileListingService.FileEntry : a FileEntry not necessarily root as Ddmlib requires. |
戻り値 | |
---|---|
IFileEntry | a FileEntryWrapper representing the FileEntry. |
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getFoldableStates
publicgetFoldableStates ()
Returns the list of foldable states on the device. Can be obtained with "cmd device_state print-states".
戻り値 | |
---|---|
スロー | |
---|---|
DeviceNotAvailableException |
getIDevice
public IDevice getIDevice ()
Returns a reference to the associated ddmlib IDevice
.
IDevice
may be allocated by DDMS each time the device disconnects and reconnects from adb. Thus callers should not keep a reference to the IDevice
, because that reference may become stale.戻り値 | |
---|---|
IDevice | the IDevice |
getInstalledPackageNames
publicgetInstalledPackageNames ()
Fetch the application package names present on the device.
戻り値 | |
---|---|
ERROR(/Set) of ERROR(/String) package names currently installed on the device. |
スロー | |
---|---|
DeviceNotAvailableException |
getIntProperty
public long getIntProperty (String name, long defaultValue)
Returns integer value of the given property from the device.
パラメーター | |
---|---|
name | String : the property name |
defaultValue | long : default value to return if property is empty or doesn't exist. |
戻り値 | |
---|---|
long | the property value or defaultValue if the property is empty, doesn't exist, or doesn't have an integer value. |
スロー | |
---|---|
DeviceNotAvailableException |
getIpAddress
public String getIpAddress ()
Gets the device's IP address.
戻り値 | |
---|---|
String | the device's IP address, or null if device has no IP address |
スロー | |
---|---|
DeviceNotAvailableException |
getKeyguardState
public KeyguardControllerState getKeyguardState ()
Return an object to get the current state of the keyguard or null if not supported.
戻り値 | |
---|---|
KeyguardControllerState | a KeyguardControllerState containing a snapshot of the state of the keyguard and returns Null if the Keyguard query is not supported. |
スロー | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public long getLastExpectedRebootTimeMillis ()
Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by ERROR(/System#currentTimeMillis())
.
戻り値 | |
---|---|
long |
getLaunchApiLevel
public int getLaunchApiLevel ()
Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL
.
戻り値 | |
---|---|
int | an integer indicating the first launched API Level of device |
スロー | |
---|---|
DeviceNotAvailableException |
getLogcat
public InputStreamSource getLogcat ()
Grabs a snapshot stream of the logcat data.
Works in two modes:
TestDeviceOptions.getMaxLogcatDataSize()
bytes of the current contents of the background logcat capture戻り値 | |
---|---|
InputStreamSource |
getLogcat
public InputStreamSource getLogcat (int maxBytes)
Grabs a snapshot stream of the last maxBytes
of captured logcat data.
Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat()
snapshot.
パラメーター | |
---|---|
maxBytes | int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory |
戻り値 | |
---|---|
InputStreamSource |
getLogcatDump
public InputStreamSource getLogcatDump ()
Get a dump of the current logcat for device. Unlike getLogcat()
, this method will always return a static dump of the logcat.
Has the disadvantage that nothing will be returned if device is not reachable.
戻り値 | |
---|---|
InputStreamSource | a InputStreamSource of the logcat data. An empty stream is returned if fail to capture logcat data. |
getLogcatSince
public InputStreamSource getLogcatSince (long date)
Grabs a snapshot stream of captured logcat data starting the date provided. The time on the device should be used getDeviceDate()
.
パラメーター | |
---|---|
date | long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s') |
戻り値 | |
---|---|
InputStreamSource |
getMacAddress
public String getMacAddress ()
Returns the MAC address of the device, null if it fails to query from the device.
戻り値 | |
---|---|
String |
getMainUserId
public Integer getMainUserId ()
Returns the main user id.
戻り値 | |
---|---|
Integer | the userId of the main user if there is one, and null if there is no main user. |
スロー | |
---|---|
DeviceNotAvailableException |
getMainlineModuleInfo
publicgetMainlineModuleInfo ()
Get the information about the mainline modules installed on the device.
戻り値 | |
---|---|
ERROR(/Set) of ERROR(/String) mainline modules currently installed on the device. |
スロー | |
---|---|
DeviceNotAvailableException |
getMaxNumberOfRunningUsersSupported
public int getMaxNumberOfRunningUsersSupported ()
Get the maximum number of supported simultaneously running users. Defaults to 0.
戻り値 | |
---|---|
int | an integer indicating the number of simultaneously running users |
スロー | |
---|---|
DeviceNotAvailableException |
getMaxNumberOfUsersSupported
public int getMaxNumberOfUsersSupported ()
Get the maximum number of supported users. Defaults to 0.
戻り値 | |
---|---|
int | an integer indicating the number of supported users |
スロー | |
---|---|
DeviceNotAvailableException |
getMicrodroidProcess
public Process getMicrodroidProcess ()
戻り値 | |
---|---|
Process | Returns the Process of the Microdroid VM. If TestDevice is not a Microdroid, returns null. |
getMonitor
public IDeviceStateMonitor getMonitor ()
Return the IDeviceStateMonitor
associated with device.
戻り値 | |
---|---|
IDeviceStateMonitor |
getMountPoint
public String getMountPoint (String mountName)
マウント ポイントを返します。
IDevice
にキャッシュされた情報が利用できない場合は、デバイスを直接照会します。 TODO: この動作をIDevice#getMountPoint(String)
に移動パラメーター | |
---|---|
mountName | String : マウント ポイントの名前 |
戻り値 | |
---|---|
String | マウントポイントまたはnull |
getMountPointInfo
public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
Returns a MountPointInfo
corresponding to the specified mountpoint path, or null
if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.
パラメーター | |
---|---|
mountpoint | String |
戻り値 | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
スロー | |
---|---|
DeviceNotAvailableException |
getMountPointInfo
publicgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
戻り値 | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
スロー | |
---|---|
DeviceNotAvailableException |
getOptions
public TestDeviceOptions getOptions ()
Fetch the test options for the device.
戻り値 | |
---|---|
TestDeviceOptions | TestDeviceOptions related to the device under test. |
getPartitionFreeSpace
public long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
パラメーター | |
---|---|
partition | String |
戻り値 | |
---|---|
long | the amount of free space in KB |
スロー | |
---|---|
DeviceNotAvailableException |
getPrimaryUserId
public Integer getPrimaryUserId ()
Returns the primary user id.
戻り値 | |
---|---|
Integer | the userId of the primary user if there is one, and null if there is no primary user. |
スロー | |
---|---|
DeviceNotAvailableException |
getProcessByName
public ProcessInfo getProcessByName (String processName)
Helper method runs the "pidof" and "stat" command and returns ProcessInfo
object with PID and process start time of the given process.
パラメーター | |
---|---|
processName | String : the proces name String. |
戻り値 | |
---|---|
ProcessInfo | ProcessInfo of given processName |
スロー | |
---|---|
DeviceNotAvailableException |
getProcessPid
public String getProcessPid (String process)
Returns the pid of the service or null if something went wrong.
パラメーター | |
---|---|
process | String : The proces name String. |
戻り値 | |
---|---|
String |
スロー | |
---|---|
DeviceNotAvailableException |
getProductType
public String getProductType ()
Convenience method to get the product type of this device.
This method will work if device is in either adb or fastboot mode.戻り値 | |
---|---|
String | the ERROR(/String) product type name. Will not be null |
スロー | |
---|---|
DeviceNotAvailableException |
getProductVariant
public String getProductVariant ()
Convenience method to get the product variant of this device.
This method will work if device is in either adb or fastboot mode.戻り値 | |
---|---|
String | the ERROR(/String) product variant name or null if it cannot be determined |
スロー | |
---|---|
DeviceNotAvailableException |
getProperty
public String getProperty (String name)
Retrieve the given property value from the device.
パラメーター | |
---|---|
name | String : the property name |
戻り値 | |
---|---|
String | the property value or null if it does not exist |
スロー | |
---|---|
DeviceNotAvailableException |
getRecoveryMode
public ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
戻り値 | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getScreenshot
public InputStreamSource getScreenshot (String format)
Grabs a screenshot from the device. Recommended to use getScreenshot(format) instead with JPEG encoding for smaller size
パラメーター | |
---|---|
format | String : supported PNG, JPEG |
戻り値 | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in format, or null if the screenshot was not successful. |
スロー | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (long displayId)
Grabs a screenshot from the device given display id. Format is PNG.
TODO: extend the implementations above to support 'format' and 'rescale'
パラメーター | |
---|---|
displayId | long : the display id of the screen to get screenshot from. |
戻り値 | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in format, or null if the screenshot was not successful. |
スロー | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (String format, boolean rescale)
Grabs a screenshot from the device. Recommended to use getScreenshot(String)
instead with JPEG encoding for smaller size.
パラメーター | |
---|---|
format | String : supported PNG, JPEG |
rescale | boolean : if screenshot should be rescaled to reduce the size of resulting image |
戻り値 | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in format, or null if the screenshot was not successful. |
スロー | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot ()
Grabs a screenshot from the device.
戻り値 | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in png format, or null if the screenshot was not successful. |
スロー | |
---|---|
DeviceNotAvailableException |
getSerialNumber
public String getSerialNumber ()
Convenience method to get serial number of this device.
戻り値 | |
---|---|
String | the ERROR(/String) serial number |
getSetting
public String getSetting (int userId, String namespace, String key)
Return the value of the requested setting. namespace must be one of: {"system", "secure", "global"}
パラメーター | |
---|---|
userId | int |
namespace | String |
key | String |
戻り値 | |
---|---|
String | the value associated with the namespace:key of a user. Null if not found. |
スロー | |
---|---|
DeviceNotAvailableException |
getSetting
public String getSetting (String namespace, String key)
See getSetting(int, String, String)
and performed on system user.
パラメーター | |
---|---|
namespace | String |
key | String |
戻り値 | |
---|---|
String |
スロー | |
---|---|
DeviceNotAvailableException |
getSimOperator
public String getSimOperator ()
Return the SIM card operator or null if not available or if device is not available.
戻り値 | |
---|---|
String |
getSimState
public String getSimState ()
Return the SIM card state or null if not available or device is not available.
戻り値 | |
---|---|
String |
getTombstones
publicgetTombstones ()
Fetch and return the list of tombstones from the devices. Requires root.
method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException
will terminate the method early.
戻り値 | |
---|---|
A list of tombstone files, empty if no tombstone. |
スロー | |
---|---|
DeviceNotAvailableException |
getTotalMemory
public long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
戻り値 | |
---|---|
long |
getUninstallablePackageNames
publicgetUninstallablePackageNames ()
Fetch the application package names that can be uninstalled. This is presently defined as non-system packages, and updated system packages.
戻り値 | |
---|---|
ERROR(/Set) of uninstallable ERROR(/String) package names currently installed on the device. |
スロー | |
---|---|
DeviceNotAvailableException |
getUseFastbootErase
public boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
戻り値 | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
getUserFlags
public int getUserFlags (int userId)
Find and return the flags of a given user. Flags are defined in "android.content.pm.UserInfo" class in Android Open Source Project.
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
int | the flags associated with the userId provided if found, -10000 in any other cases. |
スロー | |
---|---|
DeviceNotAvailableException |
getUserInfos
publicgetUserInfos ()
Gets the Map of useId to UserInfo
on the device. Will throw DeviceRuntimeException
if output from device is not as expected.
戻り値 | |
---|---|
the list of UserInfo objects. |
スロー | |
---|---|
DeviceNotAvailableException |
getUserSerialNumber
public int getUserSerialNumber (int userId)
Return the serial number associated to the userId if found, -10000 in any other cases.
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
int |
スロー | |
---|---|
DeviceNotAvailableException |
handleAllocationEvent
public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)
Process the given DeviceEvent
. May transition device to new state. Will inform the IDeviceMonitor
of any state transitions.
Process the DeviceEvent, which may or may not transition this device to a new allocation state.
パラメーター | |
---|---|
event | DeviceEvent |
戻り値 | |
---|---|
IManagedTestDevice.DeviceEventResponse |
hasFeature
public boolean hasFeature (String feature)
Check if a feature is available on a device.
パラメーター | |
---|---|
feature | String : which format should be "feature: |
戻り値 | |
---|---|
boolean | True if feature is found, false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
installPackage
public String installPackage (File packageFile, boolean reinstall, String... extraArgs)
Install an Android package on device.
パラメーター | |
---|---|
packageFile | File : the apk file to install |
reinstall | boolean : true if a reinstall should be performed |
extraArgs | String : optional extra arguments to pass. See 'adb shell pm -h' for available options. |
戻り値 | |
---|---|
String | a ERROR(/String) with an error code, or null if success. |
スロー | |
---|---|
DeviceNotAvailableException |
installPackage
public String installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs)
Install an Android package on device.
Note: Only use cases that requires explicit control of granting runtime permission at install time should call this function.
パラメーター | |
---|---|
packageFile | File : the apk file to install |
reinstall | boolean : true if a reinstall should be performed |
grantPermissions | boolean : if all runtime permissions should be granted at install time |
extraArgs | String : optional extra arguments to pass. See 'adb shell pm -h' for available options. |
戻り値 | |
---|---|
String | a ERROR(/String) with an error code, or null if success. |
スロー | |
---|---|
DeviceNotAvailableException |
installPackageForUser
public String installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs)
Install an Android package on device for a given user.
パラメーター | |
---|---|
packageFile | File : the apk file to install |
reinstall | boolean : true if a reinstall should be performed |
userId | int : the integer user id to install for. |
extraArgs | String : optional extra arguments to pass. See 'adb shell pm -h' for available options. |
戻り値 | |
---|---|
String | a ERROR(/String) with an error code, or null if success. |
スロー | |
---|---|
DeviceNotAvailableException |
installPackageForUser
public String installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)
Install an Android package on device for a given user.
Note: Only use cases that requires explicit control of granting runtime permission at install time should call this function.
パラメーター | |
---|---|
packageFile | File : the apk file to install |
reinstall | boolean : true if a reinstall should be performed |
grantPermissions | boolean : if all runtime permissions should be granted at install time |
userId | int : the integer user id to install for. |
extraArgs | String : optional extra arguments to pass. See 'adb shell pm -h' for available options. |
戻り値 | |
---|---|
String | a ERROR(/String) with an error code, or null if success. |
スロー | |
---|---|
DeviceNotAvailableException |
isAdbTcp
public boolean isAdbTcp ()
戻り値 | |
---|---|
boolean |
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
Check whether platform on device supports app enumeration
戻り値 | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
スロー | |
---|---|
DeviceNotAvailableException |
isBypassLowTargetSdkBlockSupported
public boolean isBypassLowTargetSdkBlockSupported ()
Check whether platform on device supports bypassing low target sdk block on app installs
戻り値 | |
---|---|
boolean | True if bypass low target sdk block is supported, false otherwise |
スロー | |
---|---|
DeviceNotAvailableException |
isDeviceEncrypted
public boolean isDeviceEncrypted ()
Returns if the device is encrypted.
戻り値 | |
---|---|
boolean | true if the device is encrypted. |
スロー | |
---|---|
DeviceNotAvailableException |
isDirectory
public boolean isDirectory (String path)
Return True if the path on the device is a directory, false otherwise.
パラメーター | |
---|---|
path | String |
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
isEnableAdbRoot
public boolean isEnableAdbRoot ()
戻り値 | |
---|---|
boolean | true if adb root should be enabled on device |
isEncryptionSupported
public boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
戻り値 | |
---|---|
boolean | true if the device supports encryption. |
スロー | |
---|---|
DeviceNotAvailableException |
isExecutable
public boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
パラメーター | |
---|---|
fullPath | String |
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
isFastbootEnabled
public boolean isFastbootEnabled ()
Return if fastboot is available for the device.
戻り値 | |
---|---|
boolean |
isHeadless
public boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
isHeadlessSystemUserMode
public boolean isHeadlessSystemUserMode ()
Returns whether the device uses headless system user mode.
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
isMainUserPermanentAdmin
public boolean isMainUserPermanentAdmin ()
Returns whether the main user is a permanent admin and can't be deleted or downgraded to non-admin status.
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
isMultiUserSupported
public boolean isMultiUserSupported ()
Determines if multi user is supported.
戻り値 | |
---|---|
boolean | true if multi user is supported, false otherwise |
スロー | |
---|---|
DeviceNotAvailableException |
isPackageInstalled
public boolean isPackageInstalled (String packageName, String userId)
Query the device for a given package name and given user id to check if it's currently installed or not for that user.
パラメーター | |
---|---|
packageName | String : the package we are checking if it's installed. |
userId | String : The user id we are checking the package is installed for. If null, primary user zero will be used. |
戻り値 | |
---|---|
boolean | True if the package is reported as installed. False otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
isPackageInstalled
public boolean isPackageInstalled (String packageName)
Query the device for a given package name to check if it's currently installed or not.
パラメーター | |
---|---|
packageName | String |
戻り値 | |
---|---|
boolean | True if the package is reported as installed. False otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
戻り値 | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
戻り値 | |
---|---|
boolean |
isUserRunning
public boolean isUserRunning (int userId)
Check if a given user is running.
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
boolean | True if the user is running, false in every other cases. |
スロー | |
---|---|
DeviceNotAvailableException |
isUserSecondary
public boolean isUserSecondary (int userId)
Return whether the specified user is a secondary user according to it's flags.
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
boolean | true if the user is secondary, false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
isUserVisible
public boolean isUserVisible (int userId)
Checks if the given user is visible.
A "visible" user is a user that is interacting with the "human" user and hence is able to launch launch activities (typically in the default display).
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
isUserVisibleOnDisplay
public boolean isUserVisibleOnDisplay (int userId, int displayId)
Checks if the given user is visible in the given display.
A "visible" user is a user that is interacting with the "human" user and hence is able to launch launch activities in that display.
パラメーター | |
---|---|
userId | int |
displayId | int |
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
isVisibleBackgroundUsersOnDefaultDisplaySupported
public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported ()
Returns whether the device allow users to be started visible in the background in the ERROR(/java.android.view.Display#DEFAULT_DISPLAY)
.
If it does, you could call startVisibleBackgroundUser(int, int, boolean)
, passing a display returned by listDisplayIdsForStartingVisibleBackgroundUsers()
(which should include ERROR(/java.android.view.Display#DEFAULT_DISPLAY)
).
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
isVisibleBackgroundUsersSupported
public boolean isVisibleBackgroundUsersSupported ()
Returns whether the device allow users to be started visible in the background.
If it does, you could call startVisibleBackgroundUser(int, int, boolean)
, passing a display returned by listDisplayIdsForStartingVisibleBackgroundUsers()
.
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
isWifiEnabled
public boolean isWifiEnabled ()
Test if wifi is enabled.
Checks if wifi is enabled on device. Useful for asserting wifi status before tests that shouldn't run with wifi, eg mobile data tests.戻り値 | |
---|---|
boolean | true if wifi is enabled. false if disabled |
スロー | |
---|---|
DeviceNotAvailableException |
listDisplayIds
publiclistDisplayIds ()
Collect the list of available displays id on the device as reported by "dumpsys SurfaceFlinger".
戻り値 | |
---|---|
The list of displays. Default always returns the default display 0. |
スロー | |
---|---|
DeviceNotAvailableException |
listDisplayIdsForStartingVisibleBackgroundUsers
publiclistDisplayIdsForStartingVisibleBackgroundUsers ()
Gets the list of displays that can be used to start a user visible in the background
.
戻り値 | |
---|---|
スロー | |
---|---|
DeviceNotAvailableException |
listUsers
publiclistUsers ()
Gets the list of users on the device. Will throw DeviceRuntimeException
if output from device is not as expected.
戻り値 | |
---|---|
the list of user ids. |
スロー | |
---|---|
DeviceNotAvailableException |
logAnrs
public boolean logAnrs (ITestLogger logger)
Collects and log ANRs from the device.
パラメーター | |
---|---|
logger | ITestLogger : an ITestLogger to log the ANRs. |
戻り値 | |
---|---|
boolean | True if the logging was successful, false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
logBugreport
public boolean logBugreport (String dataName, ITestLogger listener)
Helper method to take a bugreport and log it to the reporters.
パラメーター | |
---|---|
dataName | String : name under which the bugreport will be reported. |
listener | ITestLogger : an ITestLogger to log the bugreport. |
戻り値 | |
---|---|
boolean | True if the logging was successful, false otherwise. |
logOnDevice
public void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)
Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.
パラメーター | |
---|---|
tag | String : The tag under which we log our message in the logcat. |
level | Log.LogLevel : The debug level of the message in the logcat. |
format | String : The message format. |
args | Object : the args to be replaced via String.format(). |
nonBlockingReboot
public void nonBlockingReboot ()
Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.
スロー | |
---|---|
DeviceNotAvailableException |
postAdbRootAction
public void postAdbRootAction ()
Override if the device needs some specific actions to be taken after adb root and before the device is back online. Default implementation doesn't include any addition actions. adb root is not guaranteed to be enabled at this stage.
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
postAdbUnrootAction
public void postAdbUnrootAction ()
Override if the device needs some specific actions to be taken after adb unroot and before the device is back online. Default implementation doesn't include any additional actions. adb root is not guaranteed to be disabled at this stage.
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
postBootSetup
public void postBootSetup ()
Perform instructions to configure device for testing that after every boot.
Should be called after device is fully booted/available In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot. Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)スロー | |
---|---|
DeviceNotAvailableException |
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Extra steps for device specific required clean up that will be executed after the invocation is done.
パラメーター | |
---|---|
exception | Throwable : if any, the final exception raised by the invocation failure. |
preInvocationSetup
public void preInvocationSetup (IBuildInfo info, MultiMap<String, String> attributes)
Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.
パラメーター | |
---|---|
info | IBuildInfo : The IBuildInfo of the device. |
attributes | MultiMap : The attributes stored in the invocation context |
スロー | |
---|---|
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public boolean pullDir (String deviceFilePath, File localDir)
Recursively pull directory contents from device.
パラメーター | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
戻り値 | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
pullFile
public boolean pullFile (String remoteFilePath, File localFile)
Retrieves a file off device.
パラメーター | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
戻り値 | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
pullFile
public File pullFile (String remoteFilePath, int userId)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
パラメーター | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
userId | int : The user id to pull from |
戻り値 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
スロー | |
---|---|
DeviceNotAvailableException |
pullFile
public File pullFile (String remoteFilePath)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
パラメーター | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
戻り値 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
スロー | |
---|---|
DeviceNotAvailableException |
pullFile
public boolean pullFile (String remoteFilePath, File localFile, int userId)
Retrieves a file off device.
パラメーター | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
userId | int : The user id to pull from |
戻り値 | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
pullFileContents
public String pullFileContents (String remoteFilePath)
Retrieves a file off device, and returns the contents.
パラメーター | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
戻り値 | |
---|---|
String | A ERROR(/String) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
スロー | |
---|---|
DeviceNotAvailableException |
pullFileFromExternal
public File pullFileFromExternal (String remoteFilePath)
A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File)
, and return a reference to that File
.
パラメーター | |
---|---|
remoteFilePath | String : the path to file on device, relative to the device's external storage mountpoint |
戻り値 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
スロー | |
---|---|
DeviceNotAvailableException |
pushDir
public boolean pushDir (File localFileDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
パラメーター | |
---|---|
localFileDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
戻り値 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
pushDir
public boolean pushDir (File localFileDir, String deviceFilePath)
Recursively push directory contents to device.
パラメーター | |
---|---|
localFileDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
戻り値 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
pushFile
public boolean pushFile (File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded)
Variant of pushFile(File, String)
which can optionally consider evaluating the need for the content provider.
パラメーター | |
---|---|
localFile | File : the local file to push |
remoteFilePath | String : the remote destination absolute file path |
evaluateContentProviderNeeded | boolean : whether to check if we need the content provider |
戻り値 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
pushFile
public boolean pushFile (File localFile, String remoteFilePath)
Push a file to device. By default using a content provider.
パラメーター | |
---|---|
localFile | File : the local file to push |
remoteFilePath | String : the remote destination absolute file path |
戻り値 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
pushString
public boolean pushString (String contents, String remoteFilePath)
Push file created from a string to device
パラメーター | |
---|---|
contents | String : the contents of the file to push |
remoteFilePath | String : the remote destination absolute file path |
戻り値 | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
reboot
public void reboot (String reason)
Reboots the device into adb mode with given reason
to be persisted across reboot.
Blocks until device becomes available.
Last reboot reason can be obtained by querying sys.boot.reason
propety.
パラメーター | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
スロー | |
---|---|
DeviceNotAvailableException |
reboot
public void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.スロー | |
---|---|
DeviceNotAvailableException |
rebootIntoBootloader
public void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.スロー | |
---|---|
DeviceNotAvailableException |
rebootIntoFastbootd
public void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
スロー | |
---|---|
DeviceNotAvailableException |
rebootIntoRecovery
public void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recoveryスロー | |
---|---|
DeviceNotAvailableException |
rebootIntoSideload
public void rebootIntoSideload ()
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
スロー | |
---|---|
DeviceNotAvailableException |
rebootIntoSideload
public void rebootIntoSideload (boolean autoReboot)
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
パラメーター | |
---|---|
autoReboot | boolean : whether to automatically reboot the device after sideload |
スロー | |
---|---|
DeviceNotAvailableException |
rebootUntilOnline
public void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
スロー | |
---|---|
DeviceNotAvailableException |
rebootUntilOnline
public void rebootUntilOnline (String reason)
An alternate to reboot()
that only blocks until device is online ie visible to adb.
パラメーター | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
スロー | |
---|---|
DeviceNotAvailableException |
rebootUserspace
public void rebootUserspace ()
Reboots only userspace part of device.
Blocks until device becomes available.
WARNING. Userspace reboot is currently under active development, use it on your own risk.
スロー | |
---|---|
DeviceNotAvailableException |
rebootUserspaceUntilOnline
public void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
スロー | |
---|---|
DeviceNotAvailableException |
recoverDevice
public boolean recoverDevice ()
Attempts to recover device communication.
戻り値 | |
---|---|
boolean | True if recovery attempted and successful, returns False if recovery was skipped |
スロー | |
---|---|
DeviceNotAvailableException | if device is no longer available |
registerDeviceActionReceiver
public void registerDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)
Registers a IDeviceActionReceiver
for this device.
All registered IDeviceActionReceiver
s will be notified before a device action starts and after the device action ends.
パラメーター | |
---|---|
deviceActionReceiver | IDeviceActionReceiver : A IDeviceActionReceiver which will be registered. |
remountSystemWritable
public void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
スロー | |
---|---|
DeviceNotAvailableException |
remountVendorWritable
public void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
スロー | |
---|---|
DeviceNotAvailableException |
removeAdmin
public boolean removeAdmin (String componentName, int userId)
Remove given device admin in given user and return true
if it is successful, false
otherwise.
パラメーター | |
---|---|
componentName | String : of device admin to be removed. |
userId | int : of user that the device admin lives in. |
戻り値 | |
---|---|
boolean | True if it is successful, false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
removeOwners
public void removeOwners ()
Remove all existing device profile owners with the best effort.
スロー | |
---|---|
DeviceNotAvailableException |
removeUser
public boolean removeUser (int userId)
Remove a given user from the device.
パラメーター | |
---|---|
userId | int : of the user to remove |
戻り値 | |
---|---|
boolean | true if we were successful in removing the user, false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
resetContentProviderSetup
public void resetContentProviderSetup ()
Reset the flag for content provider setup in order to trigger it again.
runInstrumentationTests
public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)
Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection))
with one or more listeners passed as parameters.
パラメーター | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners | ITestLifeCycleReceiver : the test result listener(s) |
戻り値 | |
---|---|
boolean | true if test command completed. false if it failed to complete, but recovery succeeded |
スロー | |
---|---|
DeviceNotAvailableException |
runInstrumentationTests
public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner,listeners)
Runs instrumentation tests, and provides device recovery.
If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.
If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.
パラメーター | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners |
戻り値 | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
スロー | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId,listeners)
Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection))
but runs the test for the given user.
パラメーター | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)
Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)
but runs the test for a given user.
パラメーター | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
戻り値 | |
---|---|
boolean |
スロー | |
---|---|
DeviceNotAvailableException |
setConfiguration
public void setConfiguration (IConfiguration configuration)
Injects the IConfiguration
in use.
パラメーター | |
---|---|
configuration | IConfiguration |
setDate
public void setDate (Date date)
Sets the date on device
Note: setting date on device requires root
パラメーター | |
---|---|
date | Date : specify a particular date; will use host date if null |
スロー | |
---|---|
DeviceNotAvailableException |
setDeviceOwner
public boolean setDeviceOwner (String componentName, int userId)
Set a device admin component as device owner in given user.
パラメーター | |
---|---|
componentName | String : of device admin to be device owner. |
userId | int : of the user that the device owner lives in. |
戻り値 | |
---|---|
boolean | True if it is successful, false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
setDeviceState
public void setDeviceState (TestDeviceState deviceState)
Update the device's state.
パラメーター | |
---|---|
deviceState | TestDeviceState : the TestDeviceState |
setEmulatorOutputStream
public void setEmulatorOutputStream (SizeLimitedOutputStream output)
For emulator set SizeLimitedOutputStream
to log output
パラメーター | |
---|---|
output | SizeLimitedOutputStream : to log the output |
setEmulatorProcess
public void setEmulatorProcess (Process p)
Sets the ERROR(/Process)
, when this device is an emulator.
パラメーター | |
---|---|
p | Process |
setFastbootEnabled
public void setFastbootEnabled (boolean fastbootEnabled)
Set the fastboot option for the device. Should be set when device is first allocated.
パラメーター | |
---|---|
fastbootEnabled | boolean : whether fastboot is available for the device or not |
setFastbootPath
public void setFastbootPath (String fastbootPath)
Sets the path to the fastboot binary that should be used. Still requires isFastbootEnabled()
to be true, to have fastboot functions enabled.
パラメーター | |
---|---|
fastbootPath | String |
setIDevice
public void setIDevice (IDevice newDevice)
Update the IDevice associated with this ITestDevice.
The new IDevice must refer the same physical device as the current reference. This method will be called if DDMS has allocated a new IDeviceパラメーター | |
---|---|
newDevice | IDevice : the IDevice |
setLogStartDelay
public void setLogStartDelay (int delay)
Sets the time in ms to wait before starting logcat capture for a online device.
パラメーター | |
---|---|
delay | int : the delay in ms |
setOptions
public void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
パラメーター | |
---|---|
options | TestDeviceOptions |
setProperty
public boolean setProperty (String propKey, String propValue)
Sets the given property value on the device. Requires adb root is true.
パラメーター | |
---|---|
propKey | String : The key targeted to be set. |
propValue | String : The property value to be set. |
戻り値 | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
setRecovery
public void setRecovery (IDeviceRecovery recovery)
Set the IDeviceRecovery
to use for this device. Should be set when device is first allocated.
パラメーター | |
---|---|
recovery | IDeviceRecovery : the IDeviceRecovery |
setRecoveryMode
public void setRecoveryMode (ITestDevice.RecoveryMode mode)
Set the current recovery mode to use for the device.
Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etcパラメーター | |
---|---|
mode | ITestDevice.RecoveryMode : whether 'recover till online only' mode should be on or not. |
setSetting
public void setSetting (String namespace, String key, String value)
See setSetting(int, String, String, String)
and performed on system user.
パラメーター | |
---|---|
namespace | String |
key | String |
value | String |
スロー | |
---|---|
DeviceNotAvailableException |
setSetting
public void setSetting (int userId, String namespace, String key, String value)
Add a setting value to the namespace of a given user. Some settings will only be available after a reboot. namespace must be one of: {"system", "secure", "global"}
パラメーター | |
---|---|
userId | int |
namespace | String |
key | String |
value | String |
スロー | |
---|---|
DeviceNotAvailableException |
setTestLogger
public void setTestLogger (ITestLogger testLogger)
Injects the ITestLogger
instance
パラメーター | |
---|---|
testLogger | ITestLogger |
setUseFastbootErase
public void setUseFastbootErase (boolean useFastbootErase)
Set whether to use fastboot erase or fastboot format to wipe a partition on the device.
パラメーター | |
---|---|
useFastbootErase | boolean : true if fastboot erase should be used or false if fastboot format should be used. |
startLogcat
public void startLogcat ()
Start capturing logcat output from device in the background.
Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat. When the device is no longer in use,stopLogcat()
must be called. startLogcat()
and stopLogcat()
do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.startUser
public boolean startUser (int userId)
Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP.
パラメーター | |
---|---|
userId | int : of the user to start in the background |
戻り値 | |
---|---|
boolean | true if the user was successfully started in the background. |
スロー | |
---|---|
DeviceNotAvailableException |
startUser
public boolean startUser (int userId, boolean waitFlag)
Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP. Possible to provide extra flag to wait for the operation to have effect.
パラメーター | |
---|---|
userId | int : of the user to start in the background |
waitFlag | boolean : will make the command wait until user is started and unlocked. |
戻り値 | |
---|---|
boolean | true if the user was successfully started in the background. |
スロー | |
---|---|
DeviceNotAvailableException |
startVisibleBackgroundUser
public boolean startVisibleBackgroundUser (int userId, int displayId, boolean waitFlag)
Starts a given user in the background, visible in the given display (ie, allowing the user to launch activities in that display).
NOTE: this command doesn't check if the user exists, display is available, device supports such feature
, etc.
パラメーター | |
---|---|
userId | int : of the user to start in the background |
displayId | int : display to start user visible on |
waitFlag | boolean : will make the command wait until user is started and unlocked. |
戻り値 | |
---|---|
boolean | true if the user was successfully started visible in the background. |
スロー | |
---|---|
DeviceNotAvailableException |
stopEmulatorOutput
public void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public void stopLogcat ()
Stop capturing logcat output from device, and discard currently saved logcat data.
Will have no effect if logcat output is not being captured.stopUser
public boolean stopUser (int userId)
Stops a given user. If the user is already stopped, this method is a NOOP. Cannot stop current and system user.
パラメーター | |
---|---|
userId | int : of the user to stop. |
戻り値 | |
---|---|
boolean | true if the user was successfully stopped. |
スロー | |
---|---|
DeviceNotAvailableException |
stopUser
public boolean stopUser (int userId, boolean waitFlag, boolean forceFlag)
Stop a given user. Possible to provide extra flags to wait for the operation to have effect, and force terminate the user. Cannot stop current and system user.
パラメーター | |
---|---|
userId | int : of the user to stop. |
waitFlag | boolean : will make the command wait until user is stopped. |
forceFlag | boolean : will force stop the user. |
戻り値 | |
---|---|
boolean | true if the user was successfully stopped. |
スロー | |
---|---|
DeviceNotAvailableException |
switchToAdbTcp
public String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
戻り値 | |
---|---|
String | the tcp serial number or null if device could not be switched |
スロー | |
---|---|
DeviceNotAvailableException |
switchToAdbUsb
public boolean switchToAdbUsb ()
Switch device to adb over usb mode.
戻り値 | |
---|---|
boolean | true if switch was successful, false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
switchUser
public boolean switchUser (int userId)
Switch to another userId with a default timeout. switchUser(int, long)
.
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
boolean | True if the new userId matches the userId provider. False otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
switchUser
public boolean switchUser (int userId, long timeout)
Switch to another userId with the provided timeout as deadline. Attempt to disable keyguard after user change is successful.
パラメーター | |
---|---|
userId | int |
timeout | long : to wait before returning false for switch-user failed. |
戻り値 | |
---|---|
boolean | True if the new userId matches the userId provider. False otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
syncFiles
public boolean syncFiles (File localFileDir, String deviceFilePath)
Incrementally syncs the contents of a local file directory to device.
Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date. Hidden files (with names starting with ".") will be ignored. Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.パラメーター | |
---|---|
localFileDir | File : the local file directory containing files to recursively push. |
deviceFilePath | String : the remote destination absolute file path root. All directories in thos file path must be readable. ie pushing to /data/local/tmp when adb is not root will fail |
戻り値 | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
スロー | |
---|---|
DeviceNotAvailableException |
takeBugreport
public Bugreport takeBugreport ()
Take a bugreport and returns it inside a Bugreport
object to handle it. Return null in case of issue. File referenced in the Bugreport object need to be cleaned via Bugreport.close()
.
戻り値 | |
---|---|
Bugreport |
uninstallPackage
public String uninstallPackage (String packageName)
Uninstall an Android package from device.
パラメーター | |
---|---|
packageName | String : the Android package to uninstall |
戻り値 | |
---|---|
String | a ERROR(/String) with an error code, or null if success. |
スロー | |
---|---|
DeviceNotAvailableException |
uninstallPackageForUser
public String uninstallPackageForUser (String packageName, int userId)
Uninstall an Android package from device for a given user.
パラメーター | |
---|---|
packageName | String : the Android package to uninstall |
userId | int : the integer user id to uninstall for. |
戻り値 | |
---|---|
String | a ERROR(/String) with an error code, or null if success. |
スロー | |
---|---|
DeviceNotAvailableException |
unlockDevice
public boolean unlockDevice ()
Unlocks the device if the device is in an encrypted state.
This method may restart the framework but will not callpostBootSetup()
. Therefore, the device might not be fully ready to be tested when this method returns.戻り値 | |
---|---|
boolean | true if successful or if the device is unencrypted. |
スロー | |
---|---|
DeviceNotAvailableException |
waitForBootComplete
public boolean waitForBootComplete (long timeOut)
Blocks until the device's boot complete flag is set.
パラメーター | |
---|---|
timeOut | long : time in msecs to wait for the flag to be set |
戻り値 | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
スロー | |
---|---|
DeviceNotAvailableException |
デバイスが利用可能になるのを待つ
public boolean waitForDeviceAvailable ()
デバイスが応答してテストできるようになるまで待機します。 Uses default timeout.
戻り値 | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
スロー | |
---|---|
DeviceNotAvailableException |
デバイスが利用可能になるのを待つ
public boolean waitForDeviceAvailable (long waitTime)
デバイスが応答してテストできるようになるまで待機します。
パラメーター | |
---|---|
waitTime | long : 待機する時間 (ミリ秒) |
戻り値 | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
スロー | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailableInRecoverPath
public boolean waitForDeviceAvailableInRecoverPath (long waitTime)
Waits for the device to be responsive and available without considering recovery path.
パラメーター | |
---|---|
waitTime | long |
戻り値 | |
---|---|
boolean | True if device is available, False if unavailable. |
スロー | |
---|---|
DeviceNotAvailableException |
waitForDeviceBootloader
public void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
スロー | |
---|---|
DeviceNotAvailableException |
waitForDeviceInRecovery
public boolean waitForDeviceInRecovery (long waitTime)
Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery
).
パラメーター | |
---|---|
waitTime | long : 待機する時間 (ミリ秒) |
戻り値 | |
---|---|
boolean | true if device boots into recovery before time expires.それ以外の場合はfalse |
waitForDeviceInSideload
public boolean waitForDeviceInSideload (long waitTime)
Blocks for the device to be in the 'adb sideload' state
パラメーター | |
---|---|
waitTime | long : 待機する時間 (ミリ秒) |
戻り値 | |
---|---|
boolean | true if device boots into sideload before time expires.それ以外の場合はfalse |
waitForDeviceNotAvailable
public boolean waitForDeviceNotAvailable (long waitTime)
Blocks for the device to be not available ie missing from adb
パラメーター | |
---|---|
waitTime | long : 待機する時間 (ミリ秒) |
戻り値 | |
---|---|
boolean | true if device becomes not available before time expires.それ以外の場合はfalse |
デバイスオンライン待ち
public void waitForDeviceOnline ()
Blocks until device is visible via adb. Uses default timeout
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.スロー | |
---|---|
DeviceNotAvailableException |
デバイスオンライン待ち
public void waitForDeviceOnline (long waitTime)
Blocks until device is visible via adb.
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.パラメーター | |
---|---|
waitTime | long : 待機する時間 (ミリ秒) |
スロー | |
---|---|
DeviceNotAvailableException |
デバイスシェルの待機
public boolean waitForDeviceShell (long waitTime)
デバイスが基本的な adb シェル コマンドに応答するまで待機します。
パラメーター | |
---|---|
waitTime | long : 待機する時間 (ミリ秒) |
戻り値 | |
---|---|
boolean | waitTimeが経過する前にデバイスが応答する場合はtrue 。 |
保護されたメソッド
buildAdbShellCommand
protected String[] buildAdbShellCommand (String command, boolean forceExitStatusDetection)
Builds the OS command for the given adb shell command session and args
パラメーター | |
---|---|
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)
Create a RebootDeviceAction
to be used when performing a reboot action.
パラメーター | |
---|---|
rebootMode | NativeDevice.RebootMode : a mode of this reboot. |
reason | String : for this reboot. |
戻り値 | |
---|---|
NativeDevice.RebootDeviceAction | the created RebootDeviceAction . |
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode, String reason)
Perform a adb reboot.
パラメーター | |
---|---|
rebootMode | NativeDevice.RebootMode : a mode of this reboot. |
reason | String : for this reboot. |
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
ensureRuntimePermissionSupported
protected void ensureRuntimePermissionSupported ()
helper method to throw exception if runtime permission isn't supported
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getApiLevelSafe
protected int getApiLevelSafe ()
戻り値 | |
---|---|
int |
initializeConnection
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)
Fetch a device property, from the ddmlib cache by default, and falling back to either `adb shell getprop` or `fastboot getvar` depending on whether the device is in Fastboot or not.
パラメーター | |
---|---|
propName | String : The name of the device property as returned by `adb shell getprop` |
fastbootVar | String : The name of the equivalent fastboot variable to query. if null , fastboot query will not be attempted |
description | String : A simple description of the variable. First letter should be capitalized. |
戻り値 | |
---|---|
String | A string, possibly null or empty, containing the value of the given property |
スロー | |
---|---|
DeviceNotAvailableException |
isInRebootCallback
protected boolean isInRebootCallback ()
Returns whether reboot callbacks is currently being executed or not. All public api's for reboot should be disabled if true.
戻り値 | |
---|---|
boolean |
isNewer
protected boolean isNewer (File localFile, IFileEntry entry)
Return true
if local file is newer than remote file. IFileEntry
being accurate to the minute, in case of equal times, the file will be considered newer.
パラメーター | |
---|---|
localFile | File |
entry | IFileEntry |
戻り値 | |
---|---|
boolean |
notifyRebootEnded
protected void notifyRebootEnded ()
Notifies all IDeviceActionReceiver
about reboot end event.
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
notifyRebootStarted
protected void notifyRebootStarted ()
Notifies all IDeviceActionReceiver
about reboot start event.
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
performDeviceAction
protected boolean performDeviceAction (String actionDescription, NativeDevice.DeviceAction action, int retryAttempts)
Performs an action on this device. Attempts to recover device and optionally retry command if action fails.
パラメーター | |
---|---|
actionDescription | String : a short description of action to be performed. Used for logging purposes only. |
action | NativeDevice.DeviceAction : the action to be performed |
retryAttempts | int : the retry attempts to make for action if it fails but recovery succeeds |
戻り値 | |
---|---|
boolean | true if action was performed successfully |
スロー | |
---|---|
DeviceNotAvailableException | if recovery attempt fails or max attempts done without success |
postAdbReboot
protected void postAdbReboot ()
Possible extra actions that can be taken after a reboot.
スロー | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
prePostBootSetup
protected void prePostBootSetup ()
Allows each device type (AndroidNativeDevice, TestDevice) to override this method for specific post boot setup.
スロー | |
---|---|
| 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)
Set the Clock instance to use.
パラメーター | |
---|---|
clock | Clock |
setMicrodroidProcess
protected void setMicrodroidProcess (Process process)
Marks the TestDevice as microdroid and sets its CID.
パラメーター | |
---|---|
process | Process : Process of the Microdroid VM. |
setTestDeviceOptions
protected void setTestDeviceOptions (deviceOptions)
パラメーター | |
---|---|
deviceOptions |
simpleFastbootCommand
protected CommandResult simpleFastbootCommand (long timeout,envVarMap, String[] fullCmd)
Executes a simple fastboot command with environment variables and report the status of the command.
パラメーター | |
---|---|
timeout | long |
envVarMap | |
fullCmd | String |
戻り値 | |
---|---|
CommandResult |
simpleFastbootCommand
protected CommandResult simpleFastbootCommand (long timeout, String[] fullCmd)
Executes a simple fastboot command and report the status of the command.
パラメーター | |
---|---|
timeout | long |
fullCmd | String |
戻り値 | |
---|---|
CommandResult |
waitForDeviceNotAvailable
protected boolean waitForDeviceNotAvailable (String operationDesc, long time)
Wait to see the device going unavailable (stop reporting to adb).
パラメーター | |
---|---|
operationDesc | String : The name of the operation that is waiting for unavailable. |
time | long : The time to wait for unavailable to occur. |
戻り値 | |
---|---|
boolean | True if device did become unavailable. |
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2023-04-28 UTC。