UserHelper

public final class UserHelper
extends Object

java.lang.Object
com.android.tradefed.targetprep.UserHelper


摘要

常量

String RUN_TESTS_AS_USER_KEY

用于指明哪个 Android 用户正在运行测试的系统属性。

公共方法

static int createUser(ITestDevice device, boolean reuseTestUser)

创建新的辅助用户,或在适用情况下重复使用现有用户。

static int createUser(ITestDevice device, boolean reuseTestUser, String userName)

创建新的辅助用户,或在适用情况下重复使用现有用户。

static int getRunTestsAsUser(TestInformation testInfo)

RUN_TESTS_AS_USER_KEY 属性获取要以哪个用户身份运行测试的用户 ID。

常量

RUN_TESTS_AS_USER_KEY

public static final String RUN_TESTS_AS_USER_KEY

用于指明哪个 Android 用户正在运行测试的系统属性。

常量值: "RUN_TESTS_AS_USER"

公共方法

createUser

public static int createUser (ITestDevice device, 
                boolean reuseTestUser)

创建新的辅助用户,或在适用情况下重复使用现有用户。

参数
device ITestDevice

reuseTestUser boolean

返回
int

抛出
DeviceNotAvailableException
TargetSetupError

createUser

public static int createUser (ITestDevice device, 
                boolean reuseTestUser, 
                String userName)

创建新的辅助用户,或在适用情况下重复使用现有用户。

参数
device ITestDevice

reuseTestUser boolean

userName String

返回
int

抛出
DeviceNotAvailableException
TargetSetupError

getRunTestsAsUser

public static int getRunTestsAsUser (TestInformation testInfo)

RUN_TESTS_AS_USER_KEY 属性获取要以哪个用户身份运行测试的用户 ID。

如果该属性未设置或无效,则返回当前用户。

参数
testInfo TestInformation

返回
int

抛出
DeviceNotAvailableException