OtaUpdateDeviceFlasher

public class OtaUpdateDeviceFlasher
extends Object implements IDeviceFlasher

java.lang.Object
   ↳ com.android.tradefed.targetprep.OtaUpdateDeviceFlasher


一种设备刷写器,可使用完整或增量 OTA 软件包触发 system/update_engine/scripts/update_device.py 脚本来更新设备映像。若要正确使用此刷写器,设备 build 信息必须包含名为“update-device-script”的文件条目,该条目指向上述脚本。

摘要

常量

String OTA_DOWNGRADE_PROP

String UPDATE_DEVICE_SCRIPT

String UPDATE_SUCCESS_OUTPUT

字段

protected static final String IN_ZIP_SCRIPT_PATH

公共构造函数

OtaUpdateDeviceFlasher()

公共方法

void flash(ITestDevice device, IDeviceBuildInfo deviceBuild)

在设备上刷写 build。

CommandStatus getSystemFlashingStatus()

检索用于刷写主系统分区的命令的执行状态。

IDeviceFlasher.UserDataFlashOption getUserDataFlashOption()

获取用户数据映像是否应刷写、擦除或保留

void overrideDeviceOptions(ITestDevice device)

设备的覆盖选项。

void preFlashOperations(ITestDevice device, IDeviceBuildInfo deviceBuild)

在实际刷写关键部分之前必须进行的所有设置操作和检查。

void setDataWipeSkipList( dataWipeSkipList)

设置 /data 下的路径列表,以避免在使用 ITestsZipInstaller 时清除这些路径

请注意,跳过列表的粒度是 /data 的直接子项。

void setFlashingResourcesRetriever(IFlashingResourcesRetriever retriever)

设置刷写器可用于检索刷写资源文件的机制。

void setForceSystemFlash(boolean forceSystemFlash)

设置系统是否应始终刷写,即使运行当前 build 也是如此

void setUserDataFlashOption(IDeviceFlasher.UserDataFlashOption flashOption)

切换用户数据映像是应刷写、清除还是保留

void setWipeTimeout(long timeout)

设置清除数据的超时时间。

受保护的方法

IRunUtil getRunUtil()

常量

OTA_DOWNGRADE_PROP

protected static final String OTA_DOWNGRADE_PROP

常量值: "ro.ota.allow_downgrade"

UPDATE_DEVICE_SCRIPT

protected static final String UPDATE_DEVICE_SCRIPT

常量值: “update-device-script”

UPDATE_SUCCESS_OUTPUT

protected static final String UPDATE_SUCCESS_OUTPUT

常量值: "onPayloadApplicationComplete(ErrorCode::kSuccess (0)"

字段

IN_ZIP_SCRIPT_PATH

protected static final String IN_ZIP_SCRIPT_PATH

公共构造函数

OtaUpdateDeviceFlasher

public OtaUpdateDeviceFlasher ()

公共方法

Flash

public void flash (ITestDevice device, 
                IDeviceBuildInfo deviceBuild)

在设备上刷写 build。

在刷写完成后立即返回。调用方应等待设备上线并可供使用,然后再继续进行测试。

参数
device ITestDevice:要刷写的 ITestDevice

deviceBuild IDeviceBuildInfo:要刷写的 IDeviceBuildInfo

抛出
DeviceNotAvailableException
TargetSetupError

getSystemFlashingStatus

public CommandStatus getSystemFlashingStatus ()

检索用于刷写主系统分区的命令的执行状态。

请注意,如果未刷写系统分区(系统已具有要刷写的 build),命令状态可能为 null

返回
CommandStatus

getUserDataFlashOption

public IDeviceFlasher.UserDataFlashOption getUserDataFlashOption ()

获取用户数据映像是应刷写、清除还是保留

返回
IDeviceFlasher.UserDataFlashOption 用户数据映像应刷写、清除还是保留

overrideDeviceOptions

public void overrideDeviceOptions (ITestDevice device)

设备的覆盖选项。用于在特定设备不支持默认值时替换默认选项值。

preFlashOperations

public void preFlashOperations (ITestDevice device, 
                IDeviceBuildInfo deviceBuild)

在实际刷写关键部分之前必须进行的所有设置操作和检查。这些操作都不会包含在并发控制的关键部分中。

参数
device ITestDevice:要刷写的 ITestDevice

deviceBuild IDeviceBuildInfo:要刷写的 IDeviceBuildInfo

抛出
DeviceNotAvailableException
TargetSetupError

setDataWipeSkipList

public void setDataWipeSkipList ( dataWipeSkipList)

设置 /data 下的路径列表,以避免在使用 ITestsZipInstaller 时清除这些路径

请注意,跳过列表的粒度是 /data 的直接子项。

参数
dataWipeSkipList

setFlashingResourcesRetriever

public void setFlashingResourcesRetriever (IFlashingResourcesRetriever retriever)

设置刷写器可用于检索刷写资源文件的机制。

参数
retriever IFlashingResourcesRetriever:要使用的 IFlashingResourcesRetriever

setForceSystemFlash

public void setForceSystemFlash (boolean forceSystemFlash)

设置是否应始终刷写系统,即使当前 build 正在运行

setUserDataFlashOption

public void setUserDataFlashOption (IDeviceFlasher.UserDataFlashOption flashOption)

切换用户数据映像是应刷写、清除还是保留

setWipeTimeout

public void setWipeTimeout (long timeout)

设置清除数据的超时时间。

参数
timeout long

受保护的方法

getRunUtil

protected IRunUtil getRunUtil ()

返回
IRunUtil