DeviceFlashPreparer

public abstract class DeviceFlashPreparer
extends BaseTargetPreparer

java.lang.Object
com.android.tradefed.targetprep.BaseTargetPreparer
com.android.tradefed.targetprep.DeviceFlashPreparer


在物理 Android 硬件上闪烁图像的ITargetPreparer

概括

公共构造函数

DeviceFlashPreparer ()

公共方法

void setUp ( TestInformation testInfo)

void setUserDataFlashOption ( IDeviceFlasher.UserDataFlashOption flashOption)

设置 userdata-flash 选项

void tearDown ( TestInformation testInfo, Throwable e)

受保护的方法

void checkDeviceProductType ( ITestDevice device, IDeviceBuildInfo deviceBuild)

刷机前可能会进行检查,以确保设备与构建信息相比符合预期。

abstract IDeviceFlasher createFlasher ( ITestDevice device)

创建IDeviceFlasher以供使用。

long getDeviceBootWaitTime ()

获取设备开机等待时间

IHostOptions getHostOptions ()

获取要使用的IHostOptions实例。

void reportFlashMetrics (String branch, String buildFlavor, String buildId, String serial, long queueTime, long flashingTime, CommandStatus flashingStatus)

向指标后端报告设备闪烁计时数据

void setSkipPostFlashBuildIdCheck (boolean skipPostFlashBuildIdCheck)
void setSkipPostFlashFlavorCheck (boolean skipPostFlashFlavorCheck)

公共构造函数

DeviceFlashPreparer

public DeviceFlashPreparer ()

公共方法

设置

public void setUp (TestInformation testInfo)

参数
testInfo TestInformation

投掷
BuildError
DeviceNotAvailableException
TargetSetupError

设置用户数据闪存选项

public void setUserDataFlashOption (IDeviceFlasher.UserDataFlashOption flashOption)

设置 userdata-flash 选项

拆除

public void tearDown (TestInformation testInfo, 
                Throwable e)

参数
testInfo TestInformation

e Throwable

投掷
DeviceNotAvailableException

受保护的方法

检查设备产品类型

protected void checkDeviceProductType (ITestDevice device, 
                IDeviceBuildInfo deviceBuild)

刷机前可能会进行检查,以确保设备与构建信息相比符合预期。

参数
device ITestDevice :要闪存的ITestDevice

deviceBuild IDeviceBuildInfo :用于烧录的IDeviceBuildInfo

投掷
com.android.tradefed.targetprep.BuildError
com.android.tradefed.device.DeviceNotAvailableException
BuildError
DeviceNotAvailableException

创建闪光器

protected abstract IDeviceFlasher createFlasher (ITestDevice device)

创建IDeviceFlasher以供使用。子类可以覆盖

参数
device ITestDevice

退货
IDeviceFlasher

投掷
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

获取设备启动等待时间

protected long getDeviceBootWaitTime ()

获取设备开机等待时间

退货
long

获取主机选项

protected IHostOptions getHostOptions ()

获取要使用的IHostOptions实例。

公开进行单元测试

退货
IHostOptions

报告FlashMetrics

protected void reportFlashMetrics (String branch, 
                String buildFlavor, 
                String buildId, 
                String serial, 
                long queueTime, 
                long flashingTime, 
                CommandStatus flashingStatus)

向指标后端报告设备闪烁计时数据

参数
branch String :设备构建源自的分支

buildFlavor String :设备构建的构建风格

buildId String : 设备版本号

serial String : 设备序列号

queueTime long :等待闪烁限制可用的时间

flashingTime long : 刷新设备映像 zip 所花费的时间

flashingStatus CommandStatus : 闪烁命令的执行状态

setSkipPostFlashBuildIdCheck

protected void setSkipPostFlashBuildIdCheck (boolean skipPostFlashBuildIdCheck)

参数
skipPostFlashBuildIdCheck boolean

setSkipPostFlashFlavorCheck

protected void setSkipPostFlashFlavorCheck (boolean skipPostFlashFlavorCheck)

参数
skipPostFlashFlavorCheck boolean