RunOnSecondaryUserTargetPreparer

public class RunOnSecondaryUserTargetPreparer
extends BaseTargetPreparer implements IConfigurationReceiver

java.lang.Object
   ↳ com.android.tradefed.targetprep.BaseTargetPreparer
     ↳ com.android.tradefed.targetprep.RunOnSecondaryUserTargetPreparer


一个 ITargetPreparer,用于在设置中创建次要用户,并标记应在该用户中运行测试。

在拆解时,系统会移除次要用户。

如果辅助用户已存在,系统将使用该用户,而不是创建新用户,并且该用户在拆解时不会被移除。

如果设备在需要时无法创建新用户,则会设置插桩参数 skip-tests-reason,并且不会更改用户。在设备上运行的测试可以读取此参数,以响应此状态。

摘要

公共构造函数

RunOnSecondaryUserTargetPreparer()

公共方法

void setConfiguration(IConfiguration configuration)

注入正在使用的 IConfiguration

void setUp(TestInformation testInfo)
void tearDown(TestInformation testInfo, Throwable e)

受保护的方法

boolean canCreateAdditionalUsers(ITestDevice device, int numberOfUsers)

检查是否可以创建所需数量的用户。

公共构造函数

RunOnSecondaryUserTargetPreparer

public RunOnSecondaryUserTargetPreparer ()

公共方法

setConfiguration

public void setConfiguration (IConfiguration configuration)

注入正在使用的 IConfiguration

参数
configuration IConfiguration

setUp

public void setUp (TestInformation testInfo)

参数
testInfo TestInformation

抛出
DeviceNotAvailableException
TargetSetupError

tearDown

public void tearDown (TestInformation testInfo, 
                Throwable e)

参数
testInfo TestInformation

e Throwable

抛出
DeviceNotAvailableException

受保护的方法

canCreateAdditionalUsers

protected boolean canCreateAdditionalUsers (ITestDevice device, 
                int numberOfUsers)

检查是否可以创建所需数量的用户。

参数
device ITestDevice

numberOfUsers int

返回
boolean

抛出
DeviceNotAvailableException