本地设备
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
为 ddmlib IDevice
提供可靠且级别稍高的 API。
概括
常数 | |
---|---|
int | UNKNOWN_API_LEVEL 无法检测API Level时的默认值 |
公共方法 | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) 检查当前是否支持给定最低支持级别的功能。 |
abstract void | clearLogcat () 删除所有累积的 logcat 数据。 |
abstract void | deleteFile (String deviceFilePath) 用于删除设备上的文件或目录的帮助程序方法。 |
abstract boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) 通过将当前 system_server 与以前的 system_server |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) 用于检查设备是否自 UTC 时间以来设备及其 |
abstract boolean | disableAdbRoot () 关闭 adb root。 |
abstract boolean | doesFileExist (String deviceFilePath) 确定设备上的文件是否存在的帮助程序方法。 |
abstract boolean | enableAdbRoot () 打开 adb root。 |
abstract String | executeAdbCommand (long timeout, String... commandArgs) 将 adb 命令作为具有指定超时的系统命令执行的帮助程序方法。 |
abstract String | executeAdbCommand (String... commandArgs) 将 adb 命令作为系统命令执行的辅助方法。 |
abstract String | executeAdbCommand (long timeout, envMap, String... commandArgs) executeAdbCommand (long timeout, envMap, String... commandArgs) 将 adb 命令作为具有指定超时的系统命令执行的帮助程序方法。 |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) 将 fastboot 命令作为系统命令执行的帮助程序方法。 |
abstract CommandResult | executeFastbootCommand (String... commandArgs) 将 fastboot 命令作为系统命令执行的帮助程序方法,默认超时为 2 分钟。 |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) 将长时间运行的 fastboot 命令作为系统命令执行的帮助程序方法。 |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) 帮助程序方法,将长时间运行的 fastboot 命令作为具有系统环境变量的系统命令执行。 |
abstract String | executeShellCommand (String command) 执行 adb shell 命令并以 |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) 执行 adb shell 命令,使用更多参数来控制命令行为。 |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) 执行 adb shell 命令,使用更多参数来控制命令行为。 |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) 执行给定的 adb shell 命令,如果命令失败则重试多次。 |
abstract CommandResult | executeShellV2Command (String command) 执行 adb shell 命令并将结果作为 |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) 执行 adb shell 命令并将结果作为 |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) 执行 adb shell 命令并将结果作为 |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) 执行 adb shell 命令,使用更多参数来控制命令行为。 |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) 执行 adb shell 命令,使用更多参数来控制命令行为。 |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) 执行 adb shell 命令,使用更多参数来控制命令行为。 |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) 执行 adb shell 命令,使用更多参数来控制命令行为。 |
abstract CommandResult | fastbootWipePartition (String partition) 擦除设备分区的辅助方法。 |
abstract int | getApiLevel () 获取设备 API 级别。 |
abstract String | getBasebandVersion () 获取该设备的基带(无线电)版本的便捷方法。 |
abstract Integer | getBattery () 返回设备的当前电池电量,如果电池电量不可用,则返回 Null。 |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) 返回给定属性的布尔值。 |
abstract | getBootHistory () Helper 方法收集带有启动时间和启动原因的启动历史记录图。 |
abstract | getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) 帮助程序方法收集启动历史记录图,其中包含自设备纪元以来的给定时间和指定的时间单位以来的启动时间和启动原因。 |
abstract String | getBootloaderVersion () 获取该设备的引导加载程序版本的便捷方法。 |
abstract String | getBuildAlias () 检索设备当前正在运行的构建的别名。 |
abstract String | getBuildFlavor () 检索设备的构建风格。 |
abstract String | getBuildId () 检索设备当前正在运行的版本。 |
abstract String | getBuildSigningKeys () 返回用于签署设备映像的密钥类型 通常,Android 设备可以使用测试密钥(如 AOSP 中)或发布密钥(由各个设备制造商控制)进行签名 |
abstract DeviceDescriptor | getCachedDeviceDescriptor () 如果设备已分配,则返回缓存的 |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) 如果设备已分配,则返回缓存的 |
abstract String[] | getChildren (String deviceFilePath) 使用 |
abstract AbstractConnection | getConnection () 返回与设备关联的连接。 |
abstract String | getDeviceClass () 获取设备类别。 |
abstract long | getDeviceDate () 返回设备的日期(自纪元以来的毫秒数)。 |
abstract DeviceDescriptor | getDeviceDescriptor () 从设备信息中返回 |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) 从设备信息中返回 |
abstract TestDeviceState | getDeviceState () 获取设备的状态。 |
abstract long | getDeviceTimeOffset (Date date) 帮助获取设备与给定 |
abstract InputStreamSource | getEmulatorOutput () 获取模拟器stdout和stderr的流 |
abstract long | getExternalStoreFreeSpace () 用于确定设备外部存储上的可用空间量的帮助程序方法。 |
abstract String | getFastbootProductType () 当设备处于快速启动模式时获取该设备的产品类型的便捷方法。 |
abstract String | getFastbootProductVariant () 当设备处于快速启动模式时获取该设备的产品类型的便捷方法。 |
abstract String | getFastbootSerialNumber () 返回快速启动模式序列号。 |
abstract String | getFastbootVariable (String variableName) 从设备检索给定的 fastboot 变量值。 |
abstract IFileEntry | getFileEntry (String path) 检索设备上远程文件的引用。 |
abstract IDevice | getIDevice () 返回对关联 ddmlib |
abstract long | getIntProperty (String name, long defaultValue) 从设备返回给定属性的整数值。 |
abstract long | getLastExpectedRebootTimeMillis () 返回自 |
abstract int | getLaunchApiLevel () 获取设备首次启动的 API 级别。 |
abstract InputStreamSource | getLogcat () 获取 logcat 数据的快照流。 |
abstract InputStreamSource | getLogcat (int maxBytes) 获取捕获的 logcat 数据的最后 |
abstract InputStreamSource | getLogcatDump () 获取设备当前 logcat 的转储。 |
abstract InputStreamSource | getLogcatSince (long date) 获取从提供的日期开始捕获的 logcat 数据的快照流。 |
abstract String | getMountPoint (String mountName) 返回一个挂载点。 |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) 返回与指定挂载点路径相对应的 |
abstract | getMountPointInfo () 返回设备上 /proc/mounts 中信息的已解析版本 |
abstract long | getPartitionFreeSpace (String partition) 确定设备分区上的可用空间量的帮助程序方法。 |
abstract ProcessInfo | getProcessByName (String processName) Helper 方法运行“pidof”和“stat”命令,并返回包含给定进程的 PID 和进程启动时间的 |
abstract String | getProcessPid (String process) 返回服务的 pid,如果出现问题则返回 null。 |
abstract String | getProductType () 获取该设备的产品类型的便捷方法。 |
abstract String | getProductVariant () 获取该设备的产品变型的便捷方法。 |
abstract String | getProperty (String name) 从设备中检索给定的属性值。 |
abstract ITestDevice.RecoveryMode | getRecoveryMode () 获取设备当前使用的恢复模式。 |
abstract String | getSerialNumber () 获取该设备序列号的便捷方法。 |
abstract | getTombstones () 从设备中获取并返回逻辑删除列表。 |
abstract long | getTotalMemory () 返回总物理内存大小(以字节为单位),如果出现内部错误,则返回 -1 |
abstract boolean | getUseFastbootErase () 获取是否使用 fastboot 擦除或 fastboot 格式来擦除设备上的分区。 |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () 检查设备平台是否支持应用枚举 |
abstract boolean | isBypassLowTargetSdkBlockSupported () 检查设备上的平台是否支持绕过应用程序安装时的低目标 sdk 块 |
abstract boolean | isDeviceEncrypted () 返回设备是否已加密。 |
abstract boolean | isDirectory (String deviceFilePath) 如果设备上的路径是目录,则返回 True,否则返回 false。 |
abstract boolean | isEncryptionSupported () 返回设备是否支持加密。 |
abstract boolean | isExecutable (String fullPath) 如果设备上的文件路径是可执行文件,则返回 True,否则返回 false。 |
abstract boolean | isHeadless () 如果设备是无头的(无屏幕),则返回 true,否则返回 false。 |
abstract boolean | isRuntimePermissionSupported () 检查设备平台是否支持运行时权限授予 |
abstract boolean | isStateBootloaderOrFastbootd () 如果设备处于 |
abstract boolean | logAnrs ( ITestLogger logger) 从设备收集并记录 ANR。 |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) 在设备的 logcat 中记录消息。 |
abstract void | nonBlockingReboot () 发出重新启动设备的命令,并在命令完成时以及设备不再对 adb 可见时返回。 |
abstract void | postBootSetup () 执行说明来配置设备,以便在每次启动后进行测试。 |
default void | postInvocationTearDown () 此方法已被弃用。请改用 |
abstract void | postInvocationTearDown (Throwable invocationException) 设备特定所需清理的额外步骤将在调用完成后执行。 |
default void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) 设备特定所需设置的额外步骤将在调用流程之前在设备上执行。 |
abstract boolean | pullDir (String deviceFilePath, File localDir) 从设备中递归提取目录内容。 |
abstract File | pullFile (String remoteFilePath, int userId) 从设备上检索文件,将其存储在本地临时 |
abstract File | pullFile (String remoteFilePath) 从设备上检索文件,将其存储在本地临时 |
abstract boolean | pullFile (String remoteFilePath, File localFile) 从设备上检索文件。 |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) 从设备上检索文件。 |
abstract String | pullFileContents (String remoteFilePath) 从设备上检索文件并返回内容。 |
abstract File | pullFileFromExternal (String remoteFilePath) 一种从设备的外部存储检索文件、将其存储在本地临时 |
abstract boolean | pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories) 将目录内容递归推送到设备,同时排除一些被过滤的目录。 |
abstract boolean | pushDir (File localDir, String deviceFilePath) 将目录内容递归推送到设备。 |
abstract boolean | pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded) |
abstract boolean | pushFile (File localFile, String deviceFilePath) 将文件推送到设备。 |
abstract boolean | pushString (String contents, String deviceFilePath) 将根据字符串创建的文件推送到设备 |
abstract void | reboot () 将设备重新启动至 adb 模式。 |
abstract void | reboot (String reason) 将设备重新启动到 adb 模式,并给出在重新启动后保留的 |
abstract void | rebootIntoBootloader () 将设备重新启动至引导加载程序模式。 |
abstract void | rebootIntoFastbootd () 将设备重新启动至 fastbootd 模式。 |
abstract void | rebootIntoRecovery () 将设备重新启动至 adb 恢复模式。 |
abstract void | rebootIntoSideload (boolean autoReboot) 重新启动设备进入 adb sideload 模式(请注意,这是恢复下的特殊模式) 阻塞直到设备进入旁加载模式 |
abstract void | rebootIntoSideload () 重新启动设备进入 adb sideload 模式(请注意,这是恢复下的特殊模式) 阻塞直到设备进入旁加载模式 |
abstract void | rebootUntilOnline () |
abstract void | rebootUntilOnline (String reason) |
abstract void | rebootUserspace () 仅重新启动设备的用户空间部分。 |
abstract void | rebootUserspaceUntilOnline () |
abstract void | remountSystemReadOnly () 将设备上的系统分区设置为只读。 |
abstract void | remountSystemWritable () 使设备上的系统分区可写。 |
abstract void | remountVendorReadOnly () 将设备上的供应商分区设置为只读。 |
abstract void | remountVendorWritable () 使设备上的供应商分区可写。 |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) 使用作为参数传递的一个或多个侦听器来执行 |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) 运行仪器测试并提供设备恢复。 |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) 与 |
abstract void | setDate (Date date) 设置设备上的日期 注意:在设备上设置日期需要root |
abstract void | setOptions ( TestDeviceOptions options) 设置设备的 |
abstract boolean | setProperty (String propKey, String propValue) 设置设备上给定的属性值。 |
abstract void | setRecovery ( IDeviceRecovery recovery) 设置用于此设备的 |
abstract void | setRecoveryMode ( ITestDevice.RecoveryMode mode) 设置设备使用的当前恢复模式。 |
abstract void | setUseFastbootErase (boolean useFastbootErase) 设置是否使用 fastboot 擦除或 fastboot 格式来擦除设备上的分区。 |
abstract void | startLogcat () 开始在后台捕获设备的 logcat 输出。 |
abstract void | stopEmulatorOutput () 关闭并删除模拟器输出。 |
abstract void | stopLogcat () 停止从设备捕获 logcat 输出,并丢弃当前保存的 logcat 数据。 |
abstract String | switchToAdbTcp () 将设备切换到 adb-over-tcp 模式。 |
abstract boolean | switchToAdbUsb () 将设备切换到 adb over usb 模式。 |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) 将本地文件目录的内容增量同步到设备。 |
abstract boolean | unlockDevice () 如果设备处于加密状态,则解锁设备。 |
abstract boolean | waitForBootComplete (long timeOut) 阻塞直到设置设备的启动完成标志。 |
abstract boolean | waitForDeviceAvailable () 等待设备响应并可用于测试。 |
abstract boolean | waitForDeviceAvailable (long waitTime) 等待设备响应并可用于测试。 |
abstract boolean | waitForDeviceAvailableInRecoverPath (long waitTime) 等待设备响应并可用,而不考虑恢复路径。 |
abstract void | waitForDeviceBootloader () 阻塞直到设备通过 fastboot 可见。 |
abstract boolean | waitForDeviceInRecovery (long waitTime) 阻止设备处于“adb recovery”状态(请注意,这与 |
abstract boolean | waitForDeviceInSideload (long waitTime) 阻止设备处于“adb sideload”状态 |
abstract boolean | waitForDeviceNotAvailable (long waitTime) 设备不可用的块,即 adb 中丢失的块 |
abstract void | waitForDeviceOnline () 阻塞直到设备通过 adb 可见。 |
abstract void | waitForDeviceOnline (long waitTime) 阻塞直到设备通过 adb 可见。 |
abstract boolean | waitForDeviceShell (long waitTime) 等待设备响应基本的 adb shell 命令。 |
常数
UNKNOWN_API_LEVEL
public static final int UNKNOWN_API_LEVEL
无法检测API Level时的默认值
常量值:-1 (0xffffffff)
公共方法
检查 ApiLevelAgainstNextRelease
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
检查当前是否支持给定最低支持级别的功能。此方法考虑了 API 级别提升之前尚未发布的功能。
参数 | |
---|---|
strictMinLevel | int :支持该功能的严格的最小可能级别。 |
退货 | |
---|---|
boolean | 如果支持该级别,则为 true。否则为假。 |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
清除Logcat
public abstract void clearLogcat ()
删除所有累积的 logcat 数据。
当您想要确保ITestDevice#getLogcat()
仅返回在某个点之后(例如刷新新设备版本后等)生成的日志数据时,这非常有用。 删除文件
public abstract void deleteFile (String deviceFilePath)
用于删除设备上的文件或目录的帮助程序方法。
参数 | |
---|---|
deviceFilePath | String :设备上文件的绝对路径。 |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
设备软重启
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
通过将当前 system_server 与以前的 system_server ProcessInfo
进行比较来检查设备是否软重启的帮助程序方法。使用getProcessByName(String)
获取ProcessInfo
。
参数 | |
---|---|
prevSystemServerProcess | ProcessInfo :之前的system_server进程的ProcessInfo 。 |
退货 | |
---|---|
boolean | 如果设备软重启则为true |
投掷 | |
---|---|
RuntimeException | 如果设备有异常启动原因 |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
设备软重启以来
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
用于检查设备是否自 UTC 时间以来设备及其ERROR(/TimeUnit)
软重启的方法。软重启是指在设备硬重启之外重新启动的 system_server(例如:请求重启)。可以通过getDeviceDate()
方法获取当前设备的 utcEpochTime(以毫秒为单位)。
参数 | |
---|---|
utcEpochTime | long :自纪元以来的设备时间(以秒为单位)。 |
timeUnit | TimeUnit :给定 utcEpochTime 的时间单位TimeUnit 。 |
退货 | |
---|---|
boolean | 如果设备软重启则为true |
投掷 | |
---|---|
RuntimeException | 如果设备有异常启动原因 |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
禁用AdbRoot
public abstract boolean disableAdbRoot ()
关闭 adb root。
禁用 adb root 可能会导致设备与 adb 断开连接。此方法将阻塞,直到设备可用。退货 | |
---|---|
boolean | 如果成功则为true 。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
文件是否存在
public abstract boolean doesFileExist (String deviceFilePath)
确定设备上的文件是否存在的帮助程序方法。
参数 | |
---|---|
deviceFilePath | String : 要检查的设备上文件的绝对路径 |
退货 | |
---|---|
boolean | 如果文件存在true ,否则为false 。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
启用AdbRoot
public abstract boolean enableAdbRoot ()
打开 adb root。如果“enable-root”设置为“false”,将记录一条消息并返回而不启用 root。
启用 adb root 可能会导致设备与 adb 断开连接。此方法将阻塞,直到设备可用。退货 | |
---|---|
boolean | 如果成功则为true 。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Adb命令
public abstract String executeAdbCommand (long timeout, String... commandArgs)
将 adb 命令作为具有指定超时的系统命令执行的帮助程序方法。
应尽可能使用executeShellCommand(String)
,因为该方法提供更好的故障检测和性能。
参数 | |
---|---|
timeout | long :设备被视为无响应之前的时间(以毫秒为单位),0L 表示无超时 |
commandArgs | String :要运行的 adb 命令和参数 |
退货 | |
---|---|
String | 命令的标准输出。如果命令执行失败则为null 。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Adb命令
public abstract String executeAdbCommand (String... commandArgs)
将 adb 命令作为系统命令执行的辅助方法。
应尽可能使用executeShellCommand(String)
,因为该方法提供更好的故障检测和性能。参数 | |
---|---|
commandArgs | String :要运行的 adb 命令和参数 |
退货 | |
---|---|
String | 命令的标准输出。如果命令执行失败则为null 。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Adb命令
public abstract String executeAdbCommand (long timeout,envMap, String... commandArgs)
将 adb 命令作为具有指定超时的系统命令执行的帮助程序方法。
应尽可能使用executeShellCommand(String)
,因为该方法提供更好的故障检测和性能。
参数 | |
---|---|
timeout | long :设备被视为无响应之前的时间(以毫秒为单位),0L 表示无超时 |
envMap | |
commandArgs | String :要运行的 adb 命令和参数 |
退货 | |
---|---|
String | 命令的标准输出。如果命令执行失败则为null 。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Fastboot命令
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
将 fastboot 命令作为系统命令执行的帮助程序方法。
预计在设备已处于快速启动模式时使用。参数 | |
---|---|
timeout | long :命令过期前的时间(以毫秒为单位) |
commandArgs | String :要运行的 fastboot 命令和参数 |
退货 | |
---|---|
CommandResult | 包含命令输出的 CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Fastboot命令
public abstract CommandResult executeFastbootCommand (String... commandArgs)
将 fastboot 命令作为系统命令执行的帮助程序方法,默认超时为 2 分钟。
预计在设备已处于快速启动模式时使用。
参数 | |
---|---|
commandArgs | String :要运行的 fastboot 命令和参数 |
退货 | |
---|---|
CommandResult | 包含命令输出的 CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行LongFastboot命令
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
将长时间运行的 fastboot 命令作为系统命令执行的帮助程序方法。
与executeFastbootCommand(String)
相同,只是使用更长的超时。参数 | |
---|---|
commandArgs | String :要运行的 fastboot 命令和参数 |
退货 | |
---|---|
CommandResult | 包含命令输出的 CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行LongFastboot命令
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
帮助程序方法,将长时间运行的 fastboot 命令作为具有系统环境变量的系统命令执行。
与executeFastbootCommand(String)
相同,只是使用更长的超时。
参数 | |
---|---|
envVarMap | |
commandArgs | String :要运行的 fastboot 命令和参数 |
退货 | |
---|---|
CommandResult | 包含命令输出的 CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Shell命令
public abstract String executeShellCommand (String command)
执行 adb shell 命令并以String
形式返回输出的 Helper 方法。
参数 | |
---|---|
command | String : 要运行的 adb shell 命令 |
退货 | |
---|---|
String | 外壳输出 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Shell命令
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
执行 adb shell 命令,使用更多参数来控制命令行为。
参数 | |
---|---|
command | String : 要运行的 adb shell 命令 |
receiver | IShellOutputReceiver :将 shell 输出定向到的IShellOutputReceiver 。 |
maxTimeToOutputShellResponse | long :允许命令不输出任何响应的最长时间; timeUnit 中指定的单位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 的单位 |
retryAttempts | int :如果由于异常而失败,重试命令的最大次数。如果执行retryAttempts没有成功,将抛出 DeviceNotResponsiveException。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Shell命令
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
执行 adb shell 命令,使用更多参数来控制命令行为。
参数 | |
---|---|
command | String : 要运行的 adb shell 命令 |
receiver | IShellOutputReceiver :将 shell 输出定向到的IShellOutputReceiver 。 |
maxTimeoutForCommand | long :命令完成的最大超时时间; timeUnit 中指定的单位 |
maxTimeToOutputShellResponse | long :允许命令不输出任何响应的最长时间; timeUnit 中指定的单位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 的单位 |
retryAttempts | int :如果由于异常而失败,重试命令的最大次数。如果执行retryAttempts没有成功,将抛出 DeviceNotResponsiveException。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Shell命令
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver)
执行给定的 adb shell 命令,如果命令失败则重试多次。
具有默认值的更简单形式的executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
。参数 | |
---|---|
command | String : 要运行的 adb shell 命令 |
receiver | IShellOutputReceiver :将 shell 输出定向到的IShellOutputReceiver 。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行ShellV2命令
public abstract CommandResult executeShellV2Command (String command)
执行 adb shell 命令并将结果作为CommandResult
返回的帮助程序方法,其中正确填充了命令状态输出、stdout 和 stderr。
参数 | |
---|---|
command | String :应该运行的命令。 |
退货 | |
---|---|
CommandResult | 结果在CommandResult 中。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行ShellV2命令
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
执行 adb shell 命令并将结果作为CommandResult
返回的帮助程序方法,其中正确填充了命令状态输出和 stderr。 stdout 定向到指定的流。
参数 | |
---|---|
command | String :应该运行的命令。 |
pipeToOutput | OutputStream : ERROR(/OutputStream) 其中 std 输出将被重定向,或者为 null。 |
退货 | |
---|---|
CommandResult | 结果在CommandResult 中。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行ShellV2命令
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
执行 adb shell 命令并将结果作为CommandResult
返回的帮助程序方法,其中正确填充了命令状态输出、stdout 和 stderr。
参数 | |
---|---|
command | String :应该运行的命令。 |
pipeAsInput | File :将作为命令的输入通过管道传输ERROR(/File) ,或为空。 |
退货 | |
---|---|
CommandResult | 结果在CommandResult 中。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行ShellV2命令
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
执行 adb shell 命令,使用更多参数来控制命令行为。
参数 | |
---|---|
command | String : 要运行的 adb shell 命令 |
maxTimeoutForCommand | long :命令完成的最大超时时间; timeUnit 中指定的单位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 的单位 |
retryAttempts | int :如果由于异常而失败,重试命令的最大次数。如果执行retryAttempts没有成功,将抛出 DeviceNotResponsiveException。 |
退货 | |
---|---|
CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行ShellV2命令
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
执行 adb shell 命令,使用更多参数来控制命令行为。
参数 | |
---|---|
command | String : 要运行的 adb shell 命令 |
maxTimeoutForCommand | long :命令完成的最大超时时间; timeUnit 中指定的单位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 的单位 |
退货 | |
---|---|
CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行ShellV2命令
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
执行 adb shell 命令,使用更多参数来控制命令行为。
参数 | |
---|---|
command | String : 要运行的 adb shell 命令 |
pipeAsInput | File :将作为命令的输入通过管道传输ERROR(/File) ,或为空。 |
pipeToOutput | OutputStream : ERROR(/OutputStream) 其中 std 输出将被重定向,或者为 null。 |
maxTimeoutForCommand | long :命令完成的最大超时时间; timeUnit 中指定的单位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 的单位 |
retryAttempts | int :如果由于异常而失败,重试命令的最大次数。如果执行retryAttempts没有成功,将抛出 DeviceNotResponsiveException。 |
退货 | |
---|---|
CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行ShellV2命令
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
执行 adb shell 命令,使用更多参数来控制命令行为。
参数 | |
---|---|
command | String : 要运行的 adb shell 命令 |
pipeAsInput | File :将作为命令的输入通过管道传输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 | 如果与设备的连接丢失且无法恢复。 |
fastboot擦除分区
public abstract CommandResult fastbootWipePartition (String partition)
擦除设备分区的辅助方法。
如果getUseFastbootErase()
为true
,则将使用 fastboot Erase 来擦除分区。然后,设备必须在下次启动时创建文件系统。否则,将使用 fastboot 格式,这将在设备上创建新的文件系统。预计在设备已处于快速启动模式时使用。参数 | |
---|---|
partition | String : 要擦除的分区 |
退货 | |
---|---|
CommandResult | 包含命令输出的 CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
获取API级别
public abstract int getApiLevel ()
获取设备 API 级别。默认为UNKNOWN_API_LEVEL
。
退货 | |
---|---|
int | 指示设备 API 级别的整数 |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
获取基带版本
public abstract String getBasebandVersion ()
获取该设备的基带(无线电)版本的便捷方法。获取无线电版本是特定于设备的,因此它可能无法返回所有设备的正确信息。此方法依赖 gsm.version.baseband 属性来返回正确的版本信息。这对于某些 CDMA 设备来说并不准确,并且此处返回的版本可能与 fastboot 报告的版本不匹配,并且可能不会返回 CDMA 无线电的版本。 TL;DR 如果 gsm.version.baseband 属性与fastboot getvar version-baseband
返回的版本相同,则此方法仅报告准确的版本。
退货 | |
---|---|
String | String 基带版本,如果无法确定则为null (设备没有无线电或无法读取版本字符串) |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
获取电池
public abstract Integer getBattery ()
返回设备的当前电池电量,如果电池电量不可用,则返回 Null。
退货 | |
---|---|
Integer |
获取布尔属性
public abstract boolean getBooleanProperty (String name, boolean defaultValue)
返回给定属性的布尔值。
参数 | |
---|---|
name | String : 属性名称 |
defaultValue | boolean :如果属性为空或不存在,则返回默认值。 |
退货 | |
---|---|
boolean | 如果属性值为"1" 、 "y" 、 "yes" 、 "on" 或"true" ,则为true ;如果属性值为"0" 、 "n" 、 "no" 、 "off" ,则为false , "false" ,否则为defaultValue 。 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取启动历史记录
public abstractgetBootHistory ()
Helper 方法收集带有启动时间和启动原因的启动历史记录图。
退货 | |
---|---|
启动时间图(自纪元以来以秒为单位的 UTC 时间)和启动原因 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取启动历史记录
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
帮助程序方法收集启动历史记录图,其中包含自设备纪元以来的给定时间和指定的时间单位以来的启动时间和启动原因。当前设备的 utcEpochTime(以毫秒为单位)可以通过方法getDeviceDate()
获取。
参数 | |
---|---|
utcEpochTime | long :自 Epoch 以来的设备时间。 |
timeUnit | TimeUnit :时间单位TimeUnit 。 |
退货 | |
---|---|
启动时间图(自纪元以来以秒为单位的 UTC 时间)和启动原因 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取Bootloader版本
public abstract String getBootloaderVersion ()
获取该设备的引导加载程序版本的便捷方法。
将尝试从设备的当前状态检索引导加载程序版本。 (即如果设备处于快速启动模式,它将尝试从快速启动检索版本)退货 | |
---|---|
String | String 引导加载程序版本,如果找不到则为null |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
获取构建别名
public abstract String getBuildAlias ()
检索设备当前正在运行的构建的别名。
构建别名通常是比构建 ID(通常是 Nexus 构建的数字)更可读的字符串。例如,最终的 Android 4.2 版本的构建别名为 JDQ39,构建 ID 为 573038
退货 | |
---|---|
String | 构建别名或如果无法检索则回退到构建 ID |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
获取BuildFlavor
public abstract String getBuildFlavor ()
检索设备的构建风格。
退货 | |
---|---|
String | 构建风格,如果无法检索则为 null |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
获取构建ID
public abstract String getBuildId ()
检索设备当前正在运行的版本。
退货 | |
---|---|
String | 构建 ID 或IBuildInfo#UNKNOWN_BUILD_ID (如果无法检索) |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
获取构建签名密钥
public abstract String getBuildSigningKeys ()
返回用于签署设备映像的密钥类型
通常,Android 设备可以使用测试密钥(如 AOSP 中)或发布密钥(由各个设备制造商控制)进行签名
退货 | |
---|---|
String | 如果找到则为签名密钥,否则为 null。 |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
获取缓存设备描述符
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
如果设备已分配,则返回缓存的DeviceDescriptor
,否则返回当前的DeviceDescriptor
。
退货 | |
---|---|
DeviceDescriptor |
获取缓存设备描述符
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
如果设备已分配,则返回缓存的DeviceDescriptor
,否则返回当前的DeviceDescriptor
。
参数 | |
---|---|
shortDescriptor | boolean :是否将描述符限制为最低限度的信息 |
退货 | |
---|---|
DeviceDescriptor |
获取孩子
public abstract String[] getChildren (String deviceFilePath)
使用IFileEntry
的替代方案有时由于权限问题而无法工作。
参数 | |
---|---|
deviceFilePath | String :是设备上进行搜索的路径 |
退货 | |
---|---|
String[] | 包含设备上路径中的所有文件的字符串数组。 |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
获取设备日期
public abstract long getDeviceDate ()
返回设备的日期(自纪元以来的毫秒数)。
退货 | |
---|---|
long | 设备的日期(纪元格式)。 |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
获取设备描述符
public abstract DeviceDescriptor getDeviceDescriptor ()
从设备信息中返回DeviceDescriptor
以获取其信息,而无需传递实际的设备对象。
退货 | |
---|---|
DeviceDescriptor |
获取设备描述符
public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
从设备信息中返回DeviceDescriptor
以获取其信息,而无需传递实际的设备对象。
参数 | |
---|---|
shortDescriptor | boolean :是否将描述符限制为最低限度的信息 |
退货 | |
---|---|
DeviceDescriptor |
获取设备时间偏移
public abstract long getDeviceTimeOffset (Date date)
帮助获取设备与给定ERROR(/Date)
之间的时差。内部使用纪元时间。
参数 | |
---|---|
date | Date |
退货 | |
---|---|
long | 以毫秒为单位的差异 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取模拟器输出
public abstract InputStreamSource getEmulatorOutput ()
获取模拟器stdout和stderr的流
退货 | |
---|---|
InputStreamSource | 仿真器输出 |
获取外部存储空闲空间
public abstract long getExternalStoreFreeSpace ()
用于确定设备外部存储上的可用空间量的帮助程序方法。
退货 | |
---|---|
long | 可用空间量(以 KB 为单位) |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
获取FastbootProductType
public abstract String getFastbootProductType ()
当设备处于快速启动模式时获取该设备的产品类型的便捷方法。
仅当设备处于快速启动状态时才应使用此方法。在这种情况下,它比通用getProductType()
方法更安全一些,因为如果设备处于不正确状态或无响应,ITestDevice 会知道将设备恢复到快速启动。退货 | |
---|---|
String | String 产品类型名称,如果无法确定则为null |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
获取FastbootProductVariant
public abstract String getFastbootProductVariant ()
当设备处于快速启动模式时获取该设备的产品类型的便捷方法。
仅当设备处于快速启动状态时才应使用此方法。在这种情况下,它比通用getProductType()
方法更安全一些,因为如果设备处于不正确状态或无响应,ITestDevice 会知道将设备恢复到快速启动。退货 | |
---|---|
String | String 产品类型名称,如果无法确定则为null |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
获取Fastboot序列号
public abstract String getFastbootSerialNumber ()
返回快速启动模式序列号。
退货 | |
---|---|
String |
获取Fastboot变量
public abstract String getFastbootVariable (String variableName)
从设备检索给定的 fastboot 变量值。
参数 | |
---|---|
variableName | String :变量名 |
退货 | |
---|---|
String | 属性值,如果不存在则为null |
投掷 | |
---|---|
| 不支持的操作异常 |
DeviceNotAvailableException |
获取文件条目
public abstract IFileEntry getFileEntry (String path)
检索设备上远程文件的引用。
参数 | |
---|---|
path | String :要检索的文件路径。可以是绝对路径或相对于“/”的路径。 (即支持“/system”和“system”语法) |
退货 | |
---|---|
IFileEntry | 如果无法找到给定path的文件,则IFileEntry 或null |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
获取设备
public abstract IDevice getIDevice ()
返回对关联 ddmlib IDevice
的引用。
IDevice
。因此,调用者不应保留对IDevice
引用,因为该引用可能会变得过时。退货 | |
---|---|
IDevice | IDevice |
获取整数属性
public abstract long getIntProperty (String name, long defaultValue)
从设备返回给定属性的整数值。
参数 | |
---|---|
name | String : 属性名称 |
defaultValue | long :如果属性为空或不存在,则返回默认值。 |
退货 | |
---|---|
long | 属性值或defaultValue (如果属性为空、不存在或没有整数值)。 |
投掷 | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
返回自System.currentTimeMillis()
返回的 EPOCH 以来 Tradefed API 上次触发重启的时间(以毫秒为单位)。
退货 | |
---|---|
long |
获取LaunchApiLevel
public abstract int getLaunchApiLevel ()
Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL
.
退货 | |
---|---|
int | an integer indicating the first launched API Level of device |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getLogcat
public abstract InputStreamSource getLogcat ()
Grabs a snapshot stream of the logcat data.
Works in two modes:
TestDeviceOptions.getMaxLogcatDataSize()
bytes of the current contents of the background logcat capture退货 | |
---|---|
InputStreamSource |
getLogcat
public abstract InputStreamSource getLogcat (int maxBytes)
Grabs a snapshot stream of the last maxBytes
of captured logcat data.
Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat()
snapshot.
参数 | |
---|---|
maxBytes | int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory |
退货 | |
---|---|
InputStreamSource |
getLogcatDump
public abstract InputStreamSource getLogcatDump ()
Get a dump of the current logcat for device. Unlike getLogcat()
, this method will always return a static dump of the logcat.
Has the disadvantage that nothing will be returned if device is not reachable.
退货 | |
---|---|
InputStreamSource | a InputStreamSource of the logcat data. An empty stream is returned if fail to capture logcat data. |
getLogcatSince
public abstract InputStreamSource getLogcatSince (long date)
Grabs a snapshot stream of captured logcat data starting the date provided. The time on the device should be used getDeviceDate()
.
参数 | |
---|---|
date | long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s') |
退货 | |
---|---|
InputStreamSource |
getMountPoint
public abstract String getMountPoint (String mountName)
Returns a mount point.
Queries the device directly if the cached info inIDevice
is not available. TODO: move this behavior to IDevice#getMountPoint(String)
参数 | |
---|---|
mountName | String : the name of the mount point |
退货 | |
---|---|
String | the mount point or null |
getMountPointInfo
public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
Returns a MountPointInfo
corresponding to the specified mountpoint path, or null
if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.
参数 | |
---|---|
mountpoint | String |
退货 | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
投掷 | |
---|---|
DeviceNotAvailableException |
也可以看看:
getMountPointInfo
public abstractgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
退货 | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
投掷 | |
---|---|
DeviceNotAvailableException |
getPartitionFreeSpace
public abstract long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
参数 | |
---|---|
partition | String |
退货 | |
---|---|
long | the amount of free space in KB |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getProcessByName
public abstract ProcessInfo getProcessByName (String processName)
Helper method runs the "pidof" and "stat" command and returns ProcessInfo
object with PID and process start time of the given process.
参数 | |
---|---|
processName | String : the proces name String. |
退货 | |
---|---|
ProcessInfo | ProcessInfo of given processName |
投掷 | |
---|---|
DeviceNotAvailableException |
getProcessPid
public abstract String getProcessPid (String process)
Returns the pid of the service or null if something went wrong.
参数 | |
---|---|
process | String : The proces name String. |
退货 | |
---|---|
String |
投掷 | |
---|---|
DeviceNotAvailableException |
getProductType
public abstract String getProductType ()
Convenience method to get the product type of this device.
This method will work if device is in either adb or fastboot mode.退货 | |
---|---|
String | the String product type name. Will not be null |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered, or if product type can not be determined |
getProductVariant
public abstract String getProductVariant ()
Convenience method to get the product variant of this device.
This method will work if device is in either adb or fastboot mode.退货 | |
---|---|
String | the String product variant name or null if it cannot be determined |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getProperty
public abstract String getProperty (String name)
Retrieve the given property value from the device.
参数 | |
---|---|
name | String : the property name |
退货 | |
---|---|
String | the property value or null if it does not exist |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getRecoveryMode
public abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
退货 | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
退货 | |
---|---|
String | the String serial number |
getTombstones
public abstractgetTombstones ()
Fetch and return the list of tombstones from the devices. Requires root.
method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException
will terminate the method early.
退货 | |
---|---|
A list of tombstone files, empty if no tombstone. |
投掷 | |
---|---|
DeviceNotAvailableException |
也可以看看:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
退货 | |
---|---|
long |
getUseFastbootErase
public abstract boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
退货 | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
isAdbRoot
public abstract boolean isAdbRoot ()
退货 | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isAdbTcp
public abstract boolean isAdbTcp ()
退货 | |
---|---|
boolean | true if device is connected to adb-over-tcp, false otherwise. |
isAppEnumerationSupported
public abstract boolean isAppEnumerationSupported ()
Check whether platform on device supports app enumeration
退货 | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isBypassLowTargetSdkBlockSupported
public abstract boolean isBypassLowTargetSdkBlockSupported ()
Check whether platform on device supports bypassing low target sdk block on app installs
退货 | |
---|---|
boolean | True if bypass low target sdk block is supported, false otherwise |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
退货 | |
---|---|
boolean | true if the device is encrypted. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isDirectory
public abstract boolean isDirectory (String deviceFilePath)
Return True if the path on the device is a directory, false otherwise.
参数 | |
---|---|
deviceFilePath | String |
退货 | |
---|---|
boolean |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
退货 | |
---|---|
boolean | true if the device supports encryption. |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isExecutable
public abstract boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
参数 | |
---|---|
fullPath | String |
退货 | |
---|---|
boolean |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
退货 | |
---|---|
boolean |
投掷 | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
退货 | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
退货 | |
---|---|
boolean |
logAnrs
public abstract boolean logAnrs (ITestLogger logger)
Collects and log ANRs from the device.
参数 | |
---|---|
logger | ITestLogger : an ITestLogger to log the ANRs. |
退货 | |
---|---|
boolean | True if the logging was successful, false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException |
logOnDevice
public abstract void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)
Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.
参数 | |
---|---|
tag | String : The tag under which we log our message in the logcat. |
level | Log.LogLevel : The debug level of the message in the logcat. |
format | String : The message format. |
args | Object : the args to be replaced via String.format(). |
nonBlockingReboot
public abstract void nonBlockingReboot ()
Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
postBootSetup
public abstract void postBootSetup ()
Perform instructions to configure device for testing that after every boot.
Should be called after device is fully booted/available In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot. Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
postInvocationTearDown
public void postInvocationTearDown ()
This method is deprecated.
Use postInvocationTearDown(Throwable)
instead.
Extra steps for device specific required clean up that will be executed after the invocation is done.
postInvocationTearDown
public abstract void postInvocationTearDown (Throwable invocationException)
Extra steps for device specific required clean up that will be executed after the invocation is done.
参数 | |
---|---|
invocationException | Throwable : if any, the final exception raised by the invocation failure. |
preInvocationSetup
public void preInvocationSetup (IBuildInfo info, MultiMap<String, String> attributes)
Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.
参数 | |
---|---|
info | IBuildInfo : The IBuildInfo of the device. |
attributes | MultiMap : The attributes stored in the invocation context |
投掷 | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public abstract boolean pullDir (String deviceFilePath, File localDir)
Recursively pull directory contents from device.
参数 | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
退货 | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract File pullFile (String remoteFilePath, int userId)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
参数 | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
userId | int : The user id to pull from |
退货 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract File pullFile (String remoteFilePath)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
参数 | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
退货 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract boolean pullFile (String remoteFilePath, File localFile)
Retrieves a file off device.
参数 | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
退货 | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract boolean pullFile (String remoteFilePath, File localFile, int userId)
Retrieves a file off device.
参数 | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
userId | int : The user id to pull from |
退货 | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFileContents
public abstract String pullFileContents (String remoteFilePath)
Retrieves a file off device, and returns the contents.
参数 | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
退货 | |
---|---|
String | A String containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
投掷 | |
---|---|
DeviceNotAvailableException |
pullFileFromExternal
public abstract File pullFileFromExternal (String remoteFilePath)
A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File)
, and return a reference to that File
.
参数 | |
---|---|
remoteFilePath | String : the path to file on device, relative to the device's external storage mountpoint |
退货 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
参数 | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
退货 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath)
Recursively push directory contents to device.
参数 | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
退货 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath, 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 |
deviceFilePath | String : the remote destination absolute file path |
evaluateContentProviderNeeded | boolean : whether to check if we need the content provider |
退货 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath)
Push a file to device. By default using a content provider.
参数 | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
退货 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushString
public abstract boolean pushString (String contents, String deviceFilePath)
Push file created from a string to device
参数 | |
---|---|
contents | String : the contents of the file to push |
deviceFilePath | String : the remote destination absolute file path |
退货 | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
reboot
public abstract void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.投掷 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
reboot
public abstract 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 | if device is not available after reboot |
rebootIntoBootloader
public abstract void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoFastbootd
public abstract void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoRecovery
public abstract void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recovery投掷 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootIntoSideload
public abstract 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 | if device is not in sideload after reboot |
rebootIntoSideload
public abstract 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 | if device is not in sideload after reboot |
rebootUntilOnline
public abstract void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
投掷 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUntilOnline
public abstract 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 | if device is not available after reboot |
也可以看看:
rebootUserspace
public abstract void rebootUserspace ()
Reboots only userspace part of device.
Blocks until device becomes available.
WARNING. Userspace reboot is currently under active development, use it on your own risk.
投掷 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUserspaceUntilOnline
public abstract void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
投掷 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
remountSystemReadOnly
public abstract void remountSystemReadOnly ()
Make the system partition on the device read-only. May reboot the device.
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountSystemWritable
public abstract void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorReadOnly
public abstract void remountVendorReadOnly ()
Make the vendor partition on the device read-only. May reboot the device.
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
runInstrumentationTests
public abstract 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 | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTests
public abstract 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 | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTestsAsUser
public abstract 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 abstract 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 |
setDate
public abstract 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 |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setOptions
public abstract void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
参数 | |
---|---|
options | TestDeviceOptions |
setProperty
public abstract 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. |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setRecovery
public abstract 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 abstract 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. |
setUseFastbootErase
public abstract 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 abstract 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.stopEmulatorOutput
public abstract void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public abstract 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.switchToAdbTcp
public abstract String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
退货 | |
---|---|
String | the tcp serial number or null if device could not be switched |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
退货 | |
---|---|
boolean | true if switch was successful, false otherwise. |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
syncFiles
public abstract boolean syncFiles (File localFileDir, String deviceFilePath)
Incrementally syncs the contents of a local file directory to device.
Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date. Hidden files (with names starting with ".") will be ignored. Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.参数 | |
---|---|
localFileDir | File : the local file directory containing files to recursively push. |
deviceFilePath | String : the remote destination absolute file path root. All directories in thos file path must be readable. ie pushing to /data/local/tmp when adb is not root will fail |
退货 | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
unlockDevice
public abstract 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 | if connection with device is lost and cannot be recovered. |
UnsupportedOperationException | if encryption is not supported on the device. |
waitForBootComplete
public abstract 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 |
投掷 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
waitForDeviceAvailable
public abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceAvailable
public abstract 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 | if device is still unresponsive after waitTime expires. |
waitForDeviceAvailableInRecoverPath
public abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
投掷 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceInRecovery
public abstract 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 otherwise |
waitForDeviceInSideload
public abstract 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 otherwise |
waitForDeviceNotAvailable
public abstract 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 otherwise |
waitForDeviceOnline
public abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceOnline
public abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceShell
public abstract 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. |