本地设备

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 ProcessInfo进行比较来检查设备是否软重启的帮助程序方法。

abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)

用于检查设备是否自 UTC 时间以来设备及其ERROR(/TimeUnit)软重启的方法。

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 命令并以String形式返回输出的 Helper 方法。

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 命令并将结果作为CommandResult返回的帮助程序方法,其中正确填充了命令状态输出、stdout 和 stderr。

abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)

执行 adb shell 命令并将结果作为CommandResult返回的帮助程序方法,其中正确填充了命令状态输出和 stderr。

abstract CommandResult executeShellV2Command (String command, File pipeAsInput)

执行 adb shell 命令并将结果作为CommandResult返回的帮助程序方法,其中正确填充了命令状态输出、stdout 和 stderr。

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

如果设备已分配,则返回缓存的DeviceDescriptor ,否则返回当前的DeviceDescriptor

abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

如果设备已分配,则返回缓存的DeviceDescriptor ,否则返回当前的DeviceDescriptor

abstract String[] getChildren (String deviceFilePath)

使用IFileEntry的替代方案有时由于权限问题而无法工作。

abstract AbstractConnection getConnection ()

返回与设备关联的连接。

abstract String getDeviceClass ()

获取设备类别。

abstract long getDeviceDate ()

返回设备的日期(自纪元以来的毫秒数)。

abstract DeviceDescriptor getDeviceDescriptor ()

从设备信息中返回DeviceDescriptor以获取其信息,而无需传递实际的设备对象。

abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

从设备信息中返回DeviceDescriptor以获取其信息,而无需传递实际的设备对象。

abstract TestDeviceState getDeviceState ()

获取设备的状态。

abstract long getDeviceTimeOffset (Date date)

帮助获取设备与给定ERROR(/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 IDevice的引用。

abstract long getIntProperty (String name, long defaultValue)

从设备返回给定属性的整数值。

abstract long getLastExpectedRebootTimeMillis ()

返回自System.currentTimeMillis()返回的 EPOCH 以来 Tradefed API 上次触发重启的时间(以毫秒为单位)。

abstract int getLaunchApiLevel ()

获取设备首次启动的 API 级别。

abstract InputStreamSource getLogcat ()

获取 logcat 数据的快照流。

abstract InputStreamSource getLogcat (int maxBytes)

获取捕获的 logcat 数据的最后maxBytes的快照流。

abstract InputStreamSource getLogcatDump ()

获取设备当前 logcat 的转储。

abstract InputStreamSource getLogcatSince (long date)

获取从提供的日期开始捕获的 logcat 数据的快照流。

abstract String getMountPoint (String mountName)

返回一个挂载点。

abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

返回与指定挂载点路径相对应的MountPointInfo ,如果该路径没有挂载任何内容,或者未作为挂载点出现在 /proc/mounts 中,则返回null

abstract getMountPointInfo ()

返回设备上 /proc/mounts 中信息的已解析版本

abstract long getPartitionFreeSpace (String partition)

确定设备分区上的可用空间量的帮助程序方法。

abstract ProcessInfo getProcessByName (String processName)

Helper 方法运行“pidof”和“stat”命令,并返回带有给定进程的 PID 和进程启动时间的ProcessInfo对象。

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

检查 debugfs 是否已安装。

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

如果设备处于TestDeviceState#FASTBOOTTestDeviceState.FASTBOOTD状态,则返回 true。

abstract boolean logAnrs ( ITestLogger logger)

从设备收集并记录 ANR。

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

在设备的 logcat 中记录消息。

abstract void mountDebugfs ()

挂载调试文件。

abstract void nonBlockingReboot ()

发出重新启动设备的命令,并在命令完成时以及设备不再对 adb 可见时返回。

abstract void postBootSetup ()

执行说明来配置设备,以便在每次启动后进行测试。

default void postInvocationTearDown ()

此方法已被弃用。请改用postInvocationTearDown(Throwable)

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)

从设备上检索文件,将其存储在本地临时ERROR(/File)中,然后返回该File

abstract File pullFile (String remoteFilePath)

从设备上检索文件,将其存储在本地临时ERROR(/File)中,然后返回该File

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)

