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 启动映像是否符合预期。(已废弃。Please call with tmpDir provided)

参数
device ITestDeviceITestDevice

buildInfo IBuildInfoIBuildInfo build 信息

抛出
TargetSetupError 如果没有有效的 gki boot.img

受保护的方法

addHashFooter

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

验证 GKI 启动映像是否符合预期。如果没有有效的 boot.img,则抛出异常。

参数
device ITestDeviceITestDevice

buildInfo IBuildInfoIBuildInfo build 信息

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 build 信息

tmpDir File:临时目录 ERROR(/File)

抛出
TargetSetupError 如果构建图片文件时出错。

extractSystemDlkmTarGzip

protected File extractSystemDlkmTarGzip (File systemDlkmArchive)

将 system_dlkm tar gzip 文件提取到 system_dlkm_staging 文件夹中。此函数是 ERROR(/TarUtil.extractTarGzipToTemp) 的封装容器,用于为单元测试桩解压缩。

参数
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 下。这对于与平台 build 的预期 system_dlkm 文件布局相匹配至关重要。

参数
device ITestDeviceITestDevice

systemDlkmStagingDir File:system_dlkm 暂存目录 ERROR(/File)

抛出
或者 TargetSetupError(如果在展平 system_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 build 信息

tmpDir File:临时目录 ERROR(/File)

抛出
TargetSetupError 如果没有有效的 gki boot.img