CommandUtil

public final class CommandUtil
extends Object

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


一系列公用程式,可協助您透過 ADB 在裝置上執行指令

摘要

公用方法

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

在裝置上執行殼層指令,如果指令未傳回 0,則會擲回 AssumptionError。

static CommandResult runAndCheck(ITestDevice device, String cmd)

在裝置上執行殼層指令,如果指令未傳回 0,則會擲回 AssumptionError。

公用方法

runAndCheck

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

在裝置上執行殼層指令,如果指令未傳回 0,則會擲回 AssumptionError。

參數
device ITestDevice:要使用的裝置

cmd String:要執行的指令

retries int:重試次數

傳回
CommandResult device.executeShellV2Command 的結果

擲回
DeviceNotAvailableException

runAndCheck

public static CommandResult runAndCheck (ITestDevice device, 
                String cmd)

在裝置上執行殼層指令,如果指令未傳回 0,則會擲回 AssumptionError。

參數
device ITestDevice:要使用的裝置

cmd String:要執行的指令

傳回
CommandResult device.executeShellV2Command 的結果

擲回
DeviceNotAvailableException