命令工具

public final class CommandUtil
extends Object

java.lang.Object
com.android.sts.common.CommandUtil


帮助通过 adb 在设备上运行命令的实用程序集合

概括

公共方法

static CommandResult runAndCheck (ITestDevice device, String cmd, int retries)

在设备上执行 shell 命令,如果命令不返回 0,则抛出 AsclusionError。

static CommandResult runAndCheck (ITestDevice device, String cmd)

在设备上执行 shell 命令,如果命令不返回 0,则抛出 AsclusionError。

公共方法

运行并检查

public static CommandResult runAndCheck (ITestDevice device, 
                String cmd, 
                int retries)

在设备上执行 shell 命令,如果命令不返回 0,则抛出 AsclusionError。

参数
device ITestDevice :要使用的设备

cmd String : 要运行的命令

retries int : 尝试重试的次数

退货
CommandResult device.executeShellV2Command 的结果

投掷
DeviceNotAvailableException

运行并检查

public static CommandResult runAndCheck (ITestDevice device, 
                String cmd)

在设备上执行 shell 命令,如果命令不返回 0,则抛出 AsclusionError。

参数
device ITestDevice :要使用的设备

cmd String : 要运行的命令

退货
CommandResult device.executeShellV2Command 的结果

投掷
DeviceNotAvailableException