DeviceFlashPreparer

public abstract class DeviceFlashPreparer
extends BaseTargetPreparer implements IConfigurationReceiver, ITestLoggerReceiver

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


ITargetPreparer,可將映像檔刷新至實體 Android 硬體。

摘要

公用建構函式

DeviceFlashPreparer()

公用方法

void addAllowedBranchForTransitionInIncremental(String branch)
void addBranchTransitionInIncremental(String origin, String destination)
void addFlasherExtraMetadata( metadata)
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)

注入使用的 IConfiguration

void setIgnoreHostOptions(boolean ignoreHostOptions)
void setTestLogger(ITestLogger testLogger)

注入 ITestLogger 例項

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)

受保護的方法

boolean checkAntiRollback(IDeviceFlasher flasher, ITestDevice device, IDeviceBuildInfo deviceBuild)
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 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

addFlasherExtraMetadata

public void addFlasherExtraMetadata ( metadata)

參數
metadata

getBuild

public IBuildInfo getBuild (TestInformation testInfo)

包裝 getBuildInfo,以便在特定情境中覆寫該函式。

參數
testInfo TestInformation

傳回
IBuildInfo

getTestLogger

public ITestLogger getTestLogger ()

傳回
ITestLogger

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

受保護的方法

checkAntiRollback

protected boolean checkAntiRollback (IDeviceFlasher flasher, 
                ITestDevice device, 
                IDeviceBuildInfo deviceBuild)

參數
flasher IDeviceFlasher

device ITestDevice

deviceBuild IDeviceBuildInfo

傳回
boolean

擲回
DeviceNotAvailableException

checkDeviceProductType

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

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:裝置建構版本來源的分支

buildFlavor String:裝置建構版本的建構風味

buildId String:裝置版本的建構編號

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