GkiDeviceFlashPreparer

public class GkiDeviceFlashPreparer
extends BaseTargetPreparer implements ILabPreparer

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


使用 Android 通用核心一般映像檔,對裝置進行刷機的目標準備工具。詳情請參閱 https://source.android.com/devices/architecture/kernel/android-common。

摘要

公用建構函式

GkiDeviceFlashPreparer()

公用方法

void setUp(TestInformation testInfo)

執行目標設定以進行測試。

void validateGkiBootImg(ITestDevice device, IBuildInfo buildInfo)

驗證 GKI 開機映像檔是否符合預期。

受保護的方法

void addHashFooter(ITestDevice device, IBuildInfo buildInfo, File tmpDir)

驗證 GKI 開機映像檔是否符合預期。

void buildGkiSystemDlkmImg(ITestDevice device, IBuildInfo buildInfo, File tmpDir)

如果提供 system_dlkm 封存檔,請建構 GKI system_dlkm 映像檔。

File extractSystemDlkmTarGzip(File systemDlkmArchive)

將 system_dlkm tar gzip 檔案解壓縮至 system_dlkm_staging 資料夾。

void flattenSystemDlkm(ITestDevice device, File systemDlkmStagingDir)

將 system_dlkm 暫存目錄扁平化,讓所有核心模組直接位於 /lib/modules 下。

IHostOptions getHostOptions()

取得 IHostOptions 的參照

File getRequestedFile(ITestDevice device, String requestedFileName, File sourceFile, File tmpDir)

根據要求的檔案名稱,從來源檔案 (ZIP 或資料夾) 取得要求的檔案。

IRunUtil getRunUtil()

取得要使用的 IRunUtil 例項。

void validateGkiBootImg(ITestDevice device, IBuildInfo buildInfo, File tmpDir)

驗證 GKI 開機映像檔是否符合預期。

公用建構函式

GkiDeviceFlashPreparer

public GkiDeviceFlashPreparer ()

公用方法

setUp

public void setUp (TestInformation testInfo)

執行目標設定以進行測試。

參數
testInfo TestInformation:呼叫的 TestInformation

擲回
BuildError
DeviceNotAvailableException
TargetSetupError

validateGkiBootImg

public void validateGkiBootImg (ITestDevice device, 
                IBuildInfo buildInfo)

驗證 GKI 開機映像檔是否符合預期。(已淘汰)。請使用提供的 tmpDir 呼叫

參數
device ITestDeviceITestDevice

buildInfo IBuildInfoIBuildInfo 的建構資訊

擲回
TargetSetupError 如果沒有有效的 gki boot.img

受保護的方法

addHashFooter

protected void addHashFooter (ITestDevice device, 
                IBuildInfo buildInfo, 
                File tmpDir)

驗證 GKI 開機映像檔是否符合預期。如果沒有有效的 boot.img,就擲回例外狀況。

參數
device ITestDeviceITestDevice

buildInfo IBuildInfoIBuildInfo 的建構資訊

tmpDir File:臨時目錄 ERROR(/File)

擲回
TargetSetupError 如果沒有有效的 gki boot.img
DeviceNotAvailableException

buildGkiSystemDlkmImg

protected void buildGkiSystemDlkmImg (ITestDevice device, 
                IBuildInfo buildInfo, 
                File tmpDir)

如果提供 system_dlkm 封存檔,請建構 GKI system_dlkm 映像檔。

參數
device ITestDeviceITestDevice

buildInfo IBuildInfoIBuildInfo 的建構資訊

tmpDir File:臨時目錄 ERROR(/File)

擲回
TargetSetupError 建構圖片檔案時發生錯誤。

extractSystemDlkmTarGzip

protected File extractSystemDlkmTarGzip (File systemDlkmArchive)

將 system_dlkm tar gzip 檔案解壓縮至 system_dlkm_staging 資料夾。這個函式是 ERROR(/TarUtil.extractTarGzipToTemp) 的包裝函式,可為單元測試建立 untarring 的虛設項目。

參數
systemDlkmArchive File:內含 GKI 模組的 system_dlkm tar gzip 檔案。

傳回
File 包含 system_dlkm tar gzip 內容的檔案。

擲回
IOException

flattenSystemDlkm

protected void flattenSystemDlkm (ITestDevice device, 
                File systemDlkmStagingDir)

將 system_dlkm 暫存目錄扁平化,讓所有核心模組直接位於 /lib/modules 下。這項操作是為了符合平台版本的預期 system_dlkm 檔案版面配置。

參數
device ITestDeviceITestDevice

systemDlkmStagingDir File:system_dlkm 暫存目錄 ERROR(/File)

擲回
或 TargetSetupError,如果系統_dlkm 扁平化時發生錯誤。
TargetSetupError

getHostOptions

protected IHostOptions getHostOptions ()

取得 IHostOptions 的參照

傳回
IHostOptions 要使用的 IHostOptions

getRequestedFile

protected File getRequestedFile (ITestDevice device, 
                String requestedFileName, 
                File sourceFile, 
                File tmpDir)

根據要求的檔案名稱,從來源檔案 (ZIP 或資料夾) 取得要求的檔案。

您可以提供 ZIP 檔案做為來源檔案。該方法會將其解壓縮至臨時目錄,並根據提供的檔案名稱尋找要求的檔案。

您提供的來源檔案可以是檔案資料夾。該方法會根據提供的檔案名稱尋找要求的檔案。

參數
device ITestDeviceITestDevice

requestedFileName String:要求檔案名稱字串

sourceFile File:來源檔案

tmpDir File

傳回
File 由要求的檔案名稱指定的檔案

擲回
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

getRunUtil

protected IRunUtil getRunUtil ()

取得要使用的 IRunUtil 例項。

傳回
IRunUtil 要使用的 IRunUtil

validateGkiBootImg

protected void validateGkiBootImg (ITestDevice device, 
                IBuildInfo buildInfo, 
                File tmpDir)

驗證 GKI 開機映像檔是否符合預期。如果沒有有效的 boot.img,就擲回例外狀況。

參數
device ITestDeviceITestDevice

buildInfo IBuildInfoIBuildInfo 的建構資訊

tmpDir File:臨時目錄 ERROR(/File)

擲回
TargetSetupError 如果沒有有效的 gki boot.img