一种从设备的外部存储检索文件、将其存储在本地临时ERROR(/File)中并返回对该File的引用的便捷方法。

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)

pushFile(File, String)的变体,可以选择考虑评估内容提供者的需求。

abstract boolean pushFile (File localFile, String deviceFilePath)

将文件推送到设备。

abstract boolean pushString (String contents, String deviceFilePath)

将根据字符串创建的文件推送到设备

abstract void reboot ()

将设备重新启动至 adb 模式。

abstract void reboot (String reason)

将设备重新启动到 adb 模式,并给出在重新启动后保留的reason

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

reboot()的替代方法,仅在设备在线(即对 adb 可见)之前阻塞。

abstract void rebootUntilOnline (String reason)

reboot()的替代方法,仅在设备在线(即对 adb 可见)之前阻塞。

abstract void rebootUserspace ()

仅重新启动设备的用户空间部分。

abstract void rebootUserspaceUntilOnline ()

rebootUserspace() ()} 的替代方案,仅在设备在线(即对 adb 可见)之前阻塞。

abstract void remountSystemReadOnly ()

将设备上的系统分区设置为只读。

abstract void remountSystemWritable ()

使设备上的系统分区可写。

abstract void remountVendorReadOnly ()

将设备上的供应商分区设置为只读。

abstract void remountVendorWritable ()

使设备上的供应商分区可写。

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

使用作为参数传递的一个或多个侦听器来执行ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection))的便捷方法。

abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners)

运行仪器测试并提供设备恢复。

abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners)

ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection))但运行测试对于给定的用户。

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

ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)相同,但为给定用户运行测试。

abstract void setDate (Date date)

设置设备上的日期

注意:在设备上设置日期需要root

abstract void setOptions ( TestDeviceOptions options)

设置设备的TestDeviceOptions

abstract boolean setProperty (String propKey, String propValue)

设置设备上给定的属性值。

abstract void setRecovery ( IDeviceRecovery recovery)

设置用于此设备的IDeviceRecovery

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

卸载 debugfs。

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”状态(请注意,这与IDeviceRecovery不同)。

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 :fastboot命令运行时使用的系统环境变量

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

Helper 方法收集带有启动时间和启动原因的启动历史记录图。

退货
启动时间图(自纪元以来以秒为单位的 UTC 时间)和启动原因

投掷
DeviceNotAvailableException

获取启动历史记录

public abstract  getBootHistorySince (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 AbstractConnection getConnection ()

返回与设备关联的连接。

退货
AbstractConnection

获取设备类

public abstract String getDeviceClass ()

获取设备类别。

退货
String String设备类。

获取设备日期

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

获取设备的状态。

退货
TestDeviceState

获取设备时间偏移

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的文件,则IFileEntrynull

投掷
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

获取设备

public abstract IDevice getIDevice ()

返回对关联 ddmlib IDevice的引用。

每次设备与 adb 断开连接并重新连接时,DDMS 可能会分配一个新的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()返回以来,返回最后一次交易的API触发了一次以毫秒为单位的重新启动。

退货
long

getlaunchapilevel

public abstract int getLaunchApiLevel ()

获取设备的第一个启动API级别。默认为UNKNOWN_API_LEVEL

退货
int一个整数,指示第一个启动的API设备级别

投掷
com.android.tradefed.device.devicenotavailable Exception
DeviceNotAvailableException

getlogcat

public abstract InputStreamSource getLogcat ()

抓住LogCat数据的快照流。

以两种模式工作:

  • 如果当前在后台捕获了logcat,则将返回到TestDeviceOptions.getMaxLogcatDataSize()字节,该字节的当前内容的当前内容capture capture的当前内容
  • 否则,如果设备当前响应,将返回LogCat数据的静态转储

    退货
    InputStreamSource

  • getlogcat

    public abstract InputStreamSource getLogcat (int maxBytes)

    抓住捕获的logcat数据的最后一个maxBytes的快照流。

    对于您想捕获捕获的LogCat数据的频繁快照而不产生可能的大磁盘空间罚款,即获取整个getLogcat()快照时,很有用。

    参数
    maxBytes int :要返回的最大数据量。应该是可以舒适地适合记忆的数量

    退货
    InputStreamSource

    getlogcatdump

    public abstract InputStreamSource getLogcatDump ()

    获取用于设备的当前logcat的转储。与getLogcat()不同,此方法将始终返回logcat的静态转储。

    缺点是,如果无法到达设备,则不会返回。

    退货
    InputStreamSource LOGCAT数据的InputStreamSource 。如果无法捕获LogCat数据,将返回空流。

    getlogcatsince

    public abstract InputStreamSource getLogcatSince (long date)

    从提供的日期开始捕获捕获的LogCat数据的快照流。设备上的时间应使用getDeviceDate()

    参数
    date long :自何时启动快照直到现在的时期格式以来,以毫秒为单位。 (可以使用“日期 +%s”获得)

    退货
    InputStreamSource

    getmountpoint

    public abstract String getMountPoint (String mountName)

    返回安装点。

    如果没有IDevice中的缓存信息,请直接查询设备。

    TODO:将此行为移至IDevice#getMountPoint(String)

    参数
    mountName String :安装点的名称

    退货
    String安装点或null

    也可以看看:

    getmountpointinfo

    public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

    返回对应于指定的安装点路径的MountPointInfo ,如果该路径没有安装或以其他方式没有出现在 /proc /安装端作为安装点,则null

    参数
    mountpoint String

    退货
    ITestDevice.MountPointInfo MountPointInfoERROR(/List)其中包含“/proc/mounts”中的信息

    投掷
    DeviceNotAvailableException

    也可以看看:

    getmountpointinfo

    public abstract  getMountPointInfo ()

    返回设备上 /proc /安装的信息的解析版本

    退货
    MountPointInfoERROR(/List)其中包含“/proc/mounts”中的信息

    投掷
    DeviceNotAvailableException

    getPartitionFreespace

    public abstract long getPartitionFreeSpace (String partition)

    助手方法确定设备分区上的可用空间数量。

    参数
    partition String

    退货
    long KB中的自由空间数量

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    getProcessbyName

    public abstract ProcessInfo getProcessByName (String processName)

    助手方法运行“ pidof”和“ stat”命令,并使用PID返回ProcessInfo对象,并在给定过程的开始时间和过程开始时间。

    参数
    processName String :proces name string。

    退货
    ProcessInfo给定ProcessName的ProcessInfo

    投掷
    DeviceNotAvailableException

    getProcesspid

    public abstract String getProcessPid (String process)

    如果出现问题,将返回服务的PID或无效。

    参数
    process String :proces name string。

    退货
    String

    投掷
    DeviceNotAvailableException

    getProductType

    public abstract String getProductType ()

    获取此设备产品类型的便利方法。

    如果设备处于ADB或FastBoot模式,此方法将起作用。

    退货
    String String产品类型名称。不会无效

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复,或者无法确定产品类型

    GetProductVariant

    public abstract String getProductVariant ()

    获取此设备产品变体的便利方法。

    如果设备处于ADB或FastBoot模式,此方法将起作用。

    退货
    String String产品变体名称或null如果无法确定

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    获取属性

    public abstract String getProperty (String name)

    从设备中检索给定的属性值。

    参数
    name String :属性名称

    退货
    String属性值或null (如果不存在)

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    GetRecoveryMode

    public abstract ITestDevice.RecoveryMode getRecoveryMode ()

    获取用于设备的当前恢复模式。

    退货
    ITestDevice.RecoveryMode设备使用的当前恢复模式。

    getSerialnumber

    public abstract String getSerialNumber ()

    获取此设备序列号的便利方法。

    退货
    String String序列号

    GetTombstones

    public abstract  getTombstones ()

    从设备中获取并返回墓碑清单。需要根。

    方法是最好的效果,因此,如果由于任何原因将一个墓碑未能拉出,则它将缺少列表中的墓碑。只有DeviceNotAvailableException才能尽早终止该方法。

    退货
    墓碑文件列表,如果没有墓碑,则空。

    投掷
    DeviceNotAvailableException

    也可以看看:

    getTotalMemory

    public abstract long getTotalMemory ()

    在内部错误时返回字节中的总物理内存大小或-1

    退货
    long

    GetUseStfastbooterase

    public abstract boolean getUseFastbootErase ()

    获取是使用FastBoot Erase还是FastBoot格式来擦除设备上的分区。

    退货
    boolean如果使用FastBoot擦除,则如果使用FastBoot格式, false true

    也可以看看:

    Isadbroot

    public abstract boolean isAdbRoot ()

    退货
    boolean如果设备当前具有ADB root, true ,则为false

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    ISADBTCP

    public abstract boolean isAdbTcp ()

    退货
    boolean如果设备连接到ADB-over-TCP, true ,否则为false

    Isappenumerations pupport

    public abstract boolean isAppEnumerationSupported ()

    检查设备上的平台是否支持应用程序枚举

    退货
    boolean如果支持应用程序枚举,则为false,否则

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    ISBYPASSLOWTARGETSDKBLOCKSUPTORPORTED

    public abstract boolean isBypassLowTargetSdkBlockSupported ()

    检查设备上的平台是否支持绕过应用程序安装上的低目标SDK块

    退货
    boolean如果支持旁路低目标SDK块,则为false,否则为否则

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    isdebugfsmount

    public abstract boolean isDebugfsMounted ()

    检查debugfs是否已安装。

    退货
    boolean如果debugfs true

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    ISDEVICEENCHECTPTED

    public abstract boolean isDeviceEncrypted ()

    如果设备加密,则返回。

    退货
    boolean如果对设备进行了加密,则为true

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    是目录

    public abstract boolean isDirectory (String deviceFilePath)

    如果设备上的路径是目录,则返回true,否则为false。

    参数
    deviceFilePath String

    退货
    boolean

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    Isencryptionsupport

    public abstract boolean isEncryptionSupported ()

    如果在设备上支持加密,则返回。

    退货
    boolean如果设备支持加密,则为true

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    可以确定

    public abstract boolean isExecutable (String fullPath)

    如果设备上的文件路径是可执行文件,则返回true,否则为false。

    参数
    fullPath String

    退货
    boolean

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    无头

    public abstract boolean isHeadless ()

    如果设备无头(没有屏幕),则返回true,否则为false。

    退货
    boolean

    投掷
    DeviceNotAvailableException

    IsruntimePermissionsupport

    public abstract boolean isRuntimePermissionSupported ()

    检查设备上的平台是否支持运行时许可授予

    退货
    boolean是的,如果支持运行时权限,否则为false。

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    isstatebootloaderorfastbootd

    public abstract boolean isStateBootloaderOrFastbootd ()

    如果设备位于TestDeviceState#FASTBOOTTestDeviceState.FASTBOOTD中,则返回true。

    退货
    boolean

    Loganrs

    public abstract boolean logAnrs (ITestLogger logger)

    从设备收集并记录ANRS。

    参数
    logger ITestLoggerITestLogger记录ANRS。

    退货
    boolean如果记录成功,则是真的,否则为错误。

    投掷
    DeviceNotAvailableException

    logondevice

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

    在设备的对数猫中记录一条消息。这是一个安全的电话,即使登录失败也不会投掷。

    参数
    tag String :我们在logcat中记录消息的标签。

    level Log.LogLevel :logcat中消息的调试级别。

    format String :消息格式。

    args Object :通过string.format()替换的args。

    Mountdebugfs

    public abstract void mountDebugfs ()

    山debugfs。

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    非BlockingReboot

    public abstract void nonBlockingReboot ()

    发出重新启动设备并在命令上返回的命令以及ADB不再可见设备时。

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    后启动

    public abstract void postBootSetup ()

    执行指令以配置每个引导后测试设备。

    设备完全启动/可用后应调用

    在正常情况下,此方法无需明确调用,因为执行重新启动时的实现应自动执行这些步骤。

    可能需要调用的地方是当设备重新启动其他事件时(例如,何时快速启动更新命令完成)

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    后投资测试

    public void postInvocationTearDown ()

    此方法被弃用。
    改用后postInvocationTearDown(Throwable)

    设备特定所需的额外步骤清理将在调用后将执行。

    后投资测试

    public abstract void postInvocationTearDown (Throwable invocationException)

    设备特定所需的额外步骤清理将在调用后将执行。

    参数
    invocationException Throwable :如果有的话,最终例外是由调用失败提出的。

    启动前

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

    在调用流之前将在设备上执行的设备特定所需设置的额外步骤。

    参数
    info IBuildInfo :设备的IBuildInfo

    attributes MultiMap :存储在调用上下文中的属性

    投掷
    com.android.tradefed.targetprep.targetsetuperror
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException
    TargetSetupError

    plldir

    public abstract boolean pullDir (String deviceFilePath, 
                    File localDir)

    从设备中递归从设备中提取目录内容。

    参数
    deviceFilePath String :远程源的绝对文件路径

    localDir File :将文件拉入的本地目录

    退货
    boolean如果成功拉出文件,则为true 。否则为false

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    plullfile

    public abstract File pullFile (String remoteFilePath, 
                    int userId)

    检索离设备的文件,将其存储在本地临时ERROR(/File)中,然后返回该File

    参数
    remoteFilePath String :设备上文件的绝对路径。

    userId int :要从

    退货
    File一个包含设备文件内容的ERROR(/File) ,如果出于任何原因副本失败(包括主机文件系统的问题),则null

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    plullfile

    public abstract File pullFile (String remoteFilePath)

    检索离设备的文件,将其存储在本地临时ERROR(/File)中,然后返回该File

    参数
    remoteFilePath String :设备上文件的绝对路径。

    退货
    File一个包含设备文件内容的ERROR(/File) ,如果出于任何原因副本失败(包括主机文件系统的问题),则null

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    plullfile

    public abstract boolean pullFile (String remoteFilePath, 
                    File localFile)

    检索文件设备的文件。

    参数
    remoteFilePath String :设备上文件的绝对路径。

    localFile File :要将内容存储在中的本地文件。如果非空,将更换内容。

    退货
    boolean如果成功检索文件,则为true 。否则为false

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    plullfile

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

    检索文件设备的文件。

    参数
    remoteFilePath String :设备上文件的绝对路径。

    localFile File :要将内容存储在中的本地文件。如果非空,将更换内容。

    userId int :要从

    退货
    boolean如果成功检索文件,则为true 。否则为false

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    Pullfilectents

    public abstract String pullFileContents (String remoteFilePath)

    检索从设备上的文件,然后返回内容。

    参数
    remoteFilePath String :设备上文件的绝对路径。

    退货
    String一个包含设备文件内容的String ,如果出于任何原因副本失败(包括主机文件系统的问题),则null

    投掷
    DeviceNotAvailableException

    pullfilefromexternal

    public abstract File pullFileFromExternal (String remoteFilePath)

    一种便利方法,可以从设备的外部存储中检索文件,将其存储在本地临时ERROR(/File)中,然后返回对该File的引用。

    参数
    remoteFilePath String :相对于设备的外部存储安装点,在设备上文件的路径

    退货
    File一个包含设备文件内容的ERROR(/File) ,如果出于任何原因副本失败(包括主机文件系统的问题),则null

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    pushdir

    public abstract boolean pushDir (File localDir, 
                    String deviceFilePath, 
                     excludedDirectories)

    递归将目录的目录推向设备,同时排除了一些已过滤的目录。

    参数
    localDir File :要推的本地目录

    deviceFilePath String :远程目标的绝对文件路径

    excludedDirectories :一组不应推动的目录名称。

    退货
    boolean如果成功推动文件,则为true 。否则为false

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    pushdir

    public abstract boolean pushDir (File localDir, 
                    String deviceFilePath)

    递归将目录内容的内容推向设备。

    参数
    localDir File :要推的本地目录

    deviceFilePath String :远程目标的绝对文件路径

    退货
    boolean如果成功推动文件,则为true 。否则为false

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    Pushfile

    public abstract boolean pushFile (File localFile, 
                    String deviceFilePath, 
                    boolean evaluateContentProviderNeeded)

    pushFile(File, String)的变体可以选择考虑评估内容提供商的需求。

    参数
    localFile File :要推的本地文件

    deviceFilePath String :远程目标绝对文件路径

    evaluateContentProviderNeeded boolean :是否要检查我们是否需要内容提供商

    退货
    boolean如果成功推动文件,则为true 。否则为false

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    Pushfile

    public abstract boolean pushFile (File localFile, 
                    String deviceFilePath)

    将文件推到设备。默认情况下使用内容提供商。

    参数
    localFile File :要推的本地文件

    deviceFilePath String :远程目标绝对文件路径

    退货
    boolean如果成功推动文件,则为true 。否则为false

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    推串

    public abstract boolean pushString (String contents, 
                    String deviceFilePath)

    推动文件从字符串到设备创建

    参数
    contents String :要推的文件的内容

    deviceFilePath String :远程目标绝对文件路径

    退货
    boolean如果成功推动字符串,则为true 。否则为false

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    重启

    public abstract void reboot ()

    将设备重新启动到ADB模式。

    块直到设备可用。

    投掷
    DeviceNotAvailableException如果重新启动后无法使用设备

    重启

    public abstract void reboot (String reason)

    重新启动设备为ADB模式,并在重新启动过程中持续存在reason

    块直到设备可用。

    可以通过查询sys.boot.reason propety来获得最后一次重新启动原因。

    参数
    reason String :重新启动的原因,或者如果未指定原因,则为null

    投掷
    DeviceNotAvailableException如果重新启动后无法使用设备

    RebootIntobootloader

    public abstract void rebootIntoBootloader ()

    将设备重新启动到引导加载模式。

    块,直到设备处于引导加载模式为止。

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    RebootintofastBootd

    public abstract void rebootIntoFastbootd ()

    将设备重新启动到FastBootD模式。

    块直到设备处于fastbootd模式为止。

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    重新引导

    public abstract void rebootIntoRecovery ()

    将设备重新启动到ADB恢复模式。

    块直到设备进入恢复

    投掷
    DeviceNotAvailableException如果重新启动后无法使用设备

    重新启动sideLoad

    public abstract void rebootIntoSideload (boolean autoReboot)

    将设备重新启动到ADB SIDELODOD模式(请注意,这是恢复的特殊模式)

    块直到设备进入侧载模式

    参数
    autoReboot boolean :是否在侧load后自动重新启动设备

    投掷
    DeviceNotAvailableException如果设备在重新启动后不在侧load中

    重新启动sideLoad

    public abstract void rebootIntoSideload ()

    将设备重新启动到ADB SIDELODOD模式(请注意,这是恢复的特殊模式)

    块直到设备进入侧载模式

    投掷
    DeviceNotAvailableException如果设备在重新启动后不在侧load中

    重新引导

    public abstract void rebootUntilOnline ()

    reboot()的替代方法,它仅阻止设备在线,即ADB可见。

    投掷
    DeviceNotAvailableException如果重新启动后无法使用设备

    重新引导

    public abstract void rebootUntilOnline (String reason)

    reboot()的替代方法,它仅阻止设备在线,即ADB可见。

    参数
    reason String :重新启动的原因,或者如果未指定原因,则为null

    投掷
    DeviceNotAvailableException如果重新启动后无法使用设备

    也可以看看:

    重新启动空间

    public abstract void rebootUserspace ()

    仅重新启动设备的用户空间部分。

    块直到设备可用。

    警告。用户空间重新启动目前正在积极开发中,请自行使用它。

    投掷
    DeviceNotAvailableException如果重新启动后无法使用设备

    Rebootusers -paceuntilline

    public abstract void rebootUserspaceUntilOnline ()

    rebootUserspace() ()}的替代方法,它仅阻止设备在线,即ADB可见。

    投掷
    DeviceNotAvailableException如果重新启动后无法使用设备

    remountsystempookly

    public abstract void remountSystemReadOnly ()

    将系统分区在设备上读取。可以重新启动设备。

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    remountsystemstible

    public abstract void remountSystemWritable ()

    使设备上的系统分区可写。可以重新启动设备。

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    重新启动

    public abstract void remountVendorReadOnly ()

    将供应商分区在设备上只读。可以重新启动设备。

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    重新安置

    public abstract void remountVendorWritable ()

    在设备上进行供应商分区。可以重新启动设备。

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    runinStrumentationTests

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

    执行ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) ,一个或多个侦听器作为参数传递。

    参数
    runner IRemoteAndroidTestRunner :运行测试的IRemoteAndroidTestRunner

    listeners ITestLifeCycleReceiver :测试结果侦听器(S)

    退货
    boolean如果已完成测试命令,则为true 。如果未能完成,则false ,但恢复成功了

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。 IE测试命令无法完成,恢复失败。

    runinStrumentationTests

    public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                     listeners)

    运行仪表测试,并提供设备恢复。

    如果在测试运行完成之前丢失了与设备的连接,并且恢复成功,则将返回所有侦听器的testrunfailed,并将返回“ false”。测试命令不会重新运行。如有必要,它留给呼叫者重试。

    如果在测试运行完成之前丢失了与设备的连接,并且恢复失败,则将抛出所有听众的测试和DevicenotavailableException。

    参数
    runner IRemoteAndroidTestRunner :运行测试的IRemoteAndroidTestRunner

    listeners :测试结果听众

    退货
    boolean如果已完成测试命令,则为truefalse ,如果由于设备通信异常而无法完成,但是恢复成功了

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。 IE测试命令无法完成,恢复失败。

    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对于给定的用户。

    参数
    runner IRemoteAndroidTestRunner

    userId int

    listeners

    退货
    boolean

    投掷
    DeviceNotAvailableException

    runinStrumentationTestSasuser

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

    ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)相同,但为给定用户运行了测试。

    参数
    runner IRemoteAndroidTestRunner

    userId int

    listeners ITestLifeCycleReceiver

    退货
    boolean

    投掷
    DeviceNotAvailableException

    设置日期

    public abstract void setDate (Date date)

    设置设备上的日期

    注意:设备上的设置日期需要根

    参数
    date Date :指定特定日期;如果null将使用主机日期

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    setOptions

    public abstract void setOptions (TestDeviceOptions options)

    为设备设置TestDeviceOptions

    参数
    options TestDeviceOptions

    SetProperty

    public abstract boolean setProperty (String propKey, 
                    String propValue)

    在设备上设置给定的属性值。需要ADB根是正确的。

    参数
    propKey String :要设置的键目标。

    propValue String :要设置的属性值。

    退货
    boolean如果SetProp命令成功,则返回True ,否则为false。

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    setRecovery

    public abstract void setRecovery (IDeviceRecovery recovery)

    IDeviceRecovery设置为用于此设备。首先分配设备时应设置。

    参数
    recovery IDeviceRecoveryIDeviceRecovery

    setRecoverymode

    public abstract void setRecoveryMode (ITestDevice.RecoveryMode mode)

    设置当前恢复模式以用于设备。

    用于控制遇到设备通信问题时使用的恢复方法。建议仅在需要时谨慎使用此方法(例如,框架下降等等,等等

    参数
    mode ITestDevice.RecoveryMode :是否应打开“恢复直到在线”模式。

    SETUSEFASTBOOTERASE

    public abstract void setUseFastbootErase (boolean useFastbootErase)

    设置使用FastBoot Erase还是FastBoot格式来擦除设备上的分区。

    参数
    useFastbootErase boolean true :如果应该使用快速启动格式,则应使用FastBoot Erase或false

    也可以看看:

    StartLogCat

    public abstract void startLogcat ()

    开始从设备中捕获LogCat输出。

    如果已经捕获了LogCat输出,将无效。可以通过getlogcat检索数据。

    当不再使用设备时,必须调用stopLogcat()

    startLogcat()stopLogcat()在TF调用上下文中通常不需要调用,因为TF框架将启动和停止LogCat。

    stopemulatorOutput

    public abstract void stopEmulatorOutput ()

    关闭并删除模拟器输出。

    stoplogcat

    public abstract void stopLogcat ()

    停止从设备捕获LogCat输出,并丢弃当前保存的LogCat数据。

    如果未捕获LogCat输出,将无效。

    switchtoAdbTCP

    public abstract String switchToAdbTcp ()

    将设备切换为ADB-over-TCP模式。

    退货
    String如果无法切换设备,则TCP序列号或null

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    switchtoadbusb

    public abstract boolean switchToAdbUsb ()

    通过USB模式将设备切换到ADB。

    退货
    boolean true ,如果开关成功,则否则为false

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    Syncfiles

    public abstract boolean syncFiles (File localFileDir, 
                    String deviceFilePath)

    逐步将本地文件目录的内容同步到设备。

    通过将本地文件的时间戳与其远程等效物进行比较来决定要推出的文件。只有“较新”或不存在的文件将被推到设备上。因此,如果设备上设置的文件已经是最新的,则开销应该相对较小。

    隐藏的文件(以“。”开头的名称将被忽略。

    示例用法:SyncFiles(“/tmp/files”,“/sdcard”)如果不存在,将创建A/sdcard/files目录,并递归地将/tmp/files的内容推向/sdcard/files。

    参数
    localFileDir File :包含文件的本地文件目录。

    deviceFilePath String :远程目标绝对文件路径root。 THOS文件路径中的所有目录都必须可读。 IE推到/data/local/tmp当ADB不是root时会失败

    退货
    boolean如果文件成功同步, true 。否则为false

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    解锁魔鬼

    public abstract boolean unlockDevice ()

    如果设备处于加密状态,则解锁设备。

    此方法可能会重新启动框架,但不会调用postBootSetup() 。因此,当此方法返回时,该设备可能无法完全准备好进行测试。

    退货
    boolean如果成功或设备未加密, true

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。
    UnsupportedOperationException如果设备上不支持加密。

    卸载调试文件

    public abstract void unmountDebugfs ()

    卸载debugfs。

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    WaitforBootComplete

    public abstract boolean waitForBootComplete (long timeOut)

    块,直到设置设备的启动完成标志为止。

    参数
    timeOut long :在巨大的时间内等待设置标志

    退货
    boolean如果设备的引导完成标志是在超时设置的

    投掷
    com.android.tradefed.device.devicenotavailable Exception
    DeviceNotAvailableException

    WaitfordEviceAdable

    public abstract boolean waitForDeviceAvailable ()

    等待该设备响应迅速并用于测试。使用默认超时。

    退货
    boolean如果可以使用设备,则为false,如果恢复是禁用且无法使用的,则为false。

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    WaitfordEviceAdable

    public abstract boolean waitForDeviceAvailable (long waitTime)

    等待该设备响应迅速并用于测试。

    参数
    waitTime long :MS等待的时间

    退货
    boolean如果可以使用设备,则为false,如果恢复是禁用且无法使用的,则为false。

    投掷
    DeviceNotAvailableException如果设备在Waittime到期后仍无反应。

    Waitfordeviceavailable intrecoverpath

    public abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)

    等待该设备响应迅速并且可以使用,而无需考虑恢复路径。

    参数
    waitTime long

    退货
    boolean如果有可用的话,则为fals,如果不可用。

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    Waitfordevicebootloader

    public abstract void waitForDeviceBootloader ()

    块,直到通过快速启动可见设备。使用默认超时。

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    Waitfordeviceinrecovery

    public abstract boolean waitForDeviceInRecovery (long waitTime)

    设备处于“ ADB恢复”状态(请注意,这与IDeviceRecovery不同)。

    参数
    waitTime long :MS等待的时间

    退货
    boolean如果设备在时间到期之前引导到恢复中, true 。否则为false

    Waitfordeviceinsideload

    public abstract boolean waitForDeviceInSideload (long waitTime)

    设备处于“ ADB Sideload”状态的块

    参数
    waitTime long :MS等待的时间

    退货
    boolean如果设备在时间到期之前启动到侧load, true 。否则为false

    WaitfordeviceNotavailable

    public abstract boolean waitForDeviceNotAvailable (long waitTime)

    该设备不可用的块,即ADB缺少

    参数
    waitTime long :MS等待的时间

    退货
    boolean如果设备在时间到期之前无法使用, true 。否则为false

    Waitfordeviceonline

    public abstract void waitForDeviceOnline ()

    块直到通过ADB看到设备。使用默认超时

    注意该设备可能不一定会响应完成时的命令。代替使用waitForDeviceAvailable()

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    Waitfordeviceonline

    public abstract void waitForDeviceOnline (long waitTime)

    块直到通过ADB看到设备。

    注意该设备可能不一定会响应完成时的命令。代替使用waitForDeviceAvailable()

    参数
    waitTime long :MS等待的时间

    投掷
    DeviceNotAvailableException如果与设备的连接丢失并且无法恢复。

    Waitfordeviceshell

    public abstract boolean waitForDeviceShell (long waitTime)

    等待设备能够响应基本的ADB Shell命令。

    参数
    waitTime long :MS等待的时间

    退货
    boolean如果设备在waitTime播放之前响应迅速, true