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 ()

公共方法

设置

public void setUp (TestInformation testInfo)

执行测试目标设置。

参数
testInfo TestInformation :调用的TestInformation

投掷
BuildError
DeviceNotAvailableException
TargetSetupError

验证GkiBootImg

public void validateGkiBootImg (ITestDevice device, 
                IBuildInfo buildInfo)

验证预期的 GKI 启动映像。 (已废弃。请提供 tmpDir 来电)

参数
device ITestDeviceITestDevice

buildInfo IBuildInfoIBuildInfo构建信息

投掷
TargetSetupError如果没有有效的 gki boot.img

受保护的方法

添加哈希页脚

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

构建GkiSystemDlkmImg

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

如果提供了 system_dlkm 存档,则构建 GKI system_dlkm 映像。

参数
device ITestDeviceITestDevice

buildInfo IBuildInfoIBuildInfo构建信息

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

投掷
TargetSetupError如果构建图像文件时出现错误。

提取系统DlkmTarGzip

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 内容的文件。

投掷
IO异常

展平SystemDlkm

protected void flattenSystemDlkm (ITestDevice device, 
                File systemDlkmStagingDir)

展平 system_dlkm 暂存目录,以便所有内核模块都直接位于 /lib/modules 下。这对于匹配平台构建的预期 system_dlkm 文件布局是必要的。

参数
device ITestDeviceITestDevice

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

投掷
如果平整 system_dlkm 时出现错误,则返回 TargetSetupError。
TargetSetupError

获取主机选项

protected IHostOptions getHostOptions ()

获取对IHostOptions引用

退货
IHostOptions要使用的IHostOptions

获取请求的文件

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

按请求的文件名从源文件(zip 或文件夹)中获取请求的文件。

提供的源文件可以是 zip 文件。该方法会将其解压缩到临时目录,并通过提供的文件名查找请求的文件。

提供的源文件可以是文件夹。该方法将通过提供的文件名查找请求的文件。

参数
device ITestDeviceITestDevice

requestedFileName String : 请求的文件名 String

sourceFile File :源文件

tmpDir File

退货
File由请求的文件名指定的文件

投掷
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

获取运行工具

protected IRunUtil getRunUtil ()

获取要使用的IRunUtil实例。

退货
IRunUtil要使用的IRunUtil

验证GkiBootImg

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

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

参数
device ITestDeviceITestDevice

buildInfo IBuildInfoIBuildInfo构建信息

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

投掷
TargetSetupError如果没有有效的 gki boot.img