ModuleOemTargetPreparer

public class ModuleOemTargetPreparer
extends InstallApexModuleTargetPreparer

java.lang.Object
   ↳ com.android.tradefed.targetprep.BaseTargetPreparer
     ↳ com.android.tradefed.targetprep.TestAppInstallSetup
       ↳ com.android.tradefed.targetprep.suite.SuiteApkInstaller
         ↳ com.android.tradefed.targetprep.InstallApexModuleTargetPreparer
           ↳ com.android.tradefed.targetprep.ModuleOemTargetPreparer


摘要

巢狀類別

class ModuleOemTargetPreparer.ModuleInfo

簡單的結構體類別,用於儲存模組相關資訊

公用建構函式

ModuleOemTargetPreparer()

公用方法

void checkModuleAfterPush(ITestDevice device, pushedModules)

檢查已推送的模組名稱和版本代碼

void setUp(TestInformation testInfo)

執行目標設定以進行測試,並推送模組取代預先載入的模組

受保護的方法

void checkPreloadModules(TestInformation testInfo, DeviceDescriptor deviceDescriptor)

檢查預先載入模組資訊

String[] getApkDirectory(ITestDevice device, String packageName)

取得系統目錄下的 APK 檔案路徑

String getPackageVersioncode(ITestDevice device, String packageName, boolean isAPK)

在推送的模組中檢查套件版本 (套件名稱)。

ModuleOemTargetPreparer.ModuleInfo pushFile(File moduleFile, TestInformation testInfo)

將檔案推送至 /system/apex/ (適用於 Apex) 或 /system/** (適用於 APK)

String renameFile(ITestDevice device, File moduleFile, String packageName)

將要更新的檔案名稱重新命名為 /system 下的相同名稱。

void setupDevice(TestInformation testInfo)

在 /system 下推送檔案前,先使用 ADB 取得裝置的 root 權限並重新掛載裝置

公用建構函式

ModuleOemTargetPreparer

public ModuleOemTargetPreparer ()

公用方法

checkModuleAfterPush

public void checkModuleAfterPush (ITestDevice device, 
                 pushedModules)

檢查已推送的模組名稱和版本代碼

參數
device ITestDevice

pushedModules :已推送的模組清單

擲回
TargetSetupError 如果沒有推送模組,則擲回例外狀況
DeviceNotAvailableException 如果沒有可用的裝置,則擲回例外狀況

setUp

public void setUp (TestInformation testInfo)

執行目標設定以進行測試,並推送模組取代預先載入的模組

參數
testInfo TestInformation:呼叫的 TestInformation

擲回
TargetSetupError 設定環境時發生致命錯誤
BuildError 如果因建構作業準備而發生錯誤
DeviceNotAvailableException 如果裝置沒有回應

受保護的方法

checkPreloadModules

protected void checkPreloadModules (TestInformation testInfo, 
                DeviceDescriptor deviceDescriptor)

查看預先載入模組資訊

參數
testInfo TestInformation:測試資訊

deviceDescriptor DeviceDescriptor

擲回
DeviceNotAvailableException 如果裝置不可用,則擲回例外狀況
TargetSetupError 如果沒有預先載入的模組,則會擲回例外狀況

getApkDirectory

protected String[] getApkDirectory (ITestDevice device, 
                String packageName)

取得系統目錄下的 APK 檔案路徑

參數
device ITestDevice

packageName String:模組套件名稱

傳回
String[] 含有 APK 名稱和路徑的字串陣列

擲回
DeviceNotAvailableException 如無法使用裝置
TargetSetupError 如果找不到套件的路徑

getPackageVersioncode

protected String getPackageVersioncode (ITestDevice device, 
                String packageName, 
                boolean isAPK)

在推送的模組中檢查套件版本 (套件名稱)。

參數
packageName String:已推送的套件名稱

isAPK boolean

傳回
String

擲回
DeviceNotAvailableException 如果找不到裝置,就會擲回例外狀況。

pushFile

protected ModuleOemTargetPreparer.ModuleInfo pushFile (File moduleFile, 
                TestInformation testInfo)

將檔案推送至 /system/apex/ (針對 Apex) 或 /system/** (針對 APK)

參數
moduleFile File:模組檔案

testInfo TestInformation:叫用作業的 TestInformation

傳回
ModuleOemTargetPreparer.ModuleInfo

擲回
TargetSetupError 如果無法透過 ADB 推送檔案
DeviceNotAvailableException 如果裝置無法使用

renameFile

protected String renameFile (ITestDevice device, 
                File moduleFile, 
                String packageName)

將要更新的檔案名稱重新命名為 /system 下的相同名稱。

參數
device ITestDevice:測試裝置

moduleFile File:要安裝的模組檔案

packageName String:/system/* 下的名稱

傳回
String 重新命名後的新檔案名稱

擲回
TargetSetupError 如果無法重新命名檔案
DeviceNotAvailableException

setupDevice

protected void setupDevice (TestInformation testInfo)

在 /system 下推送檔案前,先使用 ADB 取得裝置的 root 權限並重新掛載裝置

參數
testInfo TestInformation:叫用作業的 TestInformation

擲回
TargetSetupError 如果裝置無法重新掛載。
DeviceNotAvailableException