DeviceFlashPreparer
public
abstract
class
DeviceFlashPreparer
extends BaseTargetPreparer
implements
IConfigurationReceiver
java.lang.Object | ||
↳ | com.android.tradefed.targetprep.BaseTargetPreparer | |
↳ | com.android.tradefed.targetprep.DeviceFlashPreparer |
A ITargetPreparer
that flashes an image on physical Android hardware.
Summary
Public constructors | |
---|---|
DeviceFlashPreparer()
|
Public methods | |
---|---|
void
|
addAllowedBranchForTransitionInIncremental(String branch)
|
void
|
addBranchTransitionInIncremental(String origin, String destination)
|
IBuildInfo
|
getBuild(TestInformation testInfo)
Wrap the getBuildInfo so we have a change to override it for specific scenarios. |
boolean
|
isIncrementalFlashingEnabled()
|
boolean
|
isIncrementalFlashingForceDisabled()
|
void
|
setAllowCrossReleaseFlashing(boolean allowCrossReleaseFlashing)
|
void
|
setAllowUnzipBaseline(boolean allowUnzipBaseline)
|
void
|
setApplySnapshot(boolean applySnapshot)
|
void
|
setConfiguration(IConfiguration configuration)
Injects the |
void
|
setIgnoreHostOptions(boolean ignoreHostOptions)
|
void
|
setUp(TestInformation testInfo)
|
void
|
setUpdateBootloaderFromUserspace(boolean updateBootloaderFromUserspace)
|
void
|
setUseIncrementalNewFlow(boolean useIncrementalNewFlow)
|
void
|
setUserDataFlashOption(IDeviceFlasher.UserDataFlashOption flashOption)
Set the userdata-flash option |
void
|
setWipeAfterApplySnapshot(boolean wipeAfterApplySnapshot)
|
void
|
tearDown(TestInformation testInfo, Throwable e)
|
Protected methods | |
---|---|
void
|
checkDeviceProductType(ITestDevice device, IDeviceBuildInfo deviceBuild)
Possible check before flashing to ensure the device is as expected compare to the build info. |
abstract
IDeviceFlasher
|
createFlasher(ITestDevice device)
Create |
long
|
getDeviceBootWaitTime()
Gets the device boot wait time |
IHostOptions
|
getHostOptions()
Gets the |
void
|
reportFlashMetrics(String branch, String buildFlavor, String buildId, String serial, long queueTime, long flashingTime, CommandStatus flashingStatus)
Reports device flashing timing data to metrics backend |
void
|
setSkipPostFlashBuildIdCheck(boolean skipPostFlashBuildIdCheck)
|
void
|
setUseIncrementalFlashing(boolean incrementalFlashing)
|
Public constructors
DeviceFlashPreparer
public DeviceFlashPreparer ()
Public methods
addAllowedBranchForTransitionInIncremental
public void addAllowedBranchForTransitionInIncremental (String branch)
Parameters | |
---|---|
branch |
String |
addBranchTransitionInIncremental
public void addBranchTransitionInIncremental (String origin, String destination)
Parameters | |
---|---|
origin |
String |
destination |
String |
getBuild
public IBuildInfo getBuild (TestInformation testInfo)
Wrap the getBuildInfo so we have a change to override it for specific scenarios.
Parameters | |
---|---|
testInfo |
TestInformation |
Returns | |
---|---|
IBuildInfo |
isIncrementalFlashingEnabled
public boolean isIncrementalFlashingEnabled ()
Returns | |
---|---|
boolean |
isIncrementalFlashingForceDisabled
public boolean isIncrementalFlashingForceDisabled ()
Returns | |
---|---|
boolean |
setAllowCrossReleaseFlashing
public void setAllowCrossReleaseFlashing (boolean allowCrossReleaseFlashing)
Parameters | |
---|---|
allowCrossReleaseFlashing |
boolean |
setAllowUnzipBaseline
public void setAllowUnzipBaseline (boolean allowUnzipBaseline)
Parameters | |
---|---|
allowUnzipBaseline |
boolean |
setApplySnapshot
public void setApplySnapshot (boolean applySnapshot)
Parameters | |
---|---|
applySnapshot |
boolean |
setConfiguration
public void setConfiguration (IConfiguration configuration)
Injects the IConfiguration
in use.
Parameters | |
---|---|
configuration |
IConfiguration |
setIgnoreHostOptions
public void setIgnoreHostOptions (boolean ignoreHostOptions)
Parameters | |
---|---|
ignoreHostOptions |
boolean |
setUp
public void setUp (TestInformation testInfo)
Parameters | |
---|---|
testInfo |
TestInformation |
Throws | |
---|---|
BuildError |
|
DeviceNotAvailableException |
|
TargetSetupError |
setUpdateBootloaderFromUserspace
public void setUpdateBootloaderFromUserspace (boolean updateBootloaderFromUserspace)
Parameters | |
---|---|
updateBootloaderFromUserspace |
boolean |
setUseIncrementalNewFlow
public void setUseIncrementalNewFlow (boolean useIncrementalNewFlow)
Parameters | |
---|---|
useIncrementalNewFlow |
boolean |
setUserDataFlashOption
public void setUserDataFlashOption (IDeviceFlasher.UserDataFlashOption flashOption)
Set the userdata-flash option
setWipeAfterApplySnapshot
public void setWipeAfterApplySnapshot (boolean wipeAfterApplySnapshot)
Parameters | |
---|---|
wipeAfterApplySnapshot |
boolean |
tearDown
public void tearDown (TestInformation testInfo, Throwable e)
Parameters | |
---|---|
testInfo |
TestInformation |
e |
Throwable |
Throws | |
---|---|
DeviceNotAvailableException |
Protected methods
checkDeviceProductType
protected void checkDeviceProductType (ITestDevice device, IDeviceBuildInfo deviceBuild)
Possible check before flashing to ensure the device is as expected compare to the build info.
Parameters | |
---|---|
device |
ITestDevice : the ITestDevice to flash. |
deviceBuild |
IDeviceBuildInfo : the IDeviceBuildInfo used to flash. |
Throws | |
---|---|
|
com.android.tradefed.targetprep.BuildError |
|
com.android.tradefed.device.DeviceNotAvailableException |
BuildError |
|
DeviceNotAvailableException |
createFlasher
protected abstract IDeviceFlasher createFlasher (ITestDevice device)
Create IDeviceFlasher
to use. Subclasses can override
Parameters | |
---|---|
device |
ITestDevice |
Returns | |
---|---|
IDeviceFlasher |
Throws | |
---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getDeviceBootWaitTime
protected long getDeviceBootWaitTime ()
Gets the device boot wait time
Returns | |
---|---|
long |
getHostOptions
protected IHostOptions getHostOptions ()
Gets the IHostOptions
instance to use.
Returns | |
---|---|
IHostOptions |
reportFlashMetrics
protected void reportFlashMetrics (String branch, String buildFlavor, String buildId, String serial, long queueTime, long flashingTime, CommandStatus flashingStatus)
Reports device flashing timing data to metrics backend
Parameters | |
---|---|
branch |
String : the branch where the device build originated from |
buildFlavor |
String : the build flavor of the device build |
buildId |
String : the build number of the device build |
serial |
String : the serial number of device |
queueTime |
long : the time spent waiting for a flashing limit to become available |
flashingTime |
long : the time spent in flashing device image zip |
flashingStatus |
CommandStatus : the execution status of flashing command |
setSkipPostFlashBuildIdCheck
protected void setSkipPostFlashBuildIdCheck (boolean skipPostFlashBuildIdCheck)
Parameters | |
---|---|
skipPostFlashBuildIdCheck |
boolean |
setUseIncrementalFlashing
protected void setUseIncrementalFlashing (boolean incrementalFlashing)
Parameters | |
---|---|
incrementalFlashing |
boolean |