FastbootDeviceFlasher
public
class
FastbootDeviceFlasher
extends Object
implements
IDeviceFlasher
| java.lang.Object | |
| ↳ | com.android.tradefed.targetprep.FastbootDeviceFlasher |
一个依赖于 fastboot 在实体 Android 硬件上刷写映像的类。
摘要
常量 | |
|---|---|
String |
BASEBAND_IMAGE_NAME
|
公共构造函数 | |
|---|---|
FastbootDeviceFlasher()
|
|
公共方法 | |
|---|---|
static
String
|
fetchImageVersion(IRunUtil runUtil, ITestDevice device, String imageName)
用于获取设备上当前映像版本的辅助方法。 |
void
|
flash(ITestDevice device, IDeviceBuildInfo deviceBuild)
在设备上刷写 build。 |
CommandStatus
|
getSystemFlashingStatus()
检索用于刷写主系统分区的命令的执行状态。 |
IDeviceFlasher.UserDataFlashOption
|
getUserDataFlashOption()
获取用户数据映像是否应刷写、擦除或保留 |
void
|
overrideDeviceOptions(ITestDevice device)
设备的覆盖选项。 |
void
|
preFlashOperations(ITestDevice device, IDeviceBuildInfo deviceBuild)
在实际刷写关键部分之前必须进行的所有设置操作和检查。 |
void
|
setDataWipeSkipList(
设置
请注意,跳过列表的粒度是 |
void
|
setFlashOptions(
设置要随刷写/更新命令传递的选项列表。 |
void
|
setFlashingResourcesRetriever(IFlashingResourcesRetriever retriever)
设置刷写器可用于检索刷写资源文件的机制。 |
void
|
setForceSystemFlash(boolean forceSystemFlash)
设置系统是否应始终刷写,即使运行当前 build 也是如此 |
void
|
setIncrementalFlashing(IncrementalImageUtil incrementalUtil)
|
void
|
setRamdiskPartition(String ramdiskPartition)
设置 ramdisk 分区 |
void
|
setShouldFlashRamdisk(boolean shouldFlashRamdisk)
设置是否应在通过映像 zip 更新设备后刷写额外的 ramdisk |
void
|
setUserDataFlashOption(IDeviceFlasher.UserDataFlashOption flashOption)
切换用户数据映像是应刷写、清除还是保留 |
void
|
setWipeTimeout(long timeout)
设置清除数据的超时时间。 |
boolean
|
shouldFlashRamdisk()
检查刷写器是否设置为在通过映像 zip 更新设备后刷写额外的 ramdisk |
boolean
|
shouldSkipBootloaderVersionCheck()
|
static
boolean
|
stderrContainsFailed(String stderr, boolean skipBootloaderVersionCheck)
|
static
boolean
|
stderrContainsFailed(String stderr, boolean skipBootloaderVersionCheck, boolean skipFastbootFailedMessage)
|
受保护的方法 | |
|---|---|
void
|
checkAndFlashBaseband(ITestDevice device, IDeviceBuildInfo deviceBuild)
如果需要,请在设备上刷写基带映像。 |
boolean
|
checkAndFlashBootloader(ITestDevice device, IDeviceBuildInfo deviceBuild)
如果需要,请在设备上刷写引导加载程序映像。 |
boolean
|
checkAndFlashSystem(ITestDevice device, String systemBuildId, String systemBuildFlavor, IDeviceBuildInfo deviceBuild)
如有需要,请在设备上刷写系统映像。 |
boolean
|
checkShouldFlashBaseband(ITestDevice device, IDeviceBuildInfo deviceBuild)
检查所提供设备上的基带是否需要刷写。 |
IFlashingResourcesParser
|
createFlashingResourcesParser(IDeviceBuildInfo localBuild, DeviceDescriptor descriptor)
用于创建 |
void
|
downloadExtraImageFiles(IFlashingResourcesParser resourceParser, IFlashingResourcesRetriever retriever, IDeviceBuildInfo localBuild)
钩子,用于允许子类在需要时下载额外的自定义图片文件。 |
void
|
downloadFlashingResources(ITestDevice device, IDeviceBuildInfo localBuild)
下载所需的额外刷写映像文件 |
String
|
executeFastbootCmd(ITestDevice device, String... cmdArgs)
用于执行 fastboot 命令的辅助方法。 |
String
|
executeLongFastbootCmd(ITestDevice device, String... cmdArgs)
用于执行长时间运行的 fastboot 命令的辅助方法。 |
String
|
executeLongFastbootCmd(ITestDevice device,
用于执行包含环境变量的长时间运行的 fastboot 命令的辅助方法。 |
void
|
flashBaseband(ITestDevice device, File basebandImageFile)
刷写给定的基带映像并重新启动到引导加载程序 |
void
|
flashBootloader(ITestDevice device, File bootloaderImageFile)
刷写给定的引导加载程序映像,然后重新启动到引导加载程序 |
void
|
flashExtraImages(ITestDevice device, IDeviceBuildInfo deviceBuild)
在刷写系统和重新启动之前,刷写任何特定于设备的 partition。 |
void
|
flashPartition(ITestDevice device, File imgFile, String partition)
刷写设备的单个分区 |
void
|
flashRamdiskIfNeeded(ITestDevice device, IDeviceBuildInfo deviceBuild)
|
void
|
flashSystem(ITestDevice device, IDeviceBuildInfo deviceBuild)
在设备上刷写系统映像。 |
void
|
flashUserData(ITestDevice device, IDeviceBuildInfo deviceBuild)
在设备上刷写用户数据分区。 |
void
|
flashUserDataFromDeviceImageFile(ITestDevice device, IDeviceBuildInfo deviceBuild)
从设备映像文件中提取 userdata.img 并将其刷写到设备上 |
String
|
getBootPartitionName()
获取相应设备刷写器的启动分区名称。 |
String
|
getBootloaderFilePrefix(ITestDevice device)
获取引导加载程序文件前缀。 |
String
|
getCurrentSlot(ITestDevice device)
用于检索当前 slot(适用于支持 A/B 的设备)的辅助方法。 |
IFlashingResourcesRetriever
|
getFlashingResourcesRetriever()
|
FuseUtil
|
getFuseUtil()
|
String
|
getImageVersion(ITestDevice device, String imageName)
|
IRunUtil
|
getRunUtil()
公开以供测试。 |
void
|
handleUserDataFlashing(ITestDevice device, IDeviceBuildInfo deviceBuild)
处理 userdata/cache 分区的刷写 |
boolean
|
hasPartition(ITestDevice device, String partition)
与引导加载程序一起检查指定分区是否存在 |
void
|
preFlashSetup(ITestDevice device, IDeviceBuildInfo deviceBuild)
执行所需的任何其他刷写前设置。 |
void
|
setSkipBootloaderVersionCheck(boolean skipBootloaderVersionCheck)
|
void
|
setSkipFastbootFailedMessage(boolean skipFastbootFailedMessage)
|
void
|
setSystemBuildInfo(String systemBuildId, String systemBuildFlavor)
|
void
|
verifyRequiredBoards(ITestDevice device, IFlashingResourcesParser resourceParser, String deviceProductType)
验证设备的商品类型是否支持要刷写的 build。 |
void
|
wipeCache(ITestDevice device)
擦除设备上的缓存分区。 |
void
|
wipePartition(ITestDevice device, String partition)
使用 `fastboot erase <name>` 清除指定分区 |
常量
BASEBAND_IMAGE_NAME
public static final String BASEBAND_IMAGE_NAME
常量值: "radio"
公共构造函数
FastbootDeviceFlasher
public FastbootDeviceFlasher ()
公共方法
fetchImageVersion
public static String fetchImageVersion (IRunUtil runUtil, ITestDevice device, String imageName)
用于获取设备上当前映像版本的辅助方法。
| 参数 | |
|---|---|
runUtil |
IRunUtil |
device |
ITestDevice:要执行命令的 ITestDevice |
imageName |
String:要获取的映像的名称。 |
| 返回 | |
|---|---|
String |
将命令的 stdout 输出设为字符串 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果 fastboot 命令失败或无法确定版本 |
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 |
|
setFlashOptions
public void setFlashOptions (flashOptions)
设置要随刷写/更新命令传递的选项列表。
setFlashingResourcesRetriever
public void setFlashingResourcesRetriever (IFlashingResourcesRetriever retriever)
设置刷写器可用于检索刷写资源文件的机制。
| 参数 | |
|---|---|
retriever |
IFlashingResourcesRetriever:要使用的 IFlashingResourcesRetriever |
setForceSystemFlash
public void setForceSystemFlash (boolean forceSystemFlash)
设置是否应始终刷写系统,即使当前 build 正在运行
setIncrementalFlashing
public void setIncrementalFlashing (IncrementalImageUtil incrementalUtil)
| 参数 | |
|---|---|
incrementalUtil |
IncrementalImageUtil |
setRamdiskPartition
public void setRamdiskPartition (String ramdiskPartition)
设置 ramdisk 分区
setShouldFlashRamdisk
public void setShouldFlashRamdisk (boolean shouldFlashRamdisk)
设置是否应在通过映像 zip 更新设备后刷写额外的 ramdisk
setUserDataFlashOption
public void setUserDataFlashOption (IDeviceFlasher.UserDataFlashOption flashOption)
切换用户数据映像是应刷写、清除还是保留
setWipeTimeout
public void setWipeTimeout (long timeout)
设置清除数据的超时时间。
| 参数 | |
|---|---|
timeout |
long |
shouldFlashRamdisk
public boolean shouldFlashRamdisk ()
检查刷写器是否设置为在通过映像 zip 更新设备后刷写额外的 ramdisk
| 返回 | |
|---|---|
boolean |
|
shouldSkipBootloaderVersionCheck
public boolean shouldSkipBootloaderVersionCheck ()
| 返回 | |
|---|---|
boolean |
|
stderrContainsFailed
public static boolean stderrContainsFailed (String stderr,
boolean skipBootloaderVersionCheck)| 参数 | |
|---|---|
stderr |
String |
skipBootloaderVersionCheck |
boolean |
| 返回 | |
|---|---|
boolean |
|
stderrContainsFailed
public static boolean stderrContainsFailed (String stderr,
boolean skipBootloaderVersionCheck,
boolean skipFastbootFailedMessage)| 参数 | |
|---|---|
stderr |
String |
skipBootloaderVersionCheck |
boolean |
skipFastbootFailedMessage |
boolean |
| 返回 | |
|---|---|
boolean |
|
受保护的方法
checkAndFlashBaseband
protected void checkAndFlashBaseband (ITestDevice device, IDeviceBuildInfo deviceBuild)
如果需要,请在设备上刷写基带映像。仅当设备上的当前版本与所需版本不同时,才会刷写基带
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
deviceBuild |
IDeviceBuildInfo:包含要刷入的基带映像的 IDeviceBuildInfo |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果未能刷写基带 |
checkAndFlashBootloader
protected boolean checkAndFlashBootloader (ITestDevice device, IDeviceBuildInfo deviceBuild)
如有需要,请在设备上刷写引导加载程序映像。
仅当设备上的当前引导加载程序版本与所需版本不同时,才会刷写引导加载程序。
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
deviceBuild |
IDeviceBuildInfo:包含要刷写的引导加载程序映像的 IDeviceBuildInfo |
| 返回 | |
|---|---|
boolean |
如果刷写了引导加载程序,则为 true;如果跳过了,则为 false |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果刷写引导加载程序失败 |
checkAndFlashSystem
protected boolean checkAndFlashSystem (ITestDevice device, String systemBuildId, String systemBuildFlavor, IDeviceBuildInfo deviceBuild)
如有需要,请在设备上刷写系统映像。
请参阅 ERROR(/#shouldFlashSystem(String,String,com.android.tradefed.build.IDeviceBuildInfo))
无论选择哪种路径,方法执行后,设备都应启动进入用户空间。
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
systemBuildId |
String:设备上运行的当前 build ID |
systemBuildFlavor |
String:设备上运行的当前 build 变种 |
deviceBuild |
IDeviceBuildInfo:包含要刷写的系统映像的 IDeviceBuildInfo |
| 返回 | |
|---|---|
boolean |
如果系统已刷写,则为 true;如果已跳过,则为 false |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果刷写引导加载程序失败 |
checkShouldFlashBaseband
protected boolean checkShouldFlashBaseband (ITestDevice device, IDeviceBuildInfo deviceBuild)
检查所提供设备上的基带是否需要刷写。
| 参数 | |
|---|---|
device |
ITestDevice:要检查的 ITestDevice |
deviceBuild |
IDeviceBuildInfo:包含要检查的基带映像的 IDeviceBuildInfo |
| 返回 | |
|---|---|
boolean |
|
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果未能刷写基带 |
createFlashingResourcesParser
protected IFlashingResourcesParser createFlashingResourcesParser (IDeviceBuildInfo localBuild, DeviceDescriptor descriptor)
用于创建 IFlashingResourcesParser 的工厂方法。
公开以用于单元测试。
| 参数 | |
|---|---|
localBuild |
IDeviceBuildInfo:要解析的 IDeviceBuildInfo |
descriptor |
DeviceDescriptor:正在刷写的设备的描述符。 |
| 返回 | |
|---|---|
IFlashingResourcesParser |
由工厂方法创建的 IFlashingResourcesParser。 |
| 抛出 | |
|---|---|
|
com.android.tradefed.targetprep.TargetSetupError |
TargetSetupError |
|
downloadExtraImageFiles
protected void downloadExtraImageFiles (IFlashingResourcesParser resourceParser, IFlashingResourcesRetriever retriever, IDeviceBuildInfo localBuild)
钩子,用于允许子类在需要时下载额外的自定义映像文件。
| 参数 | |
|---|---|
resourceParser |
IFlashingResourcesParser:IFlashingResourcesParser |
retriever |
IFlashingResourcesRetriever:IFlashingResourcesRetriever |
localBuild |
IDeviceBuildInfo:IDeviceBuildInfo |
| 抛出 | |
|---|---|
|
com.android.tradefed.targetprep.TargetSetupError |
TargetSetupError |
|
downloadFlashingResources
protected void downloadFlashingResources (ITestDevice device, IDeviceBuildInfo localBuild)
下载所需的额外刷写映像文件
| 参数 | |
|---|---|
device |
ITestDevice:要下载资源的 ITestDevice |
localBuild |
IDeviceBuildInfo:要填充的 IDeviceBuildInfo。假设设备映像文件已设置 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果未能检索到资源 |
executeFastbootCmd
protected String executeFastbootCmd (ITestDevice device, String... cmdArgs)
用于执行 fastboot 命令的辅助方法。
| 参数 | |
|---|---|
device |
ITestDevice:要执行命令的 ITestDevice |
cmdArgs |
String:要提供给 fastboot 的实参 |
| 返回 | |
|---|---|
String |
如果非空,则将命令的 stderr 输出设为字符串。否则,返回 stdout。有些 fastboot 命令很奇怪,它们会在成功时将输出转储到 stderr |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果 fastboot 命令失败 |
executeLongFastbootCmd
protected String executeLongFastbootCmd (ITestDevice device, String... cmdArgs)
用于执行长时间运行的 fastboot 命令的辅助方法。
注意:大多数 fastboot 命令通常会在 INativeDevice.executeFastbootCommand(String) 允许的超时时间内执行。不过,当多个设备同时刷写设备时,fastboot 命令的执行时间可能会比正常情况长得多。
| 参数 | |
|---|---|
device |
ITestDevice:要执行命令的 ITestDevice |
cmdArgs |
String:要提供给 fastboot 的实参 |
| 返回 | |
|---|---|
String |
如果非空,则将命令的 stderr 输出设为字符串。否则,返回 stdout。有些 fastboot 命令很奇怪,它们会在成功时将输出转储到 stderr |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果 fastboot 命令失败 |
executeLongFastbootCmd
protected String executeLongFastbootCmd (ITestDevice device,envVarMap, String... cmdArgs)
用于执行包含环境变量的长时间运行的 fastboot 命令的辅助方法。
注意:大多数 fastboot 命令通常会在 INativeDevice.executeFastbootCommand(String) 允许的超时时间内执行。不过,当多个设备同时刷写设备时,fastboot 命令的执行时间可能会比正常情况长得多。
| 参数 | |
|---|---|
device |
ITestDevice:要执行命令的 ITestDevice |
envVarMap |
:包含需要在运行 fastboot 命令之前设置的环境变量的映射 |
cmdArgs |
String:要提供给 fastboot 的实参 |
| 返回 | |
|---|---|
String |
如果非空,则将命令的 stderr 输出设为字符串。否则,返回 stdout。有些 fastboot 命令很奇怪,它们会在成功时将输出转储到 stderr |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果 fastboot 命令失败 |
flashBaseband
protected void flashBaseband (ITestDevice device, File basebandImageFile)
刷写给定的基带映像并重新启动到引导加载程序
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
basebandImageFile |
File:基带映像 ERROR(/File) |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果未能刷写基带 |
flashBootloader
protected void flashBootloader (ITestDevice device, File bootloaderImageFile)
刷写给定的引导加载程序映像,然后重新启动到引导加载程序
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
bootloaderImageFile |
File:引导加载程序映像 ERROR(/File) |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果刷写失败 |
flashExtraImages
protected void flashExtraImages (ITestDevice device, IDeviceBuildInfo deviceBuild)
在刷写系统和重新启动之前,刷写任何设备专用分区。除非被替换,否则为空操作。
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
deviceBuild |
IDeviceBuildInfo:包含 build 文件的 IDeviceBuildInfo |
| 抛出 | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
|
com.android.tradefed.targetprep.TargetSetupError |
DeviceNotAvailableException |
|
TargetSetupError |
|
flashPartition
protected void flashPartition (ITestDevice device, File imgFile, String partition)
刷写设备的单个分区
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
imgFile |
File:指向要刷写的映像的 ERROR(/File) |
partition |
String:要刷写的分区的名称 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
TargetSetupError |
|
flashRamdiskIfNeeded
protected void flashRamdiskIfNeeded (ITestDevice device, IDeviceBuildInfo deviceBuild)
| 参数 | |
|---|---|
device |
ITestDevice |
deviceBuild |
IDeviceBuildInfo |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
TargetSetupError |
|
flashSystem
protected void flashSystem (ITestDevice device, IDeviceBuildInfo deviceBuild)
在设备上刷写系统映像。
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
deviceBuild |
IDeviceBuildInfo:要刷写的 IDeviceBuildInfo |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果 fastboot 命令失败 |
flashUserData
protected void flashUserData (ITestDevice device, IDeviceBuildInfo deviceBuild)
在设备上刷写 userdata 分区。
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
deviceBuild |
IDeviceBuildInfo:包含要刷写的文件的 IDeviceBuildInfo |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果无法刷写用户数据 |
flashUserDataFromDeviceImageFile
protected void flashUserDataFromDeviceImageFile (ITestDevice device, IDeviceBuildInfo deviceBuild)
从设备映像文件中提取 userdata.img 并将其刷写到设备
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
deviceBuild |
IDeviceBuildInfo:包含要刷写的文件的 IDeviceBuildInfo |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果提取或刷写用户数据失败 |
getBootPartitionName
protected String getBootPartitionName ()
获取相应设备刷写器的启动分区名称。
默认为“bootloader”。子类应根据需要覆盖此方法。
| 返回 | |
|---|---|
String |
|
getBootloaderFilePrefix
protected String getBootloaderFilePrefix (ITestDevice device)
获取引导加载程序文件前缀。
默认为 getBootPartitionName()。子类应根据需要进行替换。
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
| 返回 | |
|---|---|
String |
|
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果未能获取前缀 |
getCurrentSlot
protected String getCurrentSlot (ITestDevice device)
用于检索当前 slot(对于支持 A/B 的设备)的辅助方法。
| 参数 | |
|---|---|
device |
ITestDevice:要执行命令的 ITestDevice。 |
| 返回 | |
|---|---|
String |
“a”“b”或 null(如果设备不支持 A/B) |
| 抛出 | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
|
com.android.tradefed.targetprep.TargetSetupError |
DeviceNotAvailableException |
|
TargetSetupError |
|
getFlashingResourcesRetriever
protected IFlashingResourcesRetriever getFlashingResourcesRetriever ()
| 返回 | |
|---|---|
IFlashingResourcesRetriever |
|
getImageVersion
protected String getImageVersion (ITestDevice device, String imageName)
| 参数 | |
|---|---|
device |
ITestDevice |
imageName |
String |
| 返回 | |
|---|---|
String |
|
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
TargetSetupError |
|
handleUserDataFlashing
protected void handleUserDataFlashing (ITestDevice device, IDeviceBuildInfo deviceBuild)
处理 userdata/cache 分区的刷写
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
deviceBuild |
IDeviceBuildInfo:包含要刷写的文件的 IDeviceBuildInfo |
| 抛出 | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
|
com.android.tradefed.targetprep.TargetSetupError |
DeviceNotAvailableException |
|
TargetSetupError |
|
hasPartition
protected boolean hasPartition (ITestDevice device, String partition)
与引导加载程序一起检查指定分区是否存在
| 参数 | |
|---|---|
device |
ITestDevice:要操作的 ITestDevice |
partition |
String:要检查的分区的名称 |
| 返回 | |
|---|---|
boolean |
|
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
preFlashSetup
protected void preFlashSetup (ITestDevice device, IDeviceBuildInfo deviceBuild)
执行所需的任何其他刷写前设置。除非被替换,否则为空操作。
| 参数 | |
|---|---|
device |
ITestDevice:要准备的 ITestDevice |
deviceBuild |
IDeviceBuildInfo:包含 build 文件的 IDeviceBuildInfo |
| 抛出 | |
|---|---|
|
com.android.tradefed.device.DeviceNotAvailableException |
|
com.android.tradefed.targetprep.TargetSetupError |
DeviceNotAvailableException |
|
TargetSetupError |
|
setSkipBootloaderVersionCheck
protected void setSkipBootloaderVersionCheck (boolean skipBootloaderVersionCheck)
| 参数 | |
|---|---|
skipBootloaderVersionCheck |
boolean |
setSkipFastbootFailedMessage
protected void setSkipFastbootFailedMessage (boolean skipFastbootFailedMessage)
| 参数 | |
|---|---|
skipFastbootFailedMessage |
boolean |
setSystemBuildInfo
protected void setSystemBuildInfo (String systemBuildId,
String systemBuildFlavor)| 参数 | |
|---|---|
systemBuildId |
String |
systemBuildFlavor |
String |
verifyRequiredBoards
protected void verifyRequiredBoards (ITestDevice device, IFlashingResourcesParser resourceParser, String deviceProductType)
验证设备的商品类型是否支持要刷写的 build。
基本实现将验证 deviceProductType 是否包含在 IFlashingResourcesParser.getRequiredBoards() 集合中。子类可以根据需要进行替换。
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
resourceParser |
IFlashingResourcesParser:IFlashingResourcesParser |
deviceProductType |
String:device 的产品类型 |
| 抛出 | |
|---|---|
TargetSetupError |
如果 build 的必需主板信息与设备不匹配 |
wipeCache
protected void wipeCache (ITestDevice device)
擦除设备上的缓存分区。
| 参数 | |
|---|---|
device |
ITestDevice:要刷写的 ITestDevice |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
如果设备不可用 |
TargetSetupError |
如果无法刷新缓存 |
wipePartition
protected void wipePartition (ITestDevice device, String partition)
使用 `fastboot erase <name>` 清除指定分区
| 参数 | |
|---|---|
device |
ITestDevice:要操作的 ITestDevice |
partition |
String:要擦除的分区的名称 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
TargetSetupError |
|