DeviceFlashPreparer

public abstract class DeviceFlashPreparer
extends BaseTargetPreparer

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


用于在实体 Android 硬件上刷写映像的 ITargetPreparer

摘要

嵌套类

enum DeviceFlashPreparer.EncryptionOptions

用于处理 userdata 映像加密的选项枚举  

公共构造函数

DeviceFlashPreparer()

公共方法

void setUp(TestInformation testInfo)

void setUserDataFlashOption(IDeviceFlasher.UserDataFlashOption flashOption)

设置 userdata-flash 选项

void tearDown(TestInformation testInfo, Throwable e)

受保护的方法

void checkDeviceProductType(ITestDevice device, IDeviceBuildInfo deviceBuild)

在刷写之前进行可能的检查,以确保设备与 build 信息相比符合预期。

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 ()

公共方法

setUp

public void setUp (TestInformation testInfo)

参数
testInfo TestInformation

抛出
BuildError
DeviceNotAvailableException
TargetSetupError

setUserDataFlashOption

public void setUserDataFlashOption (IDeviceFlasher.UserDataFlashOption flashOption)

设置 userdata-flash 选项

tearDown

public void tearDown (TestInformation testInfo, 
                Throwable e)

参数
testInfo TestInformation

e Throwable

抛出
DeviceNotAvailableException

受保护的方法

checkDeviceProductType

protected void checkDeviceProductType (ITestDevice device, 
                IDeviceBuildInfo deviceBuild)

在刷写之前进行可能的检查,以确保设备与 build 信息一致。

参数
device ITestDevice:要闪烁的 ITestDevice

deviceBuild IDeviceBuildInfo:用于闪烁的 IDeviceBuildInfo

抛出
com.android.tradefed.targetprep.BuildError
DeviceNotAvailableException
BuildError

createFlasher

protected abstract IDeviceFlasher createFlasher (ITestDevice device)

创建要使用的 IDeviceFlasher。子类可以替换

参数
device ITestDevice

返回
IDeviceFlasher

抛出
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

setSkipPostFlashFlavorCheck

protected void setSkipPostFlashFlavorCheck (boolean skipPostFlashFlavorCheck)

参数
skipPostFlashFlavorCheck boolean