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)

すべてのカーネル モジュールが /lib/modules の直下になるように、system_dlkm ステージング ディレクトリをフラット化します。

String[] getDeviceKernelVersion(ITestDevice device)

フラッシュする前にデバイスからデバイス カーネル バージョンを取得します。

IHostOptions getHostOptions()

IHostOptions への参照を取得する

String[] getKernelVersionFromImage(File image)

boot、vendor_boot、system_dlkm、vendor_dlkm のイメージ ファイルからカーネル バージョンを抽出します。

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

リクエストされたファイル名で、リクエストされたファイルをソースファイル(zip またはフォルダ)から取得します。

IRunUtil getRunUtil()

使用する IRunUtil インスタンスを取得します。

String[] parseKernelVersion(String source, String kernelVersionString)
void validateGkiBootImg(ITestDevice device, IBuildInfo buildInfo, File tmpDir)

GKI ブートイメージが想定どおりであることを検証します。

void validateKernelCompatibility(String imageName, String[] imageVersion, String[] bootVersion, ITestDevice device)
void validateKernelVersion(ITestDevice device, IBuildInfo buildInfo, File tmpDir)

イメージ内のカーネル バージョンが想定どおりであることを検証します。

パブリック コンストラクタ

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 ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo ビルド情報

例外
TargetSetupError 有効な gki boot.img がない場合

保護されたメソッド

addHashFooter

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

GKI ブートイメージが想定どおりであることを検証します。有効な boot.img がない場合は例外をスローします。

パラメータ
device ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo ビルド情報

tmpDir File: 一時ディレクトリ File

例外
TargetSetupError 有効な gki boot.img がない場合
DeviceNotAvailableException

buildGkiSystemDlkmImg

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

system_dlkm アーカイブが提供されている場合は、GKI system_dlkm イメージをビルドします。

パラメータ
device ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo ビルド情報

tmpDir File: 一時ディレクトリ File

例外
TargetSetupError イメージ ファイルのビルド中にエラーが発生した場合。

extractSystemDlkmTarGzip

protected File extractSystemDlkmTarGzip (File systemDlkmArchive)

system_dlkm tar gzip ファイルを system_dlkm_staging フォルダに抽出します。この関数は、単体テスト用に untarring をスタブアウトするために ERROR(/TarUtil.extractTarGzipToTemp) のラッパーです。

パラメータ
systemDlkmArchive File: GKI モジュールを含む system_dlkm tar gzip ファイル。

戻り値
File system_dlkm tar gzip の内容を含むファイル。

例外
java.io.IOException
IOException

flattenSystemDlkm

protected void flattenSystemDlkm (ITestDevice device, 
                File systemDlkmStagingDir)

すべてのカーネル モジュールが /lib/modules の直下になるように、system_dlkm ステージング ディレクトリをフラット化します。これは、プラットフォーム ビルドの想定される system_dlkm ファイル レイアウトと一致させるために必要です。

パラメータ
device ITestDevice: ITestDevice

systemDlkmStagingDir File: system_dlkm ステージング ディレクトリ File

例外
IOException システム dlkm のフラット化でエラーが発生した場合は TargetSetupError。
TargetSetupError

getDeviceKernelVersion

protected String[] getDeviceKernelVersion (ITestDevice device)

フラッシュする前にデバイスからデバイス カーネル バージョンを取得します。

パラメータ
device ITestDevice: カーネル バージョンを取得する ITestDevice

戻り値
String[] 解析されたカーネル バージョン情報([kernelVersion, patchLevel, pageSize])を含む ERROR(/String[])。バージョン文字列を解析できない場合は null を返します。2

例外
DeviceNotAvailableException

getHostOptions

protected IHostOptions getHostOptions ()

IHostOptions への参照を取得する

戻り値
IHostOptions 使用する IHostOptions

getKernelVersionFromImage

protected String[] getKernelVersionFromImage (File image)

boot/vendor_boot/system_dlkm/vendor_dlkm イメージ ファイルからカーネル バージョンを抽出します。このメソッドは、boot/vendor_boot/system_dlkm/vendor_dlkm イメージ ファイルを読み取り、Android カーネル バージョン文字列内の特定のパターンを検索します。次に、検出された文字列を解析して、標準化された形式でカーネル バージョンを抽出します。

パラメータ
image File: ブート イメージ ファイル(boot.img など)への File

戻り値
String[] 解析されたカーネル バージョン情報([kernelVersion, patchLevel, pageSize])を含む ERROR(/String[])。バージョン文字列を解析できない場合は null を返します。

getRequestedFile

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

リクエストされたファイル名で、リクエストされたファイルをソースファイル(zip またはフォルダ)から取得します。

指定するソースファイルは ZIP ファイルでも構いません。メソッドは、一時ディレクトリに解凍し、指定されたファイル名でリクエストされたファイルを検索します。

指定されたソースファイルはファイル フォルダにできます。このメソッドは、指定されたファイル名でリクエストされたファイルを検索します。

パラメータ
device ITestDevice: ITestDevice

requestedFileName String: リクエストされたファイル名の文字列

sourceFile File: ソースファイル

tmpDir File

戻り値
File リクエストされたファイル名で指定されたファイル

例外
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

getRunUtil

protected IRunUtil getRunUtil ()

使用する IRunUtil インスタンスを取得します。

戻り値
IRunUtil 使用する IRunUtil

parseKernelVersion

protected String[] parseKernelVersion (String source, 
                String kernelVersionString)

パラメータ
source String

kernelVersionString String

戻り値
String[]

validateGkiBootImg

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

GKI ブートイメージが想定どおりであることを検証します。有効な boot.img がない場合は例外をスローします。

パラメータ
device ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo ビルド情報

tmpDir File: 一時ディレクトリ File

例外
TargetSetupError 有効な gki boot.img がない場合

validateKernelCompatibility

protected void validateKernelCompatibility (String imageName, 
                String[] imageVersion, 
                String[] bootVersion, 
                ITestDevice device)

パラメータ
imageName String

imageVersion String

bootVersion String

device ITestDevice

例外
TargetSetupError

validateKernelVersion

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

イメージ内のカーネル バージョンが想定どおりであることを検証します。有効でない場合は例外をスローします。

パラメータ
device ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo ビルド情報

tmpDir File: 一時ディレクトリ File

例外
TargetSetupError 有効な gki boot.img がない場合
DeviceNotAvailableException