ネイティブデバイス
public class NativeDevice
extends Object
implements IManagedTestDevice , IConfigurationReceiver , ITestLoggerReceiver
java.lang.オブジェクト | |
↳ | 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) |
パブリックメソッド | |
---|---|
void | batchPrefetchStartupBuildProps () それぞれの props に対して「adb getprop」を呼び出すのではなく、必要なすべての props をプリフェッチすることによるマイクロ最適化 (約 400 ミリ)。 |
boolean | canSwitchToHeadlessSystemUser () ヘッドレス SYSTEM ユーザーへの切り替えが許可されているかどうかを返します。 |
boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) 最小限のサポート レベルを指定して、機能が現在サポートされているかどうかを確認します。 |
boolean | checkConnectivity () デバイスがネットワークに接続されていることを確認します。 |
boolean | clearErrorDialogs () デバイス UI に現在表示されているエラー ダイアログを閉じてみます。 |
void | clearLastConnectedWifiNetwork () 最後に接続した Wi-Fi ネットワークをクリアします。 |
void | clearLogcat () 蓄積された logcat データを削除します。 |
boolean | connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) Wi-Fi ネットワークに接続します。 |
boolean | connectToWifiNetwork (String wifiSsid, String wifiPsk) Wi-Fi ネットワークに接続します。 |
boolean | connectToWifiNetwork ( wifiSsidToPsk) connectToWifiNetwork ( wifiSsidToPsk) Wi-Fi ネットワークに接続します。f |
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 root をオフにします。 |
void | disableKeyguard () キーガードを無効にしようとします。 |
boolean | disableNetworkMonitor () デバイス上のネットワーク監視を無効にします。 |
boolean | disconnectFromWifi () Wi-Fi ネットワークから切断します。 |
boolean | doesFileExist (String deviceFilePath, int userId) デバイス上に特定のユーザーのファイルが存在するかどうかを判断するヘルパー メソッド。 |
boolean | doesFileExist (String deviceFilePath) デバイス上にファイルが存在するかどうかを判断するヘルパー メソッド。 |
File | dumpHeap (String process, String devicePath) system_server からヒープをダンプしてみます。 |
boolean | enableAdbRoot () adb root をオンにします。 |
boolean | enableNetworkMonitor () デバイス上のネットワーク監視を有効にします。 |
String | executeAdbCommand (long timeout, String... cmdArgs) 指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。 |
String | executeAdbCommand (long timeout, envMap, String... cmdArgs) 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 シェル コマンドを実行します。 |
void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
void | executeShellCommand (String command, IShellOutputReceiver receiver) 指定された adb シェル コマンドを実行し、コマンドが失敗した場合は複数回再試行します。 |
CommandResult | executeShellV2Command (String cmd) adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に設定された |
CommandResult | executeShellV2Command (String cmd, OutputStream pipeToOutput) adb シェル コマンドを実行し、コマンド ステータス出力と標準エラー出力が適切に設定された |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput) adb シェル コマンドを実行し、コマンド ステータス出力、stdout および stderr が適切に設定された |
CommandResult | executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
CommandResult | executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) コマンドの動作を制御するためのパラメータをさらに指定して、adb シェル コマンドを実行します。 |
CommandResult | fastbootWipePartition (String partition) デバイスのパーティションを消去するヘルパー メソッド。 |
getActiveApexes () デバイス上でアクティブ化された APEX に関する情報を取得します。 | |
getAllSettings (String namespace) 要求された名前空間のキーと値のペアを返します。 | |
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 () エミュレータの標準出力と標準エラー出力のストリームを取得します。 |
Process | getEmulatorProcess () このエミュレータに対応する |
final File | getExecuteShellCommandLog () すべての |
long | getExternalStoreFreeSpace () デバイスの外部ストレージ上の空き領域の量を決定するヘルパー メソッド。 |
String | getFastbootPath () 使用されている fastboot バイナリのパスを返します。 |
String | getFastbootProductType () 高速ブート モードのときにこのデバイスの製品タイプを取得する便利なメソッド。 |
String | getFastbootProductVariant () 高速ブート モードのときにこのデバイスの製品タイプを取得する便利なメソッド。 |
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 消去または fastboot フォーマットを使用するかどうかを取得します。 |
int | getUserFlags (int userId) 指定されたユーザーのフラグを検索して返します。 |
getUserInfos () デバイス上の useId から | |
int | getUserSerialNumber (int userId) userId が見つかった場合はそのシリアル番号を返し、それ以外の場合は -10000 を返します。 |
IManagedTestDevice.DeviceEventResponse | handleAllocationEvent (DeviceEvent event) 指定された DeviceEvent を処理します。 DeviceEvent を処理します。これにより、このデバイスが新しい割り当て状態に移行する場合と移行しない場合があります。 |
boolean | hasFeature (String feature) デバイスで機能が利用できるかどうかを確認します。 |
String | installPackage (File packageFile, boolean reinstall, String... extraArgs) Android パッケージをデバイスにインストールします。 |
String | installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs) Android パッケージをデバイスにインストールします。 |
String | installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs) 特定のユーザーのデバイスに Android パッケージをインストールします。 |
String | installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) 特定のユーザーのデバイスに Android パッケージをインストールします。 |
void | invalidatePropertyCache () |
boolean | isAdbRoot () |
boolean | isAdbTcp () |
boolean | isAppEnumerationSupported () デバイス上のプラットフォームがアプリの列挙をサポートしているかどうかを確認する |
boolean | isBypassLowTargetSdkBlockSupported () デバイス上のプラットフォームがアプリのインストール時の低ターゲット SDK ブロックのバイパスをサポートしているかどうかを確認します |
boolean | 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 サイドロード モードで再起動します (これは回復中の特別なモードであることに注意してください) デバイスがサイドロード モードに入るまでブロックします |
void | rebootIntoSideload (boolean autoReboot) デバイスを adb サイドロード モードで再起動します (これは回復中の特別なモードであることに注意してください) デバイスがサイドロード モードに入るまでブロックします |
void | rebootUntilOnline () |
void | rebootUntilOnline (String reason) |
void | rebootUserspace () デバイスのユーザースペース部分のみを再起動します。 |
void | rebootUserspaceUntilOnline () |
boolean | recoverDevice () デバイスの通信の回復を試みます。 |
void | registerDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver) このデバイスの |
void | remountSystemReadOnly () デバイス上のシステム パーティションを読み取り専用にします。 |
void | remountSystemWritable () デバイス上のシステム パーティションを書き込み可能にします。 |
void | remountVendorReadOnly () デバイス上のベンダー パーティションを読み取り専用にします。 |
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) 使用中の |
final void | setConnectionAvdInfo ( GceAvdInfo avdInfo) |
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 消去または fastboot フォーマットを使用するかどうかを設定します。 |
void | startLogcat () バックグラウンドでデバイスからの logcat 出力のキャプチャを開始します。 |
boolean | startUser (int userId) 指定されたユーザーが現在停止している場合は、バックグラウンドで開始します。 |
boolean | startUser (int userId, boolean waitFlag) 指定されたユーザーが現在停止している場合は、バックグラウンドで開始します。 |
boolean | startVisibleBackgroundUser (int userId, int displayId, boolean waitFlag) 指定されたユーザーをバックグラウンドで開始し、指定されたディスプレイに表示されます (つまり、ユーザーがそのディスプレイでアクティビティを起動できるようになります)。 |
void | stopEmulatorOutput () エミュレータ出力を閉じて削除します。 |
void | stopLogcat () デバイスからの logcat 出力のキャプチャを停止し、現在保存されている logcat データを破棄します。 |
boolean | stopUser (int userId) 指定されたユーザーを停止します。 |
boolean | stopUser (int userId, boolean waitFlag, boolean forceFlag) 特定のユーザーを停止します。 |
String | switchToAdbTcp () デバイスを adb-over-tcp モードに切り替えます。 |
boolean | switchToAdbUsb () デバイスを adb over USB モードに切り替えます。 |
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 サイドロード」状態になるためのブロック |
boolean | waitForDeviceNotAvailable (long waitTime) デバイスが利用できないようにブロックします。つまり、adb から欠落しています。 |
void | waitForDeviceOnline () デバイスが adb 経由で表示されるまでブロックします。 |
void | waitForDeviceOnline (long waitTime) デバイスが adb 経由で表示されるまでブロックします。 |
boolean | waitForDeviceShell (long waitTime) デバイスが基本的な adb シェル コマンドに応答するまで待機します。 |
保護されたメソッド | |
---|---|
void | addExtraConnectionBuilderArgs ( DefaultConnection.ConnectionBuilder builder) |
String[] | buildAdbShellCommand (String command, boolean forceExitStatusDetection) 指定された adb シェル コマンド セッションと引数の OS コマンドを構築します |
void | checkApiLevelAgainst (String feature, int strictMinLevel) |
NativeDevice.RebootDeviceAction | createRebootDeviceAction ( NativeDevice.RebootMode rebootMode, String reason) 再起動アクションを実行するときに使用する |
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) 使用する Clock インスタンスを設定します。 |
void | setMicrodroidProcess (Process process) TestDevice をマイクロドロイドとしてマークし、その 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
パブリックコンストラクター
ネイティブデバイス
public NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
TestDevice
を作成します。
パラメーター | |
---|---|
device | IDevice : 関連付けられたIDevice |
stateMonitor | IDeviceStateMonitor : 使用するIDeviceStateMonitor メカニズム |
allocationMonitor | IDeviceMonitor : 割り当て状態の変更を通知するIDeviceMonitor 。 null も可能 |
パブリックメソッド
バッチPrefetchStartupBuildProps
public void batchPrefetchStartupBuildProps ()
それぞれの props に対して「adb getprop」を呼び出すのではなく、必要なすべての props をプリフェッチすることによるマイクロ最適化 (約 400 ミリ)。つまり、すべてのプロパティをフェッチするのは、1 つのプロパティをフェッチするのと同じくらい高速です。 device.getApiLevel()、checkApiLevelAgainstNextRelease、getBuildAlias などはすべて内部で「adb getprop」を呼び出します。これらを 1 回の呼び出しでフェッチし、NativeDevice.setProperty を呼び出します。これを行わなくても、NativeDevice 自体が setProperty を呼び出し、将来の呼び出しに備えて結果をキャッシュします。我々はそれを少し早めにやっているだけです。デバイスが回復中である場合、またはプロパティの取得中に他のエラーが発生した場合は、それらを無視します。
canSwitchToHeadlessSystemUser
public boolean canSwitchToHeadlessSystemUser ()
ヘッドレス SYSTEM ユーザーへの切り替えが許可されているかどうかを返します。
戻り値 | |
---|---|
boolean |
投げる | |
---|---|
DeviceNotAvailableException |
checkApiLevelAgainstNextRelease
public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
最小限のサポート レベルを指定して、機能が現在サポートされているかどうかを確認します。この方法では、API レベルが上がる前に、まだリリースされていない機能が考慮されます。
パラメーター | |
---|---|
strictMinLevel | int : 機能をサポートする厳密な最小可能レベル。 |
戻り値 | |
---|---|
boolean | レベルがサポートされている場合は True。それ以外の場合は false。 |
投げる | |
---|---|
DeviceNotAvailableException |
接続を確認する
public boolean checkConnectivity ()
デバイスがネットワークに接続されていることを確認します。
戻り値 | |
---|---|
boolean | デバイスに正常なネットワーク接続がある場合はtrue 、それ以外の場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
クリアエラーダイアログ
public boolean clearErrorDialogs ()
デバイス UI に現在表示されているエラー ダイアログを閉じてみます。
戻り値 | |
---|---|
boolean | ダイアログが存在しないか、ダイアログが正常にクリアされた場合はtrue 。それ以外の場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
ClearLastConnectedWifiネットワーク
public void clearLastConnectedWifiNetwork ()
最後に接続した Wi-Fi ネットワークをクリアします。これは、デバイスの再起動後に前のテストで使用された Wi-Fi ネットワークに接続するのを避けるために、新しい呼び出しを開始するときに呼び出す必要があります。
クリアログキャット
public void clearLogcat ()
蓄積された logcat データを削除します。
これは、ITestDevice#getLogcat()
が特定の時点 (新しいデバイス ビルドをフラッシュした後など) 以降に生成されたログ データのみを返すようにする場合に便利です。 Wifiネットワークに接続する
public boolean connectToWifiNetwork (wifiSsidToPsk, boolean scanSsid)
Wi-Fi ネットワークに接続します。
Wi-Fi をオンにし、wifiSsidToPsk マップで指定された Wi-Fi ネットワークの 1 つとの接続が成功するまでブロックします。接続が確立されると、インスタンスはITestDevice#disconnectFromWifi()
またはITestDevice#clearLastConnectedWifiNetwork()
が呼び出されるまで、再起動のたびに接続の復元を試みます。
パラメーター | |
---|---|
wifiSsidToPsk | |
scanSsid | boolean : このネットワークの非表示の SSID をスキャンするかどうか。 |
戻り値 | |
---|---|
boolean | Wi-Fi ネットワークに正常に接続された場合はtrue 。それ以外の場合はfalse |
投げる | |
---|---|
DeviceNotAvailableException |
Wifiネットワークに接続する
public boolean connectToWifiNetwork (String wifiSsid, String wifiPsk)
Wi-Fi ネットワークに接続します。
Wi-Fi をオンにし、指定された Wi-Fi ネットワークへの接続が成功するまでブロックします。接続が確立されると、インスタンスはITestDevice#disconnectFromWifi()
またはITestDevice#clearLastConnectedWifiNetwork()
が呼び出されるまで、再起動のたびに接続の復元を試みます。パラメーター | |
---|---|
wifiSsid | String : 接続する Wi-Fi ssid |
wifiPsk | String : PSK パスフレーズ、または暗号化されていない場合は null |
戻り値 | |
---|---|
boolean | Wi-Fi ネットワークに正常に接続された場合はtrue 。それ以外の場合はfalse |
投げる | |
---|---|
DeviceNotAvailableException |
Wifiネットワークに接続する
public boolean connectToWifiNetwork (wifiSsidToPsk)
Wi-Fi ネットワークに接続します。
Wi-Fi をオンにし、wifiSsidToPsk マップで指定された Wi-Fi ネットワークの 1 つとの接続が成功するまでブロックします。接続が確立されると、インスタンスはITestDevice#disconnectFromWifi()
またはITestDevice#clearLastConnectedWifiNetwork()
が呼び出されるまで、再起動のたびに接続の復元を試みます。
パラメーター | |
---|---|
wifiSsidToPsk |
戻り値 | |
---|---|
boolean | Wi-Fi ネットワークに正常に接続された場合はtrue 。それ以外の場合はfalse |
投げる | |
---|---|
DeviceNotAvailableException |
Wifiネットワークに接続する
public boolean connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid)
Wi-Fi ネットワークに接続します。
Wi-Fi をオンにし、指定された Wi-Fi ネットワークへの接続が成功するまでブロックします。接続が確立されると、インスタンスはITestDevice#disconnectFromWifi()
またはITestDevice#clearLastConnectedWifiNetwork()
が呼び出されるまで、再起動のたびに接続の復元を試みます。パラメーター | |
---|---|
wifiSsid | String : 接続する Wi-Fi ssid |
wifiPsk | String : PSK パスフレーズ、または暗号化されていない場合は null |
scanSsid | boolean : このネットワークの非表示の SSID をスキャンするかどうか。 |
戻り値 | |
---|---|
boolean | Wi-Fi ネットワークに正常に接続された場合はtrue 。それ以外の場合はfalse |
投げる | |
---|---|
DeviceNotAvailableException |
必要に応じて Wifi ネットワークに接続します
public boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid)
デバイスが現在ネットワークに接続していない場合にのみ接続するconnectToWifiNetwork(String, String)
のバリアント。
パラメーター | |
---|---|
scanSsid | boolean : このネットワークの非表示の SSID をスキャンするかどうか |
戻り値 | |
---|---|
boolean | Wi-Fi ネットワークに正常に接続された場合はtrue 。それ以外の場合はfalse |
投げる | |
---|---|
DeviceNotAvailableException |
必要に応じて Wifi ネットワークに接続します
public boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk)
デバイスが現在ネットワークに接続していない場合にのみ接続するconnectToWifiNetwork(String, String)
のバリアント。
戻り値 | |
---|---|
boolean | Wi-Fi ネットワークに正常に接続された場合は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 |
DeviceActionReceiver の登録を解除する
public void deregisterDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)
登録されたIDeviceActionReceiver
を削除します。
パラメーター | |
---|---|
deviceActionReceiver | IDeviceActionReceiver : 削除されるIDeviceActionReceiver 。 |
デバイスソフト再起動
public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
現在の system_server と以前の system_server ProcessInfo
を比較することで、デバイスがソフト再起動したかどうかを確認するヘルパー メソッド。 getProcessByName(String)
を使用してProcessInfo
を取得します。
パラメーター | |
---|---|
prevSystemServerProcess | ProcessInfo : 以前の system_server プロセスProcessInfo 。 |
戻り値 | |
---|---|
boolean | デバイスがソフト再起動された場合はtrue |
投げる | |
---|---|
DeviceNotAvailableException |
デバイスソフト再起動以来
public boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
デバイスとそのERROR(/TimeUnit)
からのエポック以降の UTC 時間以降にデバイスがソフト再起動したかどうかを確認するヘルパー メソッド。ソフト再起動とは、デバイスのハード リブート (例: 要求された再起動) 以外で再起動された system_server を指します。現在のデバイスの utcEpochTime (ミリ秒単位) はgetDeviceDate()
メソッドで取得できます。
パラメーター | |
---|---|
utcEpochTime | long : エポックからの秒単位のデバイス時間。 |
timeUnit | TimeUnit : 指定された utcEpochTime の時間単位TimeUnit 。 |
戻り値 | |
---|---|
boolean | デバイスがソフト再起動された場合はtrue |
投げる | |
---|---|
DeviceNotAvailableException |
AdbRootを無効にする
public boolean disableAdbRoot ()
adb root をオフにします。
adb root を無効にすると、デバイスが adb から切断される可能性があります。このメソッドは、デバイスが使用可能になるまでブロックされます。戻り値 | |
---|---|
boolean | 成功した場合はtrue 。 |
投げる | |
---|---|
DeviceNotAvailableException |
キーガードを無効にする
public void disableKeyguard ()
キーガードを無効にしようとします。
まず、入力ディスパッチの準備ができるまで待ちます。これは、デバイスが BOOT_COMPLETE を報告するのとほぼ同時に発生します。これは、現在のフレームワーク実装では時折競合状態が発生するため、明らかに非同期的に行われます。次に、キーガードを解除するコマンドが送信されます(安全でないキーガードでのみ機能します)
投げる | |
---|---|
DeviceNotAvailableException |
ネットワークモニターを無効にする
public boolean disableNetworkMonitor ()
デバイス上のネットワーク監視を無効にします。
戻り値 | |
---|---|
boolean | 監視が正常に無効化された場合はtrue 。失敗した場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
Wifiから切断する
public boolean disconnectFromWifi ()
Wi-Fi ネットワークから切断します。
既知のネットワークのリストからすべてのネットワークを削除し、Wi-Fi を無効にします。戻り値 | |
---|---|
boolean | Wi-Fi ネットワークから正常に切断された場合はtrue 。切断に失敗した場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
ファイルが存在しますか
public boolean doesFileExist (String deviceFilePath, int userId)
デバイス上に特定のユーザーのファイルが存在するかどうかを判断するヘルパー メソッド。
パラメーター | |
---|---|
deviceFilePath | String : チェックするデバイス上のファイルの絶対パス |
userId | int : ファイルの存在をチェックするユーザー ID |
戻り値 | |
---|---|
boolean | ファイルが存在する場合はtrue 、存在しない場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
ファイルが存在しますか
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 |
AdbRoot を有効にする
public boolean enableAdbRoot ()
adb root をオンにします。 「enable-root」設定が「false」の場合、メッセージをログに記録し、root を有効にせずに戻ります。
adb root を有効にすると、デバイスが adb から切断される可能性があります。このメソッドは、デバイスが使用可能になるまでブロックされます。戻り値 | |
---|---|
boolean | 成功した場合はtrue 。 |
投げる | |
---|---|
DeviceNotAvailableException |
ネットワークモニターを有効にする
public boolean enableNetworkMonitor ()
デバイス上のネットワーク監視を有効にします。
戻り値 | |
---|---|
boolean | 監視が正常に有効化された場合はtrue 。失敗した場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
実行Adbコマンド
public String executeAdbCommand (long timeout, String... cmdArgs)
指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。
代わりに、可能な限り、 executeShellCommand(String)
を使用してください。このメソッドの方が障害検出とパフォーマンスが向上します。
パラメーター | |
---|---|
timeout | long : デバイスが応答なしとみなされるまでの時間 (ミリ秒)、タイムアウトなしの場合は 0L |
cmdArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
実行Adbコマンド
public String executeAdbCommand (long timeout,envMap, String... cmdArgs)
指定されたタイムアウトで adb コマンドをシステム コマンドとして実行するヘルパー メソッド。
代わりに、可能な限り、 executeShellCommand(String)
を使用してください。このメソッドの方が障害検出とパフォーマンスが向上します。
パラメーター | |
---|---|
timeout | long : デバイスが応答なしとみなされるまでの時間 (ミリ秒)、タイムアウトなしの場合は 0L |
envMap | |
cmdArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
実行Adbコマンド
public String executeAdbCommand (String... cmdArgs)
adbコマンドをシステムコマンドとして実行するヘルパーメソッド。
代わりに、可能な限り、executeShellCommand(String)
を使用してください。このメソッドの方が障害検出とパフォーマンスが向上します。パラメーター | |
---|---|
cmdArgs | String : 実行する adb コマンドと引数 |
戻り値 | |
---|---|
String | コマンドからの標準出力。コマンドの実行に失敗した場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
高速起動コマンドの実行
public CommandResult executeFastbootCommand (String... cmdArgs)
fastboot コマンドをデフォルトのタイムアウト 2 分でシステム コマンドとして実行するヘルパー メソッド。
デバイスがすでに fastboot モードになっている場合に使用されることが予想されます。
パラメーター | |
---|---|
cmdArgs | String : 実行する fastboot コマンドと引数 |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含む CommandResult |
投げる | |
---|---|
DeviceNotAvailableException |
高速起動コマンドの実行
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 |
シェルコマンドの実行
public String executeShellCommand (String command)
adb シェル コマンドを実行し、出力をString
として返すヘルパー メソッド。
パラメーター | |
---|---|
command | String : 実行する adb シェル コマンド |
戻り値 | |
---|---|
String | シェルの出力 |
投げる | |
---|---|
DeviceNotAvailableException |
シェルコマンドの実行
public void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
コマンド動作を制御するためのより多くのパラメーターを使用して、ADBシェルコマンドを実行します。
パラメーター | |
---|---|
command | String :実行するADBシェルコマンド |
receiver | IShellOutputReceiver : IShellOutputReceiver がシェル出力を向けます。 |
maxTimeToOutputShellResponse | long : コマンドが応答を出力しないことが許可される最大時間。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse のユニット |
retryAttempts | int : 例外によりコマンドが失敗した場合にコマンドを再試行する最大回数。 retryAttempts正常に実行されなかった場合は、DeviceNotResponsiveException がスローされます。 |
投げる | |
---|---|
DeviceNotAvailableException |
executeshellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
コマンド動作を制御するためのより多くのパラメーターを使用して、ADBシェルコマンドを実行します。
パラメーター | |
---|---|
command | String :実行するADBシェルコマンド |
receiver | IShellOutputReceiver : IShellOutputReceiver がシェル出力を向けます。 |
maxTimeoutForCommand | long :コマンドが完了する最大タイムアウト。 timeUnit で指定された単位 |
maxTimeToOutputShellResponse | long : コマンドが応答を出力しないことが許可される最大時間。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse のユニット |
retryAttempts | int : 例外によりコマンドが失敗した場合にコマンドを再試行する最大回数。 retryAttempts正常に実行されなかった場合は、DeviceNotResponsiveException がスローされます。 |
投げる | |
---|---|
DeviceNotAvailableException |
executeshellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver)
指定されたADBシェルコマンドを実行し、コマンドが失敗した場合に複数回再試行します。
デフォルト値を持つexecuteShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
のよりシンプルな形式。パラメーター | |
---|---|
command | String :実行するADBシェルコマンド |
receiver | IShellOutputReceiver : IShellOutputReceiver がシェル出力を向けます。 |
投げる | |
---|---|
DeviceNotAvailableException |
executeshellv2command
public CommandResult executeShellV2Command (String cmd)
ADB Shellコマンドを実行し、コマンドステータス出力、STDOUT、STDERRを適切に入力したCommandResult
Resultとして結果を返すヘルパーメソッド。
パラメーター | |
---|---|
cmd | String :実行する必要があるコマンド。 |
戻り値 | |
---|---|
CommandResult | その結果、 CommandResult 。 |
投げる | |
---|---|
DeviceNotAvailableException |
executeshellv2command
public CommandResult executeShellV2Command (String cmd, OutputStream pipeToOutput)
ADB Shellコマンドを実行し、コマンドステータス出力とSTDERRを適切に入力したCommandResult
Resultとして結果を返すヘルパーメソッド。 stdoutは、指定されたストリームに向けられています。
パラメーター | |
---|---|
cmd | String :実行する必要があるコマンド。 |
pipeToOutput | OutputStream : ERROR(/OutputStream) STD出力がリダイレクトされる、またはnull。 |
戻り値 | |
---|---|
CommandResult | その結果、 CommandResult 。 |
投げる | |
---|---|
DeviceNotAvailableException |
executeshellv2command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput)
ADB Shellコマンドを実行し、コマンドステータス出力、STDOUT、STDERRを適切に入力したCommandResult
Resultとして結果を返すヘルパーメソッド。
パラメーター | |
---|---|
cmd | String :実行する必要があるコマンド。 |
pipeAsInput | File :コマンドまたはnullへの入力として配管されるERROR(/File) 。 |
戻り値 | |
---|---|
CommandResult | その結果、 CommandResult 。 |
投げる | |
---|---|
DeviceNotAvailableException |
executeshellv2command
public CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
コマンド動作を制御するためのより多くのパラメーターを使用して、ADBシェルコマンドを実行します。
パラメーター | |
---|---|
cmd | String :実行するADBシェルコマンド |
maxTimeoutForCommand | long :コマンドが完了する最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse のユニット |
retryAttempts | int : 例外によりコマンドが失敗した場合にコマンドを再試行する最大回数。 retryAttempts正常に実行されなかった場合は、DeviceNotResponsiveException がスローされます。 |
戻り値 | |
---|---|
CommandResult |
投げる | |
---|---|
DeviceNotAvailableException |
executeshellv2command
public CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit)
コマンド動作を制御するためのより多くのパラメーターを使用して、ADBシェルコマンドを実行します。
パラメーター | |
---|---|
cmd | String :実行するADBシェルコマンド |
maxTimeoutForCommand | long :コマンドが完了する最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse のユニット |
戻り値 | |
---|---|
CommandResult |
投げる | |
---|---|
DeviceNotAvailableException |
executeshellv2command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
コマンド動作を制御するためのより多くのパラメーターを使用して、ADBシェルコマンドを実行します。
パラメーター | |
---|---|
cmd | String :実行するADBシェルコマンド |
pipeAsInput | File :コマンドまたはnullへの入力として配管されるERROR(/File) 。 |
pipeToOutput | OutputStream : ERROR(/OutputStream) STD出力がリダイレクトされる、またはnull。 |
maxTimeoutForCommand | long :コマンドが完了する最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse のユニット |
retryAttempts | int : 例外によりコマンドが失敗した場合にコマンドを再試行する最大回数。 retryAttempts正常に実行されなかった場合は、DeviceNotResponsiveException がスローされます。 |
戻り値 | |
---|---|
CommandResult |
投げる | |
---|---|
DeviceNotAvailableException |
executeshellv2command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
コマンド動作を制御するためのより多くのパラメーターを使用して、ADBシェルコマンドを実行します。
パラメーター | |
---|---|
cmd | String :実行するADBシェルコマンド |
pipeAsInput | File :コマンドまたはnullへの入力として配管されるERROR(/File) 。 |
pipeToOutput | OutputStream : ERROR(/OutputStream) STD出力がリダイレクトされる、またはnull。 |
pipeToError | OutputStream : ERROR(/OutputStream) STDエラーがリダイレクトされる、またはnull。 |
maxTimeoutForCommand | long :コマンドが完了する最大タイムアウト。 timeUnit で指定された単位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse のユニット |
retryAttempts | int : 例外によりコマンドが失敗した場合にコマンドを再試行する最大回数。 retryAttempts正常に実行されなかった場合は、DeviceNotResponsiveException がスローされます。 |
戻り値 | |
---|---|
CommandResult |
投げる | |
---|---|
DeviceNotAvailableException |
fastbootwipepartition
public CommandResult fastbootWipePartition (String partition)
デバイスのパーティションを拭くヘルパーメソッド。
getUseFastbootErase()
がtrue
の場合、FastBoot消去を使用してパーティションをワイプします。次に、デバイスが次にデバイスが起動するときにファイルシステムを作成する必要があります。それ以外の場合は、デバイス上に新しいファイルシステムを作成するFastBoot形式が使用されます。デバイスが既にFastBootモードになっている場合に使用されると予想されます。パラメーター | |
---|---|
partition | String :ワイプするパーティション |
戻り値 | |
---|---|
CommandResult | コマンドの出力を含むcommandResult |
投げる | |
---|---|
DeviceNotAvailableException |
getactiveapexes
publicgetActiveApexes ()
デバイスでアクティブ化されたApexesに関する情報を取得します。
戻り値 | |
---|---|
現在デバイスでアクティブ化されているApexInfo のERROR(/Set) |
投げる | |
---|---|
DeviceNotAvailableException |
getallsettings
publicgetAllSettings (String namespace)
要求された名前空間のキー値のペアを返します。
パラメーター | |
---|---|
namespace | String :{"system"、 "secure"、 "global"の1つでなければなりません} |
戻り値 | |
---|---|
キー値のペアのマップ。名前空間がサポートされていない場合はnull。 |
投げる | |
---|---|
DeviceNotAvailableException |
GetAllocationState
public DeviceAllocationState getAllocationState ()
デバイスの現在の割り当て状態を返します
戻り値 | |
---|---|
DeviceAllocationState |
getandroidid
public String getAndroidId (int userId)
ユーザーIDに関連付けられたAndroid-IDを見つけて返します。
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
String |
投げる | |
---|---|
DeviceNotAvailableException |
getandroidids
publicgetAndroidIds ()
一致するユーザーIDを見つけたAndroid IDのマップを作成します。各ユーザーIDがこの関数に関連付けられているAndroid IDを見つけたという保険はありません。そのため、一部のユーザーIDはnullと一致する可能性があります。
戻り値 | |
---|---|
Android IDのマップは、一致するユーザーIDを見つけました。 |
投げる | |
---|---|
DeviceNotAvailableException |
getapilevel
public int getApiLevel ()
デバイスAPIレベルを取得します。デフォルトはUNKNOWN_API_LEVEL
になります。
戻り値 | |
---|---|
int | デバイスのAPIレベルを示す整数 |
投げる | |
---|---|
DeviceNotAvailableException |
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
デバイスにインストールされているパッケージに関する情報を取得します。
パラメーター | |
---|---|
packageName | String |
戻り値 | |
---|---|
PackageInfo | 情報を取得できなかった場合のPackageInfo またはnull |
投げる | |
---|---|
DeviceNotAvailableException |
getAppPackageInfos
publicgetAppPackageInfos ()
デバイスにインストールされているパッケージの情報を取得します。
戻り値 | |
---|---|
デバイスにインストールされたPackageInfo のERROR(/List) 。 |
投げる | |
---|---|
DeviceNotAvailableException |
GetBaseBandversion
public String getBasebandVersion ()
このデバイスのベースバンド(無線)バージョンを取得するための利便性方法。ラジオバージョンを取得することはデバイス固有のため、すべてのデバイスの正しい情報を返さない場合があります。この方法は、GSM.Version.BaseBandプロパリーに依存して、正しいバージョン情報を返します。これは一部のCDMAデバイスでは正確ではなく、ここで返されるバージョンはFastBootから報告されたバージョンと一致しない可能性があり、CDMA無線のバージョンを返さない場合があります。 TL; DRこのメソッドは、GSM.Version.BaseBandプロパティがfastboot getvar version-baseband
によって返されたバージョンと同じである場合にのみ正確なバージョンを報告します。
戻り値 | |
---|---|
String | String BaseBandバージョンまたはnull が決定できない場合(デバイスには無線またはバージョンの文字列を読み取れない) |
投げる | |
---|---|
DeviceNotAvailableException |
GetBattery
public Integer getBattery ()
バッテリーレベルが利用できない場合は、デバイスまたはnullの現在のバッテリーレベルを返します。
戻り値 | |
---|---|
Integer |
GetBooleAnProperty
public boolean getBooleanProperty (String name, boolean defaultValue)
指定されたプロパティのブール値を返します。
パラメーター | |
---|---|
name | String :プロパティ名 |
defaultValue | boolean :プロパティが空または存在しない場合に返されるデフォルト値。 |
戻り値 | |
---|---|
boolean | プロパティfalse 値"1" 、 "y" 、 "yes" 、 "on" 、または"true" がある場合は、プロパティ"0" 、 "n" 、 "no" 、 "off" の値がある場合はtrue "false" 、またはそれ以外の場合はdefaultValue 。 |
投げる | |
---|---|
DeviceNotAvailableException |
GetBoothistory
publicgetBootHistory ()
ヘルパーメソッドは、起動時間と起動理由でブート履歴マップを収集します。
戻り値 | |
---|---|
ブート時間のマップ(エポック以来の2番目のUTC時間)と起動の理由 |
投げる | |
---|---|
DeviceNotAvailableException |
getboothistorys
publicgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
ヘルパーメソッドは、デバイスからのエポック以来の特定の時間と指定された時間ユニット以降、ブートタイムとブーツの理由でブート履歴マップを収集します。 Millisecondでの現在のデバイスUtcePochtimeは、Method getDeviceDate()
で取得できます。
パラメーター | |
---|---|
utcEpochTime | long :エポック以来のデバイス時間。 |
timeUnit | TimeUnit :Time Unit TimeUnit 。 |
戻り値 | |
---|---|
ブート時間のマップ(エポック以来の2番目のUTC時間)と起動の理由 |
投げる | |
---|---|
DeviceNotAvailableException |
getBootLoaderVersion
public String getBootloaderVersion ()
このデバイスのブートローダーバージョンを取得するための利便性方法。
デバイスの現在の状態からブートローダーバージョンを取得しようとします。 (つまり、デバイスがFastBootモードの場合、FastBootからバージョンを取得しようとします)戻り値 | |
---|---|
String | String bootloaderバージョンまたはnull 見つからない場合 |
投げる | |
---|---|
DeviceNotAvailableException |
GetBugReport
public InputStreamSource getBugreport ()
デバイスからバグラポートを取得します。
これの実装は、SDカード(またはSDCardがまだマウントされていない場合)を使用してデバイスで引き続き作業し続けることが保証されています。
戻り値 | |
---|---|
InputStreamSource | オンデマンドでバグポートの内容を生成するInputStreamSource 。障害の場合、 InputStreamSource 空のERROR(/InputStream) を生成します。 |
GetBugreportz
public InputStreamSource getBugreportz ()
デバイスからブグレポルツを取得します。 zip形式のバグラポートには、デバッグに役立つメインのバグポートおよびその他のログファイルが含まれています。
「ADBバージョン」> 1.0.36のみサポートされています
戻り値 | |
---|---|
InputStreamSource | bugreportzを含むzipファイルのInputStreamSource 、障害の場合にnullを返します。 |
GetBuildalias
public String getBuildAlias ()
デバイスが現在実行されているビルドのエイリアスを取得します。
ビルドエイリアスは通常、ビルドIDよりも読みやすい文字列です(通常、Nexusビルドの数字)。たとえば、最終的なAndroid 4.2リリースでは、エイリアスJDQ39をビルドし、ID 573038をビルドしています
戻り値 | |
---|---|
String | ビルドエイリアスまたはそれが取得できなかった場合にビルドIDに戻るか |
投げる | |
---|---|
DeviceNotAvailableException |
getBuildFlavor
public String getBuildFlavor ()
デバイスのビルドフレーバーを取得します。
戻り値 | |
---|---|
String | それが取得できなかった場合、ビルドフレーバーまたはヌル |
投げる | |
---|---|
DeviceNotAvailableException |
getBuildId
public String getBuildId ()
デバイスが現在実行されているビルドを取得します。
戻り値 | |
---|---|
String | ビルドIDまたはIBuildInfo#UNKNOWN_BUILD_ID それが取得できなかった場合 |
投げる | |
---|---|
DeviceNotAvailableException |
GetBuildSigingKeys
public String getBuildSigningKeys ()
デバイスの画像に署名するために使用されるキータイプを返します
通常、Androidデバイスは、テストキー(AOSPのような)またはリリースキー(個々のデバイスメーカーによって制御)で署名することができます
戻り値 | |
---|---|
String | 署名キーが見つかった場合、それ以外の場合はnull。 |
投げる | |
---|---|
DeviceNotAvailableException |
GetCachedDevicedEScriptor
public DeviceDescriptor getCachedDeviceDescriptor ()
デバイスが割り当てられている場合は、キャッシュDeviceDescriptor
れたDeviceDescriptor
を返します。
戻り値 | |
---|---|
DeviceDescriptor |
GetCachedDevicedEScriptor
public DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
デバイスが割り当てられている場合は、キャッシュDeviceDescriptor
れたDeviceDescriptor
を返します。
パラメーター | |
---|---|
shortDescriptor | boolean :記述子を最小限の情報に制限するかどうか |
戻り値 | |
---|---|
DeviceDescriptor |
getchildren
public String[] getChildren (String path)
許可のために時々機能しないIFileEntry
使用する代わりに。
パラメーター | |
---|---|
path | String :検索を行うデバイスのパスですか |
戻り値 | |
---|---|
String[] | デバイス上のパスにすべてのファイルを含む文字列の配列。 |
投げる | |
---|---|
DeviceNotAvailableException |
GetCurrentFoldablestate
public DeviceFoldableState getCurrentFoldableState ()
いくつかの問題が発生した場合、デバイスまたはnullの現在の折りたたみ可能な状態を返します。
戻り値 | |
---|---|
DeviceFoldableState |
投げる | |
---|---|
DeviceNotAvailableException |
GetCurrentuser
public int getCurrentUser ()
現在の実行ユーザーのIDを返します。エラーの場合、-10000を返します。
戻り値 | |
---|---|
int |
投げる | |
---|---|
DeviceNotAvailableException |
getDeviceTATE
public long getDeviceDate ()
エポック以来、デバイスの日付をミリ秒単位で返します。
戻り値 | |
---|---|
long | エポック形式のデバイスの日付。 |
投げる | |
---|---|
DeviceNotAvailableException |
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor ()
デバイス情報からDeviceDescriptor
を返して、実際のデバイスオブジェクトを渡すことなく情報を取得します。
戻り値 | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
デバイス情報からDeviceDescriptor
を返して、実際のデバイスオブジェクトを渡すことなく情報を取得します。
パラメーター | |
---|---|
shortDescriptor | boolean :記述子を最小限の情報に制限するかどうか |
戻り値 | |
---|---|
DeviceDescriptor |
getDeviceTimeOffset
public long getDeviceTimeOffset (Date date)
デバイスと特定のERROR(/Date)
の間の時差を取得するヘルパー。エポック時間を内部で使用します。
パラメーター | |
---|---|
date | Date |
戻り値 | |
---|---|
long | ミリ秒の違い |
投げる | |
---|---|
DeviceNotAvailableException |
GetEmulatorOutput
public InputStreamSource getEmulatorOutput ()
エミュレータSTDOUTとSTDERRのストリームを取得します
戻り値 | |
---|---|
InputStreamSource | エミュレータ出力 |
GeteMulatorProcess
public Process getEmulatorProcess ()
このエミュレータに対応するProcess
を返します。
戻り値 | |
---|---|
Process | Process またはnull |
getexecuteshellcommandlog
public final File getExecuteShellCommandLog ()
すべてのexecuteShellCommand(String)
ログを含むログ。
戻り値 | |
---|---|
File |
GetExternalStoreFreespace
public long getExternalStoreFreeSpace ()
デバイス外部ストレージ上の自由空間の量を決定するヘルパー方法。
戻り値 | |
---|---|
long | KBの空きスペースの量 |
投げる | |
---|---|
DeviceNotAvailableException |
GetFastBootPath
public String getFastbootPath ()
使用されているFastBootバイナリのパスを返します。それでも、FastBoot関数を有効にするために、 isFastbootEnabled()
真である必要があります。
戻り値 | |
---|---|
String |
GetFastBootProductType
public String getFastbootProductType ()
このデバイスの製品タイプをFastBootモードで取得するための利便性方法。
この方法は、デバイスがFastBootである場合にのみ使用する必要があります。この場合、genericgetProductType()
メソッドよりも少し安全なバリアントです。これは、デバイスが誤った状態にあるか、反応しない場合、デバイスをFastBootに回復することを知っているためです。戻り値 | |
---|---|
String | String 製品タイプの名前またはnull が決定できない場合 |
投げる | |
---|---|
DeviceNotAvailableException |
GetFastBootProductVariant
public String getFastbootProductVariant ()
このデバイスの製品タイプをFastBootモードで取得するための利便性方法。
この方法は、デバイスがFastBootである場合にのみ使用する必要があります。この場合、genericgetProductType()
メソッドよりも少し安全なバリアントです。これは、デバイスが誤った状態にあるか、反応しない場合、デバイスをFastBootに回復することを知っているためです。戻り値 | |
---|---|
String | String 製品タイプの名前またはnull が決定できない場合 |
投げる | |
---|---|
DeviceNotAvailableException |
GetFastBootSerialNumber
public String getFastbootSerialNumber ()
FastBootモードのシリアル番号を返します。
戻り値 | |
---|---|
String |
getFastBootVariable
public String getFastbootVariable (String variableName)
デバイスから指定されたFastBoot変数値を取得します。
パラメーター | |
---|---|
variableName | String :変数名 |
戻り値 | |
---|---|
String | 存在しない場合のプロパティ値またはnull |
投げる | |
---|---|
DeviceNotAvailableException |
GetFastBootversion
public String getFastbootVersion ()
使用されているFastBootバイナリのバージョン文字列を返します。または何かがうまくいかない場合はnull。
戻り値 | |
---|---|
String |
GetFileEntry
public IFileEntry getFileEntry (String path)
デバイス上のリモートファイルへの参照を取得します。
パラメーター | |
---|---|
path | String :取得するファイルパス。 「/」に比べて絶対的なパスまたはパスにすることができます。 (つまり、「/システム」と「システム」構文の両方がサポートされています) |
戻り値 | |
---|---|
IFileEntry | 指定されたpathでファイルが見つからない場合は、 IFileEntry またはnull |
投げる | |
---|---|
DeviceNotAvailableException |
GetFileEntry
public IFileEntry getFileEntry (FileListingService.FileEntry entry)
非公式のヘルパーでは、非ルートパスからFileEntry
を取得します。 FIXME:FileEntryシステムをリファクタリングして、任意のパスから使用できるようにします。 (非根も)。
パラメーター | |
---|---|
entry | FileListingService.FileEntry :ddmlibが要求するように必ずしもrootではないFileEntry 。 |
戻り値 | |
---|---|
IFileEntry | FileEntryを表すFileEntryWrapper。 |
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
GetFoldAblestates
publicgetFoldableStates ()
デバイス上の折りたたみ可能な状態のリストを返します。 「cmd device_state print-states」で入手できます。
戻り値 | |
---|---|
投げる | |
---|---|
DeviceNotAvailableException |
getidevice
public IDevice getIDevice ()
関連するddmlib IDevice
への参照を返します。
IDevice
DDMSによって割り当てられる場合があります。したがって、発信者は、その参照が古くなる可能性があるため、 IDevice
への参照を維持するべきではありません。戻り値 | |
---|---|
IDevice | IDevice |
getInStalledPackageNames
publicgetInstalledPackageNames ()
デバイスに存在するアプリケーションパッケージ名を取得します。
戻り値 | |
---|---|
デバイスに現在インストールされているString パッケージ名のERROR(/Set) 。 |
投げる | |
---|---|
DeviceNotAvailableException |
GetIntProperty
public long getIntProperty (String name, long defaultValue)
デバイスから指定されたプロパティの整数値を返します。
パラメーター | |
---|---|
name | String :プロパティ名 |
defaultValue | long :プロパティが空であるか、存在しない場合に返されるデフォルト値。 |
戻り値 | |
---|---|
long | プロパティ値またはdefaultValue プロパティが空であるか、存在しない、または整数値がない場合。 |
投げる | |
---|---|
DeviceNotAvailableException |
getipAddress
public String getIpAddress ()
デバイスのIPアドレスを取得します。
戻り値 | |
---|---|
String | デバイスのIPアドレス、またはデバイスにIPアドレスがない場合はnull |
投げる | |
---|---|
DeviceNotAvailableException |
GetKeyGuardState
public KeyguardControllerState getKeyguardState ()
オブジェクトを返して、サポートされていない場合は、キューアードまたはnullの現在の状態を取得します。
戻り値 | |
---|---|
KeyguardControllerState | キーガードの状態のスナップショットを含むKeyguardControllerState と、キーガードクエリがサポートされていない場合はnullを返します。 |
投げる | |
---|---|
DeviceNotAvailableException |
getLastExpectedReboottimemillis
public long getLastExpectedRebootTimeMillis ()
System.currentTimeMillis()
によって返されたエポック以来、tradefed APIが最後に再起動をトリガーしました。
戻り値 | |
---|---|
long |
GetLaunchApilevel
public int getLaunchApiLevel ()
デバイスの最初に起動したAPIレベルを取得します。デフォルトはUNKNOWN_API_LEVEL
になります。
戻り値 | |
---|---|
int | 最初に起動したAPIレベルのデバイスを示す整数 |
投げる | |
---|---|
DeviceNotAvailableException |
GetLogcat
public InputStreamSource getLogcat ()
ログキャットデータのスナップショットストリームをつかみます。
2つのモードで動作します:
TestDeviceOptions.getMaxLogcatDataSize()
に戻りますlogcat capture戻り値 | |
---|---|
InputStreamSource |
GetLogcat
public InputStreamSource getLogcat (int maxBytes)
キャプチャされたLogCatデータの最後のmaxBytes
スナップショットストリームをつかみます。
getLogcat()
ショット全体を取得するという潜在的に大きなディスクスペースのペナルティを負うことなく、キャプチャされたログキャットデータの頻繁なスナップショットをキャプチャしたい場合に役立ちます。
パラメーター | |
---|---|
maxBytes | int :返すデータの最大量。メモリに快適に収まることができる量である必要があります |
戻り値 | |
---|---|
InputStreamSource |
getlogcatdump
public InputStreamSource getLogcatDump ()
デバイス用の現在のログキャットのダンプを取得します。 getLogcat()
とは異なり、このメソッドは常にログキャットの静的ダンプを返します。
デバイスが到達できない場合、何も返されないという欠点があります。
戻り値 | |
---|---|
InputStreamSource | logcatデータのInputStreamSource 。 LogCatデータをキャプチャできない場合、空のストリームが返されます。 |
GetLogcatsince
public InputStreamSource getLogcatSince (long date)
提供された日付を開始するキャプチャされたログキャットデータのスナップショットストリームをつかみます。デバイス上の時間getDeviceDate()
使用する必要があります。
パラメーター | |
---|---|
date | long :スナップショットをいつ開始するかという時代のエポック形式以来、ミリ秒で存在するまで。 (「日付 +%s」を使用して取得できます) |
戻り値 | |
---|---|
InputStreamSource |
GetMacAddress
public String getMacAddress ()
デバイスのMACアドレスを返します。デバイスからクエリに失敗した場合はnullです。
戻り値 | |
---|---|
String |
getMainUserid
public Integer getMainUserId ()
メインユーザーIDを返します。
戻り値 | |
---|---|
Integer | メインユーザーのユーザーIDがある場合は、メインユーザーがない場合はnull。 |
投げる | |
---|---|
DeviceNotAvailableException |
getMainLineModuleinfo
publicgetMainlineModuleInfo ()
デバイスにインストールされているメインラインモジュールに関する情報を取得します。
戻り値 | |
---|---|
現在デバイスにインストールされているString メインラインモジュールのERROR(/Set) 。 |
投げる | |
---|---|
DeviceNotAvailableException |
getMaxNumberOfRunningUsersSupported
public int getMaxNumberOfRunningUsersSupported ()
サポートされている同時に実行されているユーザーの最大数を取得します。デフォルトは0です。
戻り値 | |
---|---|
int | 同時に実行されているユーザーの数を示す整数 |
投げる | |
---|---|
DeviceNotAvailableException |
GetMaxNumberOfUsersSupported
public int getMaxNumberOfUsersSupported ()
サポートされているユーザーの最大数を取得します。デフォルトは0です。
戻り値 | |
---|---|
int | サポートされているユーザーの数を示す整数 |
投げる | |
---|---|
DeviceNotAvailableException |
getMicrodroidProcess
public Process getMicrodroidProcess ()
戻り値 | |
---|---|
Process | マイクロドロイドVMのプロセスを返します。 testDeviceがマイクロドロイドでない場合、NULLを返します。 |
GetMonitor
public IDeviceStateMonitor getMonitor ()
デバイスに関連付けられたIDeviceStateMonitor
を返します。
戻り値 | |
---|---|
IDeviceStateMonitor |
GetMountPoint
public String getMountPoint (String mountName)
マウントポイントを返します。
IDevice
のキャッシュされた情報が利用できない場合は、デバイスを直接照会します。 TODO:この動作をIDevice#getMountPoint(String)
に移動しますパラメーター | |
---|---|
mountName | String :マウントポイントの名前 |
戻り値 | |
---|---|
String | マウントポイントまたはnull |
getMountPointInfo
public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
指定されたマウントポイントパスに対応するMountPointInfo
を返します。または、そのパスにマウントされていない、またはMountPointとして /Proc /Mountsに表示されない場合はnull
返します。
パラメーター | |
---|---|
mountpoint | String |
戻り値 | |
---|---|
ITestDevice.MountPointInfo | 「/proc/mounts」に情報を含むMountPointInfo のERROR(/List) |
投げる | |
---|---|
DeviceNotAvailableException |
getMountPointInfo
publicgetMountPointInfo ()
デバイスに /proc /マウントの情報の解析バージョンを返します
戻り値 | |
---|---|
「/proc/mounts」に情報を含むMountPointInfo のERROR(/List) |
投げる | |
---|---|
DeviceNotAvailableException |
getオプション
public TestDeviceOptions getOptions ()
デバイスのテストオプションを取得します。
戻り値 | |
---|---|
TestDeviceOptions | テスト中のデバイスに関連するTestDeviceOptions 。 |
getPartitionFreespace
public long getPartitionFreeSpace (String partition)
デバイスパーティションの自由空間の量を決定するヘルパー方法。
パラメーター | |
---|---|
partition | String |
戻り値 | |
---|---|
long | KBの空きスペースの量 |
投げる | |
---|---|
DeviceNotAvailableException |
getprimaryuserid
public Integer getPrimaryUserId ()
プライマリユーザーIDを返します。
戻り値 | |
---|---|
Integer | プライマリユーザーのユーザーIDがある場合は、プライマリユーザーがない場合はnull。 |
投げる | |
---|---|
DeviceNotAvailableException |
getProcessByname
public ProcessInfo getProcessByName (String processName)
ヘルパーメソッドは、「PIDOF」および「STAT」コマンドを実行し、PIDおよびProcessの開始時間を使用してProcessInfo
オブジェクトを返します。
パラメーター | |
---|---|
processName | String :Proces名文字列。 |
戻り値 | |
---|---|
ProcessInfo | 指定されたProcessNameのProcessInfo |
投げる | |
---|---|
DeviceNotAvailableException |
getProcessPid
public String getProcessPid (String process)
何かがうまくいかなかった場合、サービスまたはヌルのPIDを返します。
パラメーター | |
---|---|
process | String :Proces名文字列。 |
戻り値 | |
---|---|
String |
投げる | |
---|---|
DeviceNotAvailableException |
getProductType
public String getProductType ()
このデバイスの製品タイプを取得するための利便性方法。
この方法は、デバイスがADBまたはFastBootモードのいずれかである場合に機能します。戻り値 | |
---|---|
String | String 製品タイプ名。ヌルにはなりません |
投げる | |
---|---|
DeviceNotAvailableException |
GetProductVariant
public String getProductVariant ()
このデバイスの製品バリアントを取得するための利便性方法。
この方法は、デバイスがADBまたはFastBootモードのいずれかである場合に機能します。戻り値 | |
---|---|
String | String 製品のバリアント名またはnull が決定できない場合 |
投げる | |
---|---|
DeviceNotAvailableException |
GetProperty
public String getProperty (String name)
デバイスから指定されたプロパティ値を取得します。
パラメーター | |
---|---|
name | String :プロパティ名 |
戻り値 | |
---|---|
String | 存在しない場合のプロパティ値またはnull |
投げる | |
---|---|
DeviceNotAvailableException |
GetRecoveryMode
public ITestDevice.RecoveryMode getRecoveryMode ()
デバイスに使用される現在の回復モードを取得します。
戻り値 | |
---|---|
ITestDevice.RecoveryMode | デバイスに使用される現在の回復モード。 |
GetScreenshot
public InputStreamSource getScreenshot (String format)
デバイスからスクリーンショットをつかみます。代わりにGetScreenshot(フォーマット)を使用することをお勧めします。
パラメーター | |
---|---|
format | String :サポートPNG、JPEG |
戻り値 | |
---|---|
InputStreamSource | スクリーンショットのInputStreamSource 形式の、またはスクリーンショットが成功しなかった場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
GetScreenshot
public InputStreamSource getScreenshot (long displayId)
ディスプレイIDを指定したデバイスからスクリーンショットをつかみます。フォーマットはPNGです。
TODO:上記の実装を拡張して、「フォーマット」と「リスペール」をサポートする
パラメーター | |
---|---|
displayId | long :画面の表示IDからスクリーンショットを取得します。 |
戻り値 | |
---|---|
InputStreamSource | スクリーンショットのInputStreamSource 形式の、またはスクリーンショットが成功しなかった場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
GetScreenshot
public InputStreamSource getScreenshot (String format, boolean rescale)
デバイスからスクリーンショットをつかみます。代わりにgetScreenshot(String)
を使用することをお勧めします。
パラメーター | |
---|---|
format | String :サポートPNG、JPEG |
rescale | boolean :結果の画像のサイズを減らすためにスクリーンショットを再スケーリングする必要がある場合 |
戻り値 | |
---|---|
InputStreamSource | スクリーンショットのInputStreamSource 形式の、またはスクリーンショットが成功しなかった場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
GetScreenshot
public InputStreamSource getScreenshot ()
デバイスからスクリーンショットをつかみます。
戻り値 | |
---|---|
InputStreamSource | PNG形式のスクリーンショットのInputStreamSource 、またはスクリーンショットが成功しなかった場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
getSetting
public String getSetting (int userId, String namespace, String key)
要求された設定の値を返します。名前空間は次のいずれかでなければなりません:{"system"、 "secure"、 "global"}
パラメーター | |
---|---|
userId | int |
namespace | String |
key | String |
戻り値 | |
---|---|
String | 名前空間に関連付けられている値:ユーザーのキー。見つからない場合はヌル。 |
投げる | |
---|---|
DeviceNotAvailableException |
getSetting
public String getSetting (String namespace, String key)
getSetting(int, String, String)
参照し、システムユーザーで実行します。
パラメーター | |
---|---|
namespace | String |
key | String |
戻り値 | |
---|---|
String |
投げる | |
---|---|
DeviceNotAvailableException |
GetSimoperator
public String getSimOperator ()
使用できない場合、またはデバイスが利用できない場合は、SIMカードオペレーターまたはnullを返します。
戻り値 | |
---|---|
String |
GetSimState
public String getSimState ()
使用できない場合はSIMカード状態またはnullを返します。
戻り値 | |
---|---|
String |
墓石を取得する
publicgetTombstones ()
デバイスから墓石のリストを取得して返します。ルートが必要です。
メソッドは最適なものであるため、何らかの理由で1つの墓石が引っ張られない場合、リストから欠落します。 DeviceNotAvailableException
のみがメソッドを早期に終了します。
戻り値 | |
---|---|
墓石がない場合は空の墓石ファイルのリスト。 |
投げる | |
---|---|
DeviceNotAvailableException |
gettotalmemory
public long getTotalMemory ()
内部エラーの場合、バイトまたは-1の合計物理メモリサイズを返します
戻り値 | |
---|---|
long |
getUninStallablePackageNames
publicgetUninstallablePackageNames ()
アンインストールできるアプリケーションパッケージ名を取得します。これは現在、非システムパッケージとして定義されており、システムパッケージが更新されています。
戻り値 | |
---|---|
デバイスに現在インストールされているアンインストール可能なString パッケージ名のERROR(/Set) 。 |
投げる | |
---|---|
DeviceNotAvailableException |
getUseFastBooterase
public boolean getUseFastbootErase ()
FastBoot EraseまたはFastBoot形式を使用して、デバイス上のパーティションをワイプするかどうかを取得します。
戻り値 | |
---|---|
boolean | FastBoot消去が使用される場合、またはFastBoot形式false 使用される場合はtrue 。 |
getUserflags
public int getUserFlags (int userId)
特定のユーザーのフラグを見つけて返します。フラグは、Androidオープンソースプロジェクトの「Android.content.pm.userinfo」クラスで定義されています。
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
int | 他のケースで-10000が見つかった場合に提供されたユーザーIDに関連付けられたフラグ。 |
投げる | |
---|---|
DeviceNotAvailableException |
getuserinfos
publicgetUserInfos ()
デバイス上のuseidのマップをUserInfo
に取得します。デバイスからの出力が予想されていない場合、 DeviceRuntimeException
を投げます。
戻り値 | |
---|---|
userinfoオブジェクトのリスト。 |
投げる | |
---|---|
DeviceNotAvailableException |
getuserserialnumber
public int getUserSerialNumber (int userId)
見つかった場合は、ユーザーIDに関連付けられたシリアル番号を返し、他の場合は-10000を返します。
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
int |
投げる | |
---|---|
DeviceNotAvailableException |
HandlealLocationEvent
public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)
指定されたDeviceEventを処理します。デバイスを新しい状態に移行できます。 IDeviceMonitor
に州の移行を通知します。
DeviceEventを処理します。このデバイスは、このデバイスを新しい割り当て状態に遷移する場合と変化させない場合があります。
パラメーター | |
---|---|
event | DeviceEvent |
戻り値 | |
---|---|
IManagedTestDevice.DeviceEventResponse |
Hasfeature
public boolean hasFeature (String feature)
デバイスで機能が利用可能かどうかを確認してください。
パラメーター | |
---|---|
feature | String :どの形式が「機能」になるはずです: |
戻り値 | |
---|---|
boolean | 機能が見つかった場合、それ以外の場合はfalse。 |
投げる | |
---|---|
DeviceNotAvailableException |
インストールパッケージ
public String installPackage (File packageFile, boolean reinstall, String... extraArgs)
デバイスにAndroidパッケージをインストールします。
パラメーター | |
---|---|
packageFile | File :インストールするAPKファイル |
reinstall | boolean :再インストールを実行する必要がある場合はtrue |
extraArgs | String :合格するオプションの追加引数。利用可能なオプションについては、「ADB Shell PM -H」を参照してください。 |
戻り値 | |
---|---|
String | エラーコードを備えたString 、または成功の場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
インストールパッケージ
public String installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs)
デバイスにAndroidパッケージをインストールします。
注:インストール時にランタイム許可を付与することを明示的に制御する必要があるユースケースのみがこの関数を呼び出す必要があります。
パラメーター | |
---|---|
packageFile | File :インストールするAPKファイル |
reinstall | boolean :再インストールを実行する必要がある場合はtrue |
grantPermissions | boolean :すべてのランタイムアクセス許可がインストール時に付与される必要がある場合 |
extraArgs | String :合格するオプションの追加引数。利用可能なオプションについては、「ADB Shell PM -H」を参照してください。 |
戻り値 | |
---|---|
String | エラーコードを備えたString 、または成功の場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
InstallPackageForuser
public String installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs)
特定のユーザー用のデバイスにAndroidパッケージをインストールします。
パラメーター | |
---|---|
packageFile | File :インストールするAPKファイル |
reinstall | boolean :再インストールを実行する必要がある場合はtrue |
userId | int :インストールする整数ユーザーID。 |
extraArgs | String :合格するオプションの追加引数。利用可能なオプションについては、「ADB Shell PM -H」を参照してください。 |
戻り値 | |
---|---|
String | エラーコードを備えたString 、または成功の場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
InstallPackageForuser
public String installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)
特定のユーザー用のデバイスにAndroidパッケージをインストールします。
注:インストール時にランタイム許可を付与することを明示的に制御する必要があるユースケースのみがこの関数を呼び出す必要があります。
パラメーター | |
---|---|
packageFile | File :インストールするAPKファイル |
reinstall | boolean :再インストールを実行する必要がある場合はtrue |
grantPermissions | boolean :すべてのランタイムアクセス許可がインストール時に付与される必要がある場合 |
userId | int :インストールする整数ユーザーID。 |
extraArgs | String :合格するオプションの追加引数。利用可能なオプションについては、「ADB Shell PM -H」を参照してください。 |
戻り値 | |
---|---|
String | エラーコードを備えたString 、または成功の場合はnull 。 |
投げる | |
---|---|
DeviceNotAvailableException |
無効化プロパルタイカッシュ
public void invalidatePropertyCache ()
ISADBTCP
public boolean isAdbTcp ()
戻り値 | |
---|---|
boolean |
IsAppEnumerationSupported
public boolean isAppEnumerationSupported ()
プラットフォーム上のプラットフォームがアプリの列挙をサポートするかどうかを確認します
戻り値 | |
---|---|
boolean | アプリの列挙がサポートされている場合、それ以外の場合はtrue |
投げる | |
---|---|
DeviceNotAvailableException |
isbypasslowtargetsdkblocksupported
public boolean isBypassLowTargetSdkBlockSupported ()
プラットフォーム上のプラットフォームがアプリのインストールで低いターゲットSDKブロックのバイパスをサポートするかどうかを確認します
戻り値 | |
---|---|
boolean | 低いターゲットSDKブロックがサポートされている場合、それ以外の場合はtrue |
投げる | |
---|---|
DeviceNotAvailableException |
isdeviceEncrypted
public boolean isDeviceEncrypted ()
デバイスが暗号化されている場合は返されます。
戻り値 | |
---|---|
boolean | デバイスが暗号化されている場合はtrue 。 |
投げる | |
---|---|
DeviceNotAvailableException |
iSDirectory
public boolean isDirectory (String path)
デバイス上のパスがディレクトリである場合はtrueを返し、それ以外の場合はfalse。
パラメーター | |
---|---|
path | String |
戻り値 | |
---|---|
boolean |
投げる | |
---|---|
DeviceNotAvailableException |
ISENABLEADBROOT
public boolean isEnableAdbRoot ()
戻り値 | |
---|---|
boolean | ADBルートをデバイスで有効にする必要がある場合はtrue |
IsEncryptionsupported
public boolean isEncryptionSupported ()
デバイスで暗号化がサポートされている場合は返されます。
戻り値 | |
---|---|
boolean | デバイスが暗号化をサポートする場合はtrue 。 |
投げる | |
---|---|
DeviceNotAvailableException |
exexecutable
public boolean isExecutable (String fullPath)
デバイス上のファイルパスが実行可能ファイルである場合はtrueを返します。
パラメーター | |
---|---|
fullPath | String |
戻り値 | |
---|---|
boolean |
投げる | |
---|---|
DeviceNotAvailableException |
isfastBootenabled
public boolean isFastbootEnabled ()
デバイスでFastBootが使用可能である場合は返します。
戻り値 | |
---|---|
boolean |
isheadless
public boolean isHeadless ()
デバイスがヘッドレス(画面なし)の場合はtrueを返し、それ以外の場合はfalse。
戻り値 | |
---|---|
boolean |
投げる | |
---|---|
DeviceNotAvailableException |
isheadsystemusermode
public boolean isHeadlessSystemUserMode ()
デバイスがヘッドレスシステムユーザーモードを使用するかどうかを返します。
戻り値 | |
---|---|
boolean |
投げる | |
---|---|
DeviceNotAvailableException |
Ismainuserpermanentadmin
public boolean isMainUserPermanentAdmin ()
メインユーザーが永続的な管理者であり、削除または格下げされていないかどうかを返します。
戻り値 | |
---|---|
boolean |
投げる | |
---|---|
DeviceNotAvailableException |
IsMultiuserSupported
public boolean isMultiUserSupported ()
マルチユーザーがサポートされているかどうかを判断します。
戻り値 | |
---|---|
boolean | Multiユーザーがサポートされている場合はTRUE、それ以外の場合はFALSE |
投げる | |
---|---|
DeviceNotAvailableException |
パッケージがインストールされています
public boolean isPackageInstalled (String packageName, String userId)
特定のパッケージ名をクエリし、指定されたユーザーIDは、現在インストールされているかどうかを確認します。
パラメーター | |
---|---|
packageName | String :インストールされているかどうかを確認するパッケージ。 |
userId | String :パッケージがインストールされているユーザーIDがインストールされています。 nullの場合、プライマリユーザーゼロが使用されます。 |
戻り値 | |
---|---|
boolean | パッケージがインストールされていると報告されている場合はtrue。それ以外の場合は false。 |
投げる | |
---|---|
DeviceNotAvailableException |
パッケージがインストールされています
public boolean isPackageInstalled (String packageName)
特定のパッケージ名のデバイスをクエリして、現在インストールされているかどうかを確認します。
パラメーター | |
---|---|
packageName | String |
戻り値 | |
---|---|
boolean | パッケージがインストールされていると報告されている場合はtrue。それ以外の場合は false。 |
投げる | |
---|---|
DeviceNotAvailableException |
isruntimepermissionsionsupted
public boolean isRuntimePermissionSupported ()
プラットフォーム上のプラットフォームがランタイム許可の付与をサポートするかどうかを確認します
戻り値 | |
---|---|
boolean | ランタイム許可がサポートされている場合は、そうでない場合は誤りです。 |
投げる | |
---|---|
DeviceNotAvailableException |
ISSTATEBOOTLOADERORFASTBOOTD
public boolean isStateBootloaderOrFastbootd ()
デバイスがTestDeviceState#FASTBOOT
またはTestDeviceState.FASTBOOTD
にある場合、trueを返します。
戻り値 | |
---|---|
boolean |
ISUSERRUNNING
public boolean isUserRunning (int userId)
特定のユーザーが実行されているかどうかを確認します。
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
boolean | ユーザーが実行されている場合、他のすべての場合にfalse。 |
投げる | |
---|---|
DeviceNotAvailableException |
isusersecondary
public boolean isUserSecondary (int userId)
指定されたユーザーがフラグに従ってセカンダリユーザーであるかどうかを返します。
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
boolean | ユーザーが二次的である場合、それ以外の場合はtrue。 |
投げる | |
---|---|
DeviceNotAvailableException |
isUservisible
public boolean isUserVisible (int userId)
指定されたユーザーが表示されているかどうかを確認します。
「目に見える」ユーザーは、「人間」ユーザーと対話しているユーザーであり、したがって、起動アクティビティを起動することができます(通常はデフォルトのディスプレイで)。
パラメーター | |
---|---|
userId | int |
戻り値 | |
---|---|
boolean |
投げる | |
---|---|
DeviceNotAvailableException |
iSUSERVISIBLEONDISPLAY
public boolean isUserVisibleOnDisplay (int userId, int displayId)
指定されたユーザーが指定されたディスプレイに表示されているかどうかを確認します。
「目に見える」ユーザーは、「人間」ユーザーと対話しているユーザーであり、したがって、そのディスプレイで起動アクティビティを起動することができます。
パラメーター | |
---|---|
userId | int |
displayId | int |
戻り値 | |
---|---|
boolean |
投げる | |
---|---|
DeviceNotAvailableException |
isvisiblebackgroundusersondefaultdisplaysported
public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported ()
デバイスがERROR(/java.android.view.Display#DEFAULT_DISPLAY)
のバックグラウンドでユーザーを開始できるかどうかを返します。
もしそうなら、 startVisibleBackgroundUser(int, int, boolean)
を呼び出して、 listDisplayIdsForStartingVisibleBackgroundUsers()
()を含むERROR(/java.android.view.Display#DEFAULT_DISPLAY)
ディスプレイを渡すことができます。
戻り値 | |
---|---|
boolean |
投げる | |
---|---|
DeviceNotAvailableException |
isvisiblebackgrounduserssupported
public boolean isVisibleBackgroundUsersSupported ()
デバイスがバックグラウンドでユーザーを表示することを許可するかどうかを返します。
もしそうなら、 startVisibleBackgroundUser(int, int, boolean)
を呼び出して、 listDisplayIdsForStartingVisibleBackgroundUsers()
によって返されたディスプレイを渡すことができます。
戻り値 | |
---|---|
boolean |
投げる | |
---|---|
DeviceNotAvailableException |
iswifienabled
public boolean isWifiEnabled ()
WiFiが有効になっているかどうかをテストします。
WiFiがデバイスで有効になっているかどうかを確認します。テストの前にWiFiステータスを主張するのに役立ちます。これは、wifiで実行されないはずです。たとえば、モバイルデータテストなどです。戻り値 | |
---|---|
boolean | wifiが有効になっている場合はtrue 。無効の場合はfalse |
投げる | |
---|---|
DeviceNotAvailableException |
listdisplayids
publiclistDisplayIds ()
「Dumpsys SurfaceFlinger」によって報告されているように、デバイス上の利用可能なディスプレイIDのリストを収集します。
戻り値 | |
---|---|
ディスプレイのリスト。デフォルトは常にデフォルトの表示0を返します。 |
投げる | |
---|---|
DeviceNotAvailableException |
listdisplayidsvisiblebackgroundusersのlistdisplayids
publiclistDisplayIdsForStartingVisibleBackgroundUsers ()
start a user visible in the background
ために使用できるディスプレイのリストを取得します。
戻り値 | |
---|---|
投げる | |
---|---|
DeviceNotAvailableException |
ListUsers
publiclistUsers ()
デバイス上のユーザーのリストを取得します。デバイスからの出力が予想されていない場合、 DeviceRuntimeException
を投げます。
戻り値 | |
---|---|
ユーザーIDのリスト。 |
投げる | |
---|---|
DeviceNotAvailableException |
ローガル
public boolean logAnrs (ITestLogger logger)
デバイスからANRを収集してログを記録します。
パラメーター | |
---|---|
logger | ITestLogger :ANRSをログに記録するITestLogger 。 |
戻り値 | |
---|---|
boolean | ロギングが成功した場合、それ以外の場合は虚偽です。 |
投げる | |
---|---|
DeviceNotAvailableException |
logbugreport
public boolean logBugreport (String dataName, ITestLogger listener)
バグラポートを取り、記者にログに記録するヘルパー方法。
パラメーター | |
---|---|
dataName | String :バグラポートが報告される名前。 |
listener | ITestLogger :BugrePortをログに記録するITestLogger 。 |
戻り値 | |
---|---|
boolean | ロギングが成功した場合、それ以外の場合は虚偽です。 |
logondevice
public void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)
デバイスのログキャットにメッセージを記録します。これは、ロギングが失敗しても投げない安全な電話です。
パラメーター | |
---|---|
tag | String :ログキャットにメッセージを記録するタグ。 |
level | Log.LogLevel :ログキャット内のメッセージのデバッグレベル。 |
format | String :メッセージ形式。 |
args | Object :string.format()を介して交換されるargs。 |
nonblockingReboot
public void nonBlockingReboot ()
デバイスを再起動するコマンドを発行し、Command Completeで戻り、デバイスがADBに表示されなくなった場合。
投げる | |
---|---|
DeviceNotAvailableException |
肥満後
public void postAdbRootAction ()
ADBルートの後、デバイスがオンラインに戻る前に、デバイスがいくつかの特定のアクションを使用する必要がある場合はオーバーライドします。デフォルトの実装には、追加アクションが含まれていません。この段階では、ADBルートが有効になることは保証されていません。
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
adbunrootaction後
public void postAdbUnrootAction ()
ADBが解除された後、デバイスがオンラインに戻る前に、デバイスがいくつかの特定のアクションを使用する必要がある場合はオーバーライドします。デフォルトの実装には追加のアクションは含まれていません。この段階では、ADBルートが無効になることは保証されていません。
投げる | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
ブートセットアップ後
public void postBootSetup ()
ブートするたびにテストするためにデバイスを構成する手順を実行します。
デバイスが完全に起動された/利用可能な後に呼び出される必要があります通常の状況では、再起動を実行するときに実装がこれらの手順を自動的に実行する必要があるため、この方法を明示的に呼び出す必要はありません。呼び出される必要がある場合は、他のイベントのためにデバイスの再起動の場合です(たとえば、FastBoot Updateコマンドが完了した場合)投げる | |
---|---|
DeviceNotAvailableException |
post呼び出しTearDown
public void postInvocationTearDown (Throwable exception)
呼び出しが完了した後に実行されるデバイス固有の必要なクリーンアップの追加ステップ。
パラメーター | |
---|---|
exception | Throwable :もしあれば、呼び出し障害によって提起された最終的な例外。 |
preInvocationSetup
public void preInvocationSetup (IBuildInfo info, MultiMap<String, String> attributes)
呼び出しフローの前にデバイスで実行されるデバイス固有の必要なセットアップの追加手順。
パラメーター | |
---|---|
info | IBuildInfo :デバイスのIBuildInfo 。 |
attributes | MultiMap :呼び出しコンテキストに保存されている属性 |
投げる | |
---|---|
DeviceNotAvailableException | |
TargetSetupError |
プルディル
public boolean pullDir (String deviceFilePath, File localDir)
デバイスからディレクトリのコンテンツを再帰的に引き出します。
パラメーター | |
---|---|
deviceFilePath | String :リモートソースの絶対ファイルパス |
localDir | File :ファイルをプルするためのローカルディレクトリ |
戻り値 | |
---|---|
boolean | ファイルが正常にプルされた場合はtrue 。それ以外の場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
プルファイル
public boolean pullFile (String remoteFilePath, File localFile)
ファイルオフデバイスを取得します。
パラメーター | |
---|---|
remoteFilePath | String :デバイス上にファイルする絶対パス。 |
localFile | File :コンテンツを保存するローカルファイル。空でない場合、コンテンツが交換されます。 |
戻り値 | |
---|---|
boolean | ファイルが正常に取得された場合はtrue 。それ以外の場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
プルファイル
public File pullFile (String remoteFilePath, int userId)
ファイルオフデバイスを取得し、ローカルの一時ERROR(/File)
に保存し、そのFile
を返します。
パラメーター | |
---|---|
remoteFilePath | String :デバイス上にファイルする絶対パス。 |
userId | int :ユーザーIDから引っ張る |
戻り値 | |
---|---|
File | デバイスファイルの内容を含むERROR(/File) 、または何らかの理由でコピーが失敗した場合(ホストファイルシステムの問題を含む) null |
投げる | |
---|---|
DeviceNotAvailableException |
プルファイル
public File pullFile (String remoteFilePath)
ファイルオフデバイスを取得し、ローカルの一時ERROR(/File)
に保存し、そのFile
を返します。
パラメーター | |
---|---|
remoteFilePath | String :デバイス上にファイルする絶対パス。 |
戻り値 | |
---|---|
File | デバイスファイルの内容を含むERROR(/File) 、または何らかの理由でコピーが失敗した場合(ホストファイルシステムの問題を含む) null |
投げる | |
---|---|
DeviceNotAvailableException |
プルファイル
public boolean pullFile (String remoteFilePath, File localFile, int userId)
ファイルオフデバイスを取得します。
パラメーター | |
---|---|
remoteFilePath | String :デバイス上にファイルする絶対パス。 |
localFile | File :コンテンツを保存するローカルファイル。空でない場合、コンテンツが交換されます。 |
userId | int :ユーザーIDから引っ張る |
戻り値 | |
---|---|
boolean | ファイルが正常に取得された場合はtrue 。それ以外の場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
プルフィールセント
public String pullFileContents (String remoteFilePath)
ファイルオフデバイスを取得し、コンテンツを返します。
パラメーター | |
---|---|
remoteFilePath | String :デバイス上にファイルする絶対パス。 |
戻り値 | |
---|---|
String | デバイスファイルのコンテンツを含むString 、または何らかの理由でコピーが故障した場合のnull (ホストファイルシステムの問題を含む) |
投げる | |
---|---|
DeviceNotAvailableException |
pullfilefromexternal
public File pullFileFromExternal (String remoteFilePath)
デバイスの外部ストレージからファイルを取得し、ローカルの一時ERROR(/File)
に保存し、そのFile
への参照を返す便利な方法。
パラメーター | |
---|---|
remoteFilePath | String :デバイスの外部ストレージマウントポイントに対して、デバイス上にファイルするパス |
戻り値 | |
---|---|
File | デバイスファイルの内容を含むERROR(/File) 、または何らかの理由でコピーが失敗した場合(ホストファイルシステムの問題を含む) null |
投げる | |
---|---|
DeviceNotAvailableException |
プッシュディール
public boolean pushDir (File localFileDir, String deviceFilePath,excludedDirectories)
フィルタリングされたディレクトリを除外しながら、ディレクトリコンテンツをデバイスに再帰的にプッシュします。
パラメーター | |
---|---|
localFileDir | File :プッシュするローカルディレクトリ |
deviceFilePath | String :リモート宛先の絶対ファイルパス |
excludedDirectories |
戻り値 | |
---|---|
boolean | ファイルが正常にプッシュされた場合はtrue 。それ以外の場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
プッシュディール
public boolean pushDir (File localFileDir, String deviceFilePath)
再帰的にディレクトリコンテンツをデバイスにプッシュします。
パラメーター | |
---|---|
localFileDir | File :プッシュするローカルディレクトリ |
deviceFilePath | String :リモート宛先の絶対ファイルパス |
戻り値 | |
---|---|
boolean | ファイルが正常にプッシュされた場合はtrue 。それ以外の場合はfalse 。 |
投げる | |
---|---|
DeviceNotAvailableException |
プッシュファイル
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 。 |
投げる | |
---|---|
DeviceNotAvailableException |
プッシュファイル
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 。 |
投げる | |
---|---|
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 。 |
投げる | |
---|---|
DeviceNotAvailableException |
リブート
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 |
リブート
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.
警告。 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 |
デバイスを回復する
public boolean recoverDevice ()
デバイスの通信の回復を試みます。
戻り値 | |
---|---|
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. |
remountSystemReadOnly
public void remountSystemReadOnly ()
Make the system partition on the device read-only. May reboot the device.
投げる | |
---|---|
DeviceNotAvailableException |
remountSystemWritable
public void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
投げる | |
---|---|
DeviceNotAvailableException |
remountVendorReadOnly
public void remountVendorReadOnly ()
Make the vendor partition on the device read-only. 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 |
set構成
public void setConfiguration (IConfiguration configuration)
使用中のIConfiguration
を挿入します。
パラメーター | |
---|---|
configuration | IConfiguration |
setConnectionAvdInfo
public final void setConnectionAvdInfo (GceAvdInfo avdInfo)
パラメーター | |
---|---|
avdInfo | GceAvdInfo |
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 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 : 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 |
セットプロパティ
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。 |
投げる | |
---|---|
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。 |
投げる | |
---|---|
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 。 |
投げる | |
---|---|
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 |
アンインストールパッケージ
public String uninstallPackage (String packageName)
Uninstall an Android package from device.
パラメーター | |
---|---|
packageName | String : アンインストールする Android パッケージ |
戻り値 | |
---|---|
String | a 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 : アンインストールする Android パッケージ |
userId | int : the integer user id to uninstall for. |
戻り値 | |
---|---|
String | a 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 |
waitForDeviceAvailable
public boolean waitForDeviceAvailable ()
Waits for the device to be responsive and available for testing. Uses default timeout.
戻り値 | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
投げる | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailable
public boolean waitForDeviceAvailable (long waitTime)
Waits for the device to be responsive and available for testing.
パラメーター | |
---|---|
waitTime | long : the time in ms to wait |
戻り値 | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
投げる | |
---|---|
DeviceNotAvailableException |
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 : the time in ms to wait |
戻り値 | |
---|---|
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 : the time in ms to wait |
戻り値 | |
---|---|
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 : the time in ms to wait |
戻り値 | |
---|---|
boolean | true if device becomes not available before time expires.それ以外の場合はfalse |
waitForDeviceOnline
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 |
waitForDeviceOnline
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 : the time in ms to wait |
投げる | |
---|---|
DeviceNotAvailableException |
waitForDeviceShell
public boolean waitForDeviceShell (long waitTime)
Waits for device to be responsive to a basic adb shell command.
パラメーター | |
---|---|
waitTime | long : the time in ms to wait |
戻り値 | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |
保護されたメソッド
addExtraConnectionBuilderArgs
protected void addExtraConnectionBuilderArgs (DefaultConnection.ConnectionBuilder builder)
パラメーター | |
---|---|
builder | DefaultConnection.ConnectionBuilder |
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 : この再起動のモード。 |
reason | String : 今回の再起動用。 |
戻り値 | |
---|---|
NativeDevice.RebootDeviceAction | the created RebootDeviceAction . |
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode, String reason)
adb の再起動を実行します。
パラメーター | |
---|---|
rebootMode | NativeDevice.RebootMode : この再起動のモード。 |
reason | String : 今回の再起動用。 |
投げる | |
---|---|
| 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-12-01 UTC。