RunOnSecondaryUserTargetPreparer

public class RunOnSecondaryUserTargetPreparer
extends BaseTargetPreparer implements IConfigurationReceiver

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


An ITargetPreparer that creates a secondary user in setup, and marks that tests should be run in that user.

In teardown, the secondary user is removed.

If a secondary user already exists, it will be used rather than creating a new one, and it will not be removed in teardown.

If the device does not have capacity to create a new user when one is required, then the instrumentation argument skip-tests-reason will be set, and the user will not be changed. Tests running on the device can read this argument to respond to this state.

Summary

Public constructors

RunOnSecondaryUserTargetPreparer()

Public methods

void setConfiguration(IConfiguration configuration)

Injects the IConfiguration in use.

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

Protected methods

boolean canCreateAdditionalUsers(ITestDevice device, int numberOfUsers)

Checks whether it is possible to create the desired number of users.

Public constructors

RunOnSecondaryUserTargetPreparer

public RunOnSecondaryUserTargetPreparer ()

Public methods

setConfiguration

public void setConfiguration (IConfiguration configuration)

Injects the IConfiguration in use.

Parameters
configuration IConfiguration

setUp

public void setUp (TestInformation testInfo)

Parameters
testInfo TestInformation

Throws
DeviceNotAvailableException
TargetSetupError

tearDown

public void tearDown (TestInformation testInfo, 
                Throwable e)

Parameters
testInfo TestInformation

e Throwable

Throws
DeviceNotAvailableException

Protected methods

canCreateAdditionalUsers

protected boolean canCreateAdditionalUsers (ITestDevice device, 
                int numberOfUsers)

Checks whether it is possible to create the desired number of users.

Parameters
device ITestDevice

numberOfUsers int

Returns
boolean

Throws
DeviceNotAvailableException