to top
public class

PushFilePreparer

extends Object
implements ITargetCleaner @OptionClass(alias = "push-file")
java.lang.Object
   ↳ com.android.tradefed.targetprep.PushFilePreparer

Class Overview

A ITargetPreparer that attempts to push any number of files from any host path to any device path.

Should be performed *after* a new build is flashed, and *after* DeviceSetup is run (if enabled)

Summary

Fields
private boolean mAbortOnFailure @Option(name = "abort-on-push-failure", description = "If false, continue if pushes fail. If true, abort the Invocation on any failure.")
private boolean mCleanup @Option(name = "cleanup", description = "Whether files pushed onto device should be cleaned up after test. Note that the preparer does not verify that files/directories have been deleted.")
private Collection<String> mPostPushCommands @Option(name = "post-push", description = "A command to run on the device (with `adb shell (yourcommand)`) after all pushes have been attempted. Will not be run if a push fails with abort-on-push-failure enabled. May be repeated.")
private Collection<String> mPushSpecs @Option(name = "push", description = "A push-spec, formatted as \'/path/to/srcfile.txt->/path/to/destfile.txt\' or \'/path/to/srcfile.txt->/path/to/destdir/\'. May be repeated.")
private boolean mRemount @Option(name = "remount-system", description = "Remounts system partition to be writable so that files could be pushed there too")
private boolean mTriggerMediaScan @Option(name = "trigger-media-scan", description = "After pushing files, trigger a media scan of external storage on device.")
Public Constructors
PushFilePreparer()
Public Methods
File resolveRelativeFilePath(IBuildInfo buildInfo, String fileName)
Resolve relative file path via IBuildInfo
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.targetprep.ITargetCleaner
From interface com.android.tradefed.targetprep.ITargetPreparer

Fields

private boolean mAbortOnFailure

private boolean mCleanup

private Collection<String> mPostPushCommands

private Collection<String> mPushSpecs

private boolean mRemount

private boolean mTriggerMediaScan

Public Constructors

public PushFilePreparer ()

Public Methods

public File resolveRelativeFilePath (IBuildInfo buildInfo, String fileName)

Resolve relative file path via IBuildInfo

Parameters
buildInfo the build artifact information
fileName relative file path to be resolved

public void setUp (ITestDevice device, IBuildInfo buildInfo)

Perform the target setup for testing.

Parameters
device the ITestDevice to prepare.
buildInfo data about the build under test.

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

Perform the target cleanup/teardown after testing.

Parameters
device the ITestDevice to prepare.
buildInfo data about the build under test.
e if the invocation ended with an exception, this will be the exception that was caught at the Invocation level. Otherwise, will be null.