DeviceFlashPreparer
public
abstract
class
DeviceFlashPreparer
extends BaseTargetPreparer
implements
IConfigurationReceiver,
ITestLoggerReceiver
| java.lang.Object | ||
| ↳ | com.android.tradefed.targetprep.BaseTargetPreparer | |
| ↳ | com.android.tradefed.targetprep.DeviceFlashPreparer | |
用于在实体 Android 硬件上刷写映像的 ITargetPreparer。
摘要
公共构造函数 | |
|---|---|
DeviceFlashPreparer()
|
|
公共方法 | |
|---|---|
void
|
addAllowedBranchForTransitionInIncremental(String branch)
|
void
|
addBranchTransitionInIncremental(String origin, String destination)
|
IBuildInfo
|
getBuild(TestInformation testInfo)
封装 getBuildInfo,以便在特定场景中更改它。 |
ITestLogger
|
getTestLogger()
|
boolean
|
isIncrementalFlashingEnabled()
|
boolean
|
isIncrementalFlashingForceDisabled()
|
void
|
setAllowCrossReleaseFlashing(boolean allowCrossReleaseFlashing)
|
void
|
setAllowUnzipBaseline(boolean allowUnzipBaseline)
|
void
|
setApplySnapshot(boolean applySnapshot)
|
void
|
setConfiguration(IConfiguration configuration)
注入正在使用的 |
void
|
setIgnoreHostOptions(boolean ignoreHostOptions)
|
void
|
setTestLogger(ITestLogger testLogger)
注入 |
void
|
setUp(TestInformation testInfo)
|
void
|
setUpdateBootloaderFromUserspace(boolean updateBootloaderFromUserspace)
|
void
|
setUseIncrementalNewFlow(boolean useIncrementalNewFlow)
|
void
|
setUserDataFlashOption(IDeviceFlasher.UserDataFlashOption flashOption)
设置 userdata-flash 选项 |
void
|
setWipeAfterApplySnapshot(boolean wipeAfterApplySnapshot)
|
void
|
tearDown(TestInformation testInfo, Throwable e)
|
void
|
useMerkleTreeComparison(boolean enableMerkleTreeComparison)
|
受保护的方法 | |
|---|---|
void
|
checkDeviceProductType(ITestDevice device, IDeviceBuildInfo deviceBuild)
在刷写之前进行可能的检查,以确保设备与 build 信息相比符合预期。 |
abstract
IDeviceFlasher
|
createFlasher(ITestDevice device)
创建要使用的 |
long
|
getDeviceBootWaitTime()
获取设备启动等待时间 |
IHostOptions
|
getHostOptions()
获取要使用的 |
void
|
reportFlashMetrics(String branch, String buildFlavor, String buildId, String serial, long queueTime, long flashingTime, CommandStatus flashingStatus)
将设备刷写时间数据报告给指标后端 |
void
|
setSkipPostFlashBuildIdCheck(boolean skipPostFlashBuildIdCheck)
|
void
|
setUseIncrementalFlashing(boolean incrementalFlashing)
|
公共构造函数
DeviceFlashPreparer
public DeviceFlashPreparer ()
公共方法
addAllowedBranchForTransitionInIncremental
public void addAllowedBranchForTransitionInIncremental (String branch)
| 参数 | |
|---|---|
branch |
String |
addBranchTransitionInIncremental
public void addBranchTransitionInIncremental (String origin,
String destination)| 参数 | |
|---|---|
origin |
String |
destination |
String |
getBuild
public IBuildInfo getBuild (TestInformation testInfo)
封装 getBuildInfo,以便在特定场景中覆盖它。
| 参数 | |
|---|---|
testInfo |
TestInformation |
| 返回 | |
|---|---|
IBuildInfo |
|
isIncrementalFlashingEnabled
public boolean isIncrementalFlashingEnabled ()
| 返回 | |
|---|---|
boolean |
|
isIncrementalFlashingForceDisabled
public boolean isIncrementalFlashingForceDisabled ()
| 返回 | |
|---|---|
boolean |
|
setAllowCrossReleaseFlashing
public void setAllowCrossReleaseFlashing (boolean allowCrossReleaseFlashing)
| 参数 | |
|---|---|
allowCrossReleaseFlashing |
boolean |
setAllowUnzipBaseline
public void setAllowUnzipBaseline (boolean allowUnzipBaseline)
| 参数 | |
|---|---|
allowUnzipBaseline |
boolean |
setApplySnapshot
public void setApplySnapshot (boolean applySnapshot)
| 参数 | |
|---|---|
applySnapshot |
boolean |
setConfiguration
public void setConfiguration (IConfiguration configuration)
注入正在使用的 IConfiguration。
| 参数 | |
|---|---|
configuration |
IConfiguration |
setIgnoreHostOptions
public void setIgnoreHostOptions (boolean ignoreHostOptions)
| 参数 | |
|---|---|
ignoreHostOptions |
boolean |
setTestLogger
public void setTestLogger (ITestLogger testLogger)
注入 ITestLogger 实例
| 参数 | |
|---|---|
testLogger |
ITestLogger |
setUp
public void setUp (TestInformation testInfo)
| 参数 | |
|---|---|
testInfo |
TestInformation |
| 抛出 | |
|---|---|
BuildError |
|
DeviceNotAvailableException |
|
TargetSetupError |
|
setUpdateBootloaderFromUserspace
public void setUpdateBootloaderFromUserspace (boolean updateBootloaderFromUserspace)
| 参数 | |
|---|---|
updateBootloaderFromUserspace |
boolean |
setUseIncrementalNewFlow
public void setUseIncrementalNewFlow (boolean useIncrementalNewFlow)
| 参数 | |
|---|---|
useIncrementalNewFlow |
boolean |
setUserDataFlashOption
public void setUserDataFlashOption (IDeviceFlasher.UserDataFlashOption flashOption)
设置 userdata-flash 选项
setWipeAfterApplySnapshot
public void setWipeAfterApplySnapshot (boolean wipeAfterApplySnapshot)
| 参数 | |
|---|---|
wipeAfterApplySnapshot |
boolean |
tearDown
public void tearDown (TestInformation testInfo, Throwable e)
| 参数 | |
|---|---|
testInfo |
TestInformation |
e |
Throwable |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
useMerkleTreeComparison
public void useMerkleTreeComparison (boolean enableMerkleTreeComparison)
| 参数 | |
|---|---|
enableMerkleTreeComparison |
boolean |
受保护的方法
checkDeviceProductType
protected void checkDeviceProductType (ITestDevice device, IDeviceBuildInfo deviceBuild)
在刷写之前进行可能的检查,以确保设备与 build 信息一致。
| 参数 | |
|---|---|
device |
ITestDevice:要闪烁的 ITestDevice。 |
deviceBuild |
IDeviceBuildInfo:用于闪烁的 IDeviceBuildInfo。 |
| 抛出 | |
|---|---|
|
com.android.tradefed.targetprep.BuildError |
|
com.android.tradefed.device.DeviceNotAvailableException |
BuildError |
|
DeviceNotAvailableException |
|
createFlasher
protected abstract IDeviceFlasher createFlasher (ITestDevice device)
创建要使用的 IDeviceFlasher。子类可以替换
| 参数 | |
|---|---|
device |
ITestDevice |
| 返回 | |
|---|---|
IDeviceFlasher |
|
| 抛出 | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
|
getDeviceBootWaitTime
protected long getDeviceBootWaitTime ()
获取设备启动等待时间
| 返回 | |
|---|---|
long |
|
getHostOptions
protected IHostOptions getHostOptions ()
获取要使用的 IHostOptions 实例。
公开以进行单元测试
| 返回 | |
|---|---|
IHostOptions |
|
reportFlashMetrics
protected void reportFlashMetrics (String branch,
String buildFlavor,
String buildId,
String serial,
long queueTime,
long flashingTime,
CommandStatus flashingStatus)将设备刷写时间数据报告给指标后端
| 参数 | |
|---|---|
branch |
String:设备 build 的来源分支 |
buildFlavor |
String:设备 build 的 build 变种 |
buildId |
String:设备 build 的 build 号 |
serial |
String:设备的序列号 |
queueTime |
long:等待闪烁限制可用的时间 |
flashingTime |
long:刷写设备映像 zip 文件所花费的时间 |
flashingStatus |
CommandStatus:刷写命令的执行状态 |
setSkipPostFlashBuildIdCheck
protected void setSkipPostFlashBuildIdCheck (boolean skipPostFlashBuildIdCheck)
| 参数 | |
|---|---|
skipPostFlashBuildIdCheck |
boolean |
setUseIncrementalFlashing
protected void setUseIncrementalFlashing (boolean incrementalFlashing)
| 参数 | |
|---|---|
incrementalFlashing |
boolean |