TimeSetterTargetPreparer

public class TimeSetterTargetPreparer
extends BaseTargetPreparer implements ITargetCleaner

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


Target preparer to restore the correct time to the device on cleanup. This allows tests to modify the time however they like since the original time will be restored, making sure the state of the device isn't changed at the end.

Can also optionally set the time on setup. The time restored on cleanup will be the time set before this target preparer ran.

Summary

Public constructors

TimeSetterTargetPreparer()

Public methods

void setUp(ITestDevice device, IBuildInfo buildInfo)

Perform the target setup for testing.

void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e)

Perform the target cleanup/teardown after testing.

Public constructors

TimeSetterTargetPreparer

public TimeSetterTargetPreparer ()

Public methods

setUp

public void setUp (ITestDevice device, 
                IBuildInfo buildInfo)

Perform the target setup for testing.

Parameters
device ITestDevice: the ITestDevice to prepare.

buildInfo IBuildInfo: data about the build under test.

Throws
TargetSetupError
BuildError
DeviceNotAvailableException

tearDown

public void tearDown (ITestDevice device, 
                IBuildInfo buildInfo, 
                Throwable e)

Perform the target cleanup/teardown after testing.

Parameters
device ITestDevice: the ITestDevice to prepare.

buildInfo IBuildInfo: data about the build under test.

e Throwable: if the invocation ended with an exception, this will be the exception that was caught at the Invocation level. Otherwise, will be null.

Throws
DeviceNotAvailableException