RunOnSecondaryUserTargetPreparer

public class RunOnSecondaryUserTargetPreparer
extends BaseTargetPreparer

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


一个 ITargetPreparer,用于确保测试以次要用户身份运行。此外,如果选项 ERROR(/#START_BACKGROUND_USER)true 且当前用户已是次要用户,则该方法将确保在次要显示屏上运行可见的后台次要用户。

如果目标辅助用户不存在,则会创建一个新用户,并在拆解时将其移除。否则,系统将使用该对象,而不是创建新对象,并且不会在拆解中移除该对象。

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

摘要

字段

protected boolean mStartBackgroundUser

protected List<String> mTestPackages

protected int originalUserId

protected int secondaryUserId

公共构造函数

RunOnSecondaryUserTargetPreparer()

公共方法

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

受保护的方法

boolean canCreateAdditionalSecondaryUsers(ITestDevice device, int numberOfUsers)

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

字段

mStartBackgroundUser

protected boolean mStartBackgroundUser

mTestPackages

protected List<String> mTestPackages

originalUserId

protected int originalUserId

secondaryUserId

protected int secondaryUserId

公共构造函数

RunOnSecondaryUserTargetPreparer

public RunOnSecondaryUserTargetPreparer ()

公共方法

setUp

public void setUp (TestInformation testInfo)

参数
testInfo TestInformation

抛出
DeviceNotAvailableException
TargetSetupError

tearDown

public void tearDown (TestInformation testInfo, 
                Throwable e)

参数
testInfo TestInformation

e Throwable

抛出
DeviceNotAvailableException

受保护的方法

canCreateAdditionalSecondaryUsers

protected boolean canCreateAdditionalSecondaryUsers (ITestDevice device, 
                int numberOfUsers)

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

参数
device ITestDevice

numberOfUsers int

返回
boolean

抛出
DeviceNotAvailableException