原生设备
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
为 ddmlib IDevice
提供可靠且稍高级别的 API。
概括
常数 | |
---|---|
int | UNKNOWN_API_LEVEL 无法检测 API 级别时的默认值 |
公共方法 | |
---|---|
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 CommandResult | executeFastbootCommand (String... commandArgs) 将 fastboot 命令作为系统命令执行的辅助方法,默认超时为 2 分钟。 |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) 将 fastboot 命令作为系统命令执行的辅助方法。 |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) 辅助方法,它将长时间运行的 fastboot 命令作为具有系统环境变量的系统命令执行。 |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) 将长时间运行的快速启动命令作为系统命令执行的辅助方法。 |
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) 辅助方法,它执行 |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) 辅助方法,它执行 adb shell 命令并将结果作为正确填充命令状态输出、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) Helper 方法收集自给定时间以来从设备和指定的时间单位开始的启动时间和启动原因的启动历史映射。 |
abstract String | getBootloaderVersion () 获取此设备的引导加载程序版本的便捷方法。 |
abstract InputStreamSource | getBugreport () 从设备中检索错误报告。 |
abstract InputStreamSource | getBugreportz () 从设备中检索错误报告。 |
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 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 () 返回自 EPOCH 以来 Tradefed API 触发重启的最后一次时间(以毫秒为单位),由 |
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 erase 或 fastboot 格式擦除设备上的分区。 |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () 检查设备上的平台是否支持应用枚举 |
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 boolean | logBugreport (String dataName, ITestLogger listener) 获取错误报告并将其记录到报告者的辅助方法。 |
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 | remountSystemWritable () 使设备上的系统分区可写。 |
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, ITestLifeCycleReceiver... listeners) 与 |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, 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 erase 或 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 Bugreport | takeBugreport () 获取错误报告并将其返回到 |
abstract boolean | unlockDevice () 如果设备处于加密状态,则解锁设备。 |
abstract boolean | waitForBootComplete (long timeOut) 阻塞直到设备的启动完成标志被设置。 |
abstract boolean | waitForDeviceAvailable () 等待设备响应并可用于测试。 |
abstract boolean | waitForDeviceAvailable (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 级别时的默认值
常数值:-1 (0xffffffff)
公共方法
checkApiLevelAgainstNextRelease
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
在给定最低支持级别的情况下,检查当前是否支持某个功能。在 API 级别提升之前,此方法考虑了尚未发布的功能。
参数 | |
---|---|
strictMinLevel | int :支持该功能的严格最小可能级别。 |
退货 | |
---|---|
boolean | 如果支持该级别,则为真。否则为假。 |
投掷 | |
---|---|
DeviceNotAvailableException |
清除Logcat
public abstract void clearLogcat ()
删除任何累积的 logcat 数据。
这对于您希望确保ITestDevice#getLogcat()
仅返回某个点之后生成的日志数据(例如在刷新新设备构建之后等)的情况很有用。 删除文件
public abstract void deleteFile (String deviceFilePath)
用于删除设备上的文件或目录的辅助方法。
参数 | |
---|---|
deviceFilePath | String : 文件在设备上的绝对路径。 |
投掷 | |
---|---|
DeviceNotAvailableException |
deviceSoftRestarted
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
通过比较当前 system_server 和以前的 system_server ProcessInfo
来检查设备是否软重启的辅助方法。使用getProcessByName(String)
获取ProcessInfo
。
参数 | |
---|---|
prevSystemServerProcess | ProcessInfo :之前的 system_server 进程ProcessInfo 。 |
退货 | |
---|---|
boolean | 如果设备软重启,则为true |
投掷 | |
---|---|
RuntimeException | 如果设备有异常启动原因 |
DeviceNotAvailableException |
deviceSoftRestartedSince
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
辅助方法,用于检查设备是否自 UTC 时间以来从设备及其ERROR(/TimeUnit)
开始软重启。软重启是指 system_server 在设备硬重启之外重启(例如:请求重启)。可以通过getDeviceDate()
方法获取 Milliseseccond 中的当前设备 utcEpochTime。
参数 | |
---|---|
utcEpochTime | long :自纪元以来的设备时间,以秒为单位。 |
timeUnit | TimeUnit :给定 utcEpochTime 的时间单位TimeUnit 。 |
退货 | |
---|---|
boolean | 如果设备软重启,则为true |
投掷 | |
---|---|
RuntimeException | 如果设备有异常启动原因 |
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 | 如果与设备的连接丢失且无法恢复。 |
执行AdbCommand
public abstract String executeAdbCommand (long timeout, String... commandArgs)
辅助方法,它执行 adb 命令作为具有指定超时的系统命令。
应尽可能使用executeShellCommand(String)
,因为该方法提供了更好的故障检测和性能。
参数 | |
---|---|
timeout | long :设备被认为无响应之前的时间(以毫秒为单位),0L 表示没有超时 |
commandArgs | String :要运行的 adb 命令和参数 |
退货 | |
---|---|
String | 命令的标准输出。如果命令执行失败,则返回null 。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行AdbCommand
public abstract String executeAdbCommand (String... commandArgs)
将 adb 命令作为系统命令执行的辅助方法。
应尽可能使用executeShellCommand(String)
,因为该方法提供了更好的故障检测和性能。参数 | |
---|---|
commandArgs | String :要运行的 adb 命令和参数 |
退货 | |
---|---|
String | 命令的标准输出。如果命令执行失败,则返回null 。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Fastboot命令
public abstract CommandResult executeFastbootCommand (String... commandArgs)
将 fastboot 命令作为系统命令执行的辅助方法,默认超时为 2 分钟。
预计在设备已处于快速启动模式时使用。参数 | |
---|---|
commandArgs | String : 要运行的 fastboot 命令和参数 |
退货 | |
---|---|
CommandResult | 包含命令输出的 CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行Fastboot命令
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
将 fastboot 命令作为系统命令执行的辅助方法。
预计在设备已处于快速启动模式时使用。参数 | |
---|---|
timeout | long :命令过期前的时间(以毫秒为单位) |
commandArgs | String : 要运行的 fastboot 命令和参数 |
退货 | |
---|---|
CommandResult | 包含命令输出的 CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行LongFastboot命令
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
辅助方法,它将长时间运行的 fastboot 命令作为具有系统环境变量的系统命令执行。
与executeFastbootCommand(String)
相同,只是使用了更长的超时时间。
参数 | |
---|---|
envVarMap | |
commandArgs | String : 要运行的 fastboot 命令和参数 |
退货 | |
---|---|
CommandResult | 包含命令输出的 CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行LongFastboot命令
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
将长时间运行的快速启动命令作为系统命令执行的辅助方法。
与executeFastbootCommand(String)
相同,只是使用了更长的超时时间。参数 | |
---|---|
commandArgs | String : 要运行的 fastboot 命令和参数 |
退货 | |
---|---|
CommandResult | 包含命令输出的 CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行ShellCommand
public abstract String executeShellCommand (String command)
执行 adb shell 命令并以String
形式返回输出的辅助方法。
参数 | |
---|---|
command | String : 要运行的 adb shell 命令 |
退货 | |
---|---|
String | 外壳输出 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行ShellCommand
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 | 如果与设备的连接丢失且无法恢复。 |
执行ShellCommand
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 | 如果与设备的连接丢失且无法恢复。 |
执行ShellCommand
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)
辅助方法,它执行CommandResult
shell 命令并将结果作为正确填充命令状态输出和标准错误的命令结果返回。 stdout 被定向到指定的流。
参数 | |
---|---|
command | String :应该运行的命令。 |
pipeToOutput | OutputStream : ERROR(/OutputStream) 将重定向 std 输出,或者为 null。 |
退货 | |
---|---|
CommandResult | CommandResult 中的结果。 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
执行ShellV2命令
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
辅助方法,它执行 adb shell 命令并将结果作为正确填充命令状态输出、stdout 和 stderr 的CommandResult
返回。
参数 | |
---|---|
command | String :应该运行的命令。 |
pipeAsInput | File : 一个ERROR(/File) 将作为命令的输入通过管道传输,或者为 null。 |
退货 | |
---|---|
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) 将作为命令的输入通过管道传输,或者为 null。 |
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) 将作为命令的输入通过管道传输,或者为 null。 |
pipeToOutput | OutputStream : ERROR(/OutputStream) 将重定向 std 输出,或者为 null。 |
pipeToError | OutputStream : ERROR(/OutputStream) 将重定向 std 错误的位置,或者为 null。 |
maxTimeoutForCommand | long :命令完成的最大超时时间; timeUnit 中指定的单位 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 的单位 |
retryAttempts | int :如果由于异常而失败,则重试命令的最大次数。如果retryAttempts未成功执行,将抛出 DeviceNotResponsiveException。 |
退货 | |
---|---|
CommandResult |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
fastbootWipePartition
public 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 级别 |
投掷 | |
---|---|
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 | true 属性值为"1" 、 "y" 、 "yes" 、 "on" 或"true" ,则为false ,如果属性值为"0" 、 "n" 、 "no" 、 "off" ,则为 false , "false" ,否则为defaultValue 。 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取启动历史
public abstractgetBootHistory ()
Helper 方法收集带有启动时间和启动原因的启动历史映射。
退货 | |
---|---|
启动时间(自 Epoch 以来以秒为单位的 UTC 时间)和启动原因的映射 |
投掷 | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
Helper 方法收集自给定时间以来从设备和指定的时间单位开始的启动时间和启动原因的启动历史映射。可以通过getDeviceDate()
方法获取当前设备的 utcEpochTime,以毫秒为单位。
参数 | |
---|---|
utcEpochTime | long :自 Epoch 以来的设备时间。 |
timeUnit | TimeUnit :时间单位TimeUnit 。 |
退货 | |
---|---|
启动时间(自 Epoch 以来以秒为单位的 UTC 时间)和启动原因的映射 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取引导加载程序版本
public abstract String getBootloaderVersion ()
获取此设备的引导加载程序版本的便捷方法。
将尝试从设备的当前状态检索引导加载程序版本。 (即如果设备处于快速启动模式,它将尝试从快速启动中检索版本)退货 | |
---|---|
String | String 引导加载程序版本,如果找不到,则返回null |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
获取报告
public abstract InputStreamSource getBugreport ()
从设备中检索错误报告。
保证此实现可以继续在没有 sdcard 的设备上工作(或尚未安装 sdcard 的设备)。退货 | |
---|---|
InputStreamSource | InputStreamSource 将根据需要生成错误报告内容。如果失败, InputStreamSource 将产生一个空的ERROR(/InputStream) 。 |
getBugreportz
public abstract InputStreamSource getBugreportz ()
从设备中检索错误报告。 Zip 格式的 bugreport 包含主要的 bugreport 和其他对调试有用的日志文件。
仅支持“adb 版本”> 1.0.36退货 | |
---|---|
InputStreamSource | 包含 bugreportz 的 zip 文件的InputStreamSource ,如果失败则返回 null。 |
获取构建别名
public abstract String getBuildAlias ()
检索设备当前正在运行的构建的别名。
构建别名通常是比构建 ID 更易读的字符串(通常是 Nexus 构建的数字)。例如,最终的 Android 4.2 版本具有构建别名 JDQ39,构建 ID 为 573038
退货 | |
---|---|
String | 构建别名或回退到构建 ID(如果无法检索) |
投掷 | |
---|---|
DeviceNotAvailableException |
获取BuildFlavor
public abstract String getBuildFlavor ()
检索设备的构建风格。
退货 | |
---|---|
String | 构建风格或 null 如果无法检索 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取BuildId
public abstract String getBuildId ()
检索设备当前正在运行的构建。
退货 | |
---|---|
String | 构建 ID 或IBuildInfo#UNKNOWN_BUILD_ID (如果无法检索) |
投掷 | |
---|---|
DeviceNotAvailableException |
getBuildSigningKeys
public abstract String getBuildSigningKeys ()
返回用于签署设备映像的密钥类型
通常,Android 设备可以使用测试密钥(如在 AOSP 中)或发布密钥(由各个设备制造商控制)进行签名
退货 | |
---|---|
String | 如果找到签名密钥,则返回 null。 |
投掷 | |
---|---|
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
如果设备已分配,则返回缓存的DeviceDescriptor
,否则返回当前的DeviceDescriptor
。
退货 | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
如果设备已分配,则返回缓存的DeviceDescriptor
,否则返回当前的DeviceDescriptor
。
参数 | |
---|---|
shortDescriptor | boolean : 是否将描述符限制为最小信息 |
退货 | |
---|---|
DeviceDescriptor |
得到孩子
public abstract String[] getChildren (String deviceFilePath)
替代使用有时由于权限而无法工作的IFileEntry
。
参数 | |
---|---|
deviceFilePath | String : 是设备上进行搜索的路径 |
退货 | |
---|---|
String[] | 包含设备路径中所有文件的字符串数组。 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取设备日期
public abstract long getDeviceDate ()
返回自纪元以来设备的日期(以毫秒为单位)。
退货 | |
---|---|
long | 纪元格式的设备日期。 |
投掷 | |
---|---|
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 | 模拟器输出 |
获取ExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
确定设备外部存储可用空间量的辅助方法。
退货 | |
---|---|
long | 以 KB 为单位的可用空间量 |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
获取快速启动产品类型
public abstract String getFastbootProductType ()
在快速启动模式下获取此设备产品类型的便捷方法。
仅当设备应处于快速启动状态时才应使用此方法。在这种情况下,它比通用getProductType()
方法更安全一些,因为如果设备处于错误状态或无响应,ITestDevice 会知道将设备恢复到快速启动。退货 | |
---|---|
String | String 产品类型名称,如果无法确定,则null |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
获取FastbootProductVariant
public abstract String getFastbootProductVariant ()
在快速启动模式下获取此设备产品类型的便捷方法。
仅当设备应处于快速启动状态时才应使用此方法。在这种情况下,它比通用getProductType()
方法更安全一些,因为如果设备处于错误状态或无响应,ITestDevice 会知道将设备恢复到快速启动。退货 | |
---|---|
String | String 产品类型名称,如果无法确定,则null |
投掷 | |
---|---|
DeviceNotAvailableException | 如果与设备的连接丢失且无法恢复。 |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
返回快速启动模式序列号。
退货 | |
---|---|
String |
获取快速启动变量
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 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取设备
public abstract IDevice getIDevice ()
返回对关联的 ddmlib IDevice
的引用。
IDevice
。因此,调用者不应保留对IDevice
的引用,因为该引用可能会变得陈旧。退货 | |
---|---|
IDevice | IDevice |
获取IntProperty
public abstract long getIntProperty (String name, long defaultValue)
从设备返回给定属性的整数值。
参数 | |
---|---|
name | String : 属性名 |
defaultValue | long :如果属性为空或不存在,则返回默认值。 |
退货 | |
---|---|
long | 如果属性为空、不存在或没有整数值,则为属性值或defaultValue 。 |
投掷 | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
返回自 EPOCH 以来 Tradefed API 触发重启的最后一次时间(以毫秒为单位),由System.currentTimeMillis()
返回。
退货 | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
获取设备的第一个启动的 API 级别。默认为UNKNOWN_API_LEVEL
。
退货 | |
---|---|
int | 一个整数,指示设备的第一个启动的 API 级别 |
投掷 | |
---|---|
DeviceNotAvailableException |
获取日志猫
public abstract InputStreamSource getLogcat ()
抓取 logcat 数据的快照流。
以两种模式工作:
TestDeviceOptions.getMaxLogcatDataSize()
字节的后台logcat捕获的当前内容退货 | |
---|---|
InputStreamSource |
获取日志猫
public abstract InputStreamSource getLogcat (int maxBytes)
获取捕获的 logcat 数据的最后一个maxBytes
的快照流。
当您想要捕获捕获的 logcat 数据的频繁快照而不会因获取整个getLogcat()
快照而导致潜在的大磁盘空间损失时,这很有用。
参数 | |
---|---|
maxBytes | int :要返回的最大数据量。应该是可以舒适地放入内存的数量 |
退货 | |
---|---|
InputStreamSource |
获取LogcatDump
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 |
投掷 | |
---|---|
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 |
投掷 | |
---|---|
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 |
投掷 | |
---|---|
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
退货 | |
---|---|
boolean | true if the device supports encryption. |
投掷 | |
---|---|
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 |
投掷 | |
---|---|
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. |
投掷 | |
---|---|
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 |
logBugreport
public abstract boolean logBugreport (String dataName, ITestLogger listener)
Helper method to take a bugreport and log it to the reporters.
参数 | |
---|---|
dataName | String : name under which the bugreport will be reported. |
listener | ITestLogger : an ITestLogger to log the bugreport. |
退货 | |
---|---|
boolean | True if the logging was successful, false otherwise. |
logOnDevice
public 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.
投掷 | |
---|---|
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 |
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 |
remountSystemWritable
public abstract void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
投掷 | |
---|---|
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
投掷 | |
---|---|
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, ITestLifeCycleReceiver... listeners)
Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)
but runs the test for a given user.
参数 | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
退货 | |
---|---|
boolean |
投掷 | |
---|---|
DeviceNotAvailableException |
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 |
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 |
投掷 | |
---|---|
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. |
投掷 | |
---|---|
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 |
投掷 | |
---|---|
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
退货 | |
---|---|
boolean | true if switch was successful, false otherwise. |
投掷 | |
---|---|
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. |
takeBugreport
public abstract Bugreport takeBugreport ()
Take a bugreport and returns it inside a Bugreport
object to handle it. Return null in case of issue.
Bugreport#close()
.退货 | |
---|---|
Bugreport |
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 |
投掷 | |
---|---|
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. |
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. |