InstallApexModuleTargetPreparer

public class InstallApexModuleTargetPreparer
extends SuiteApkInstaller

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


Tóm tắt

Hằng số

String APEX_OPTION

String APEX_SUFFIX

String APK_SUFFIX

String APK_ZIP_OPTION

String CHILD_SESSION_CREATION_CMD

String PARENT_SESSION_CREATION_CMD

String ROLLBACK_STATE_COMMITTED

String ROLLBACK_STATE_UNKNOWN

String SPLIT_APKS_SUFFIX

Trường

protected File mTrainFolderPath

Hàm khởi tạo công khai

InstallApexModuleTargetPreparer()

Phương thức công khai

getModulesToInstall(TestInformation testInfo)

Lấy các mô-đun cần được cài đặt trên chuyến tàu, dựa trên các mô-đun được tải sẵn trên thiết bị.

void setIgnoreIfNotPreloaded(boolean skip)
void setSkipApexTearDown(boolean skip)
void setUp(TestInformation testInfo)

void tearDown(TestInformation testInfo, Throwable e)

Phương thức được bảo vệ

void addApksToTestFiles()
void addStagedReadyTimeoutForAdb( cmd)
void addTimeoutMillisForBundletool( extraArgs)
void checkApexActivation(ITestDevice device)

Kiểm tra xem tất cả các đỉnh có được kích hoạt hay không.

collectApexInfoFromApexModules( testAppFileNames, TestInformation testInfo)

Thu thập thông tin apex từ các mô-đun apex để kiểm tra việc kích hoạt.

getApkInstalled()
String getBundletoolFileName()
BundletoolUtil getBundletoolUtil()
String getModuleKeywordFromApexPackageName(String packageName)

Lấy từ khoá (ví dụ: "tzdata" cho com.android.tzdata.apex) từ tên gói apex.

getModulesFailToActivate( activatedApexes)

Nhận các mô-đun không kích hoạt được.

getSplitsForApks(TestInformation testInfo, File moduleFile)

Trích xuất và trả về các phần chia cho các tệp apk đã chỉ định.

void initBundletoolUtil(TestInformation testInfo)

Khởi chạy tiện ích bundletool cho lớp này.

void installTrain(TestInformation testInfo, moduleFilenames)

Cố gắng cài đặt một bản phát hành chính chứa apex trên thiết bị.

void installUsingBundleTool(TestInformation testInfo, testAppFileNames)

Cố gắng cài đặt(các) mô-đun chính bằng bundletool.

void installer(TestInformation testInfo, testAppFileNames)

Thử cài đặt một gói hoặc gói chia tách trên thiết bị.

ITestDevice.ApexInfo retrieveApexInfo(File testApexFile, DeviceDescriptor deviceDescriptor)

Truy xuất ApexInfo chứa packageName và versionCode từ tệp apex đã cho.

Hằng số

APEX_OPTION

protected static final String APEX_OPTION

Giá trị không đổi: "--apex"

APEX_SUFFIX

protected static final String APEX_SUFFIX

Giá trị không đổi: ".apex"

APK_SUFFIX

protected static final String APK_SUFFIX

Giá trị không đổi: ".apk"

APK_ZIP_OPTION

protected static final String APK_ZIP_OPTION

Giá trị không đổi: "--apks-zip"

CHILD_SESSION_CREATION_CMD

protected static final String CHILD_SESSION_CREATION_CMD

Giá trị không đổi: "pm install-create"

PARENT_SESSION_CREATION_CMD

protected static final String PARENT_SESSION_CREATION_CMD

Giá trị không đổi: "pm install-create --multi-package"

ROLLBACK_STATE_COMMITTED

public static final String ROLLBACK_STATE_COMMITTED

Giá trị không đổi: "committed"

ROLLBACK_STATE_UNKNOWN

public static final String ROLLBACK_STATE_UNKNOWN

Giá trị không đổi: "unknown"

SPLIT_APKS_SUFFIX

protected static final String SPLIT_APKS_SUFFIX

Giá trị không đổi: ".apks"

Trường

mTrainFolderPath

protected File mTrainFolderPath

Hàm khởi tạo công khai

InstallApexModuleTargetPreparer

public InstallApexModuleTargetPreparer ()

Phương thức công khai

getModulesToInstall

public  getModulesToInstall (TestInformation testInfo)

Lấy các mô-đun cần được cài đặt trên chuyến tàu, dựa trên các mô-đun được tải sẵn trên thiết bị. Những mô-đun không được tải sẵn sẽ không được cài đặt.

Tham số
testInfo TestInformation: TestInformation

Giá trị trả về
List gồm các mô-đun cần được cài đặt trên thiết bị.

Gửi
DeviceNotAvailableException khi thiết bị không có sẵn.
TargetSetupError khi các mô-đun bắt buộc chưa được cài đặt hoặc không cài đặt được mô-đun.

setIgnoreIfNotPreloaded

public void setIgnoreIfNotPreloaded (boolean skip)

Tham số
skip boolean

setSkipApexTearDown

public void setSkipApexTearDown (boolean skip)

Tham số
skip boolean

setUp

public void setUp (TestInformation testInfo)

Tham số
testInfo TestInformation

Gửi
BuildError
DeviceNotAvailableException
TargetSetupError

tearDown

public void tearDown (TestInformation testInfo, 
                Throwable e)

Tham số
testInfo TestInformation

e Throwable

Gửi
DeviceNotAvailableException
DeviceRuntimeException

Phương thức được bảo vệ

addApksToTestFiles

protected void addApksToTestFiles ()

addStagedReadyTimeoutForAdb

protected void addStagedReadyTimeoutForAdb ( cmd)

Tham số
cmd

addTimeoutMillisForBundletool

protected void addTimeoutMillisForBundletool ( extraArgs)

Tham số
extraArgs

checkApexActivation

protected void checkApexActivation (ITestDevice device)

Kiểm tra xem tất cả các đỉnh có được kích hoạt hay không.

Tham số
device ITestDevice: đang được kiểm thử.

Gửi
TargetSetupError nếu không kích hoạt được.
DeviceNotAvailableException

collectApexInfoFromApexModules

protected  collectApexInfoFromApexModules ( testAppFileNames, 
                TestInformation testInfo)

Thu thập thông tin apex từ các mô-đun apex để kiểm tra việc kích hoạt.

Tham số
testAppFileNames : Danh sách tên tệp của các mô-đun cần cài đặt

testInfo TestInformation: TestInformation

Giá trị trả về
một danh sách chứa apexinfo của các mô-đun apex trong danh sách tệp đầu vào

Gửi
TargetSetupError

getApkInstalled

protected  getApkInstalled ()

Giá trị trả về

getBundletoolFileName

protected String getBundletoolFileName ()

Giá trị trả về
String

getBundletoolUtil

protected BundletoolUtil getBundletoolUtil ()

Giá trị trả về
BundletoolUtil

getModuleKeywordFromApexPackageName

protected String getModuleKeywordFromApexPackageName (String packageName)

Lấy từ khoá (ví dụ: "tzdata" cho com.android.tzdata.apex) từ tên gói apex.

Tham số
packageName String: Tên gói của tệp apex.

Giá trị trả về
String một chuỗi Từ khoá của tên gói apex.

getModulesFailToActivate

protected  getModulesFailToActivate ( activatedApexes)

Nhận các mô-đun không kích hoạt được.

Tham số
activatedApexes : Tập hợp các apex đang hoạt động trên thiết bị

Giá trị trả về
một danh sách chứa apexinfo của các mô-đun apex đầu vào không kích hoạt được.

Gửi
DeviceNotAvailableException
TargetSetupError

getSplitsForApks

protected  getSplitsForApks (TestInformation testInfo, 
                File moduleFile)

Trích xuất và trả về các phần chia cho các tệp apk đã chỉ định.

Tham số
testInfo TestInformation: TestInformation

moduleFile File: Tệp mô-đun để trích xuất các phần phân tách.

Giá trị trả về
File[] chứa các phần chia nhỏ.

Gửi
TargetSetupError nếu không tìm thấy bundletool hoặc không tạo được tệp thông số kỹ thuật của thiết bị.

initBundletoolUtil

protected void initBundletoolUtil (TestInformation testInfo)

Khởi chạy tiện ích bundletool cho lớp này.

Tham số
testInfo TestInformation: TestInformation cho lệnh gọi.

Gửi
TargetSetupError nếu không tìm thấy bundletool.

installTrain

protected void installTrain (TestInformation testInfo, 
                 moduleFilenames)

Cố gắng cài đặt một bản phát hành chính chứa apex trên thiết bị.

Tham số
testInfo TestInformation: TestInformation

moduleFilenames : Danh sách chuỗi. Danh sách tên tệp của các mô-đun chính cần cài đặt.

Gửi
DeviceNotAvailableException
TargetSetupError

installUsingBundleTool

protected void installUsingBundleTool (TestInformation testInfo, 
                 testAppFileNames)

Cố gắng cài đặt(các) mô-đun chính bằng bundletool.

Tham số
testInfo TestInformation: TestInformation

testAppFileNames : tên tệp của các mô-đun được tải sẵn để cài đặt.

Gửi
DeviceNotAvailableException
TargetSetupError

trình cài đặt

protected void installer (TestInformation testInfo, 
                 testAppFileNames)

Thử cài đặt một gói hoặc gói chia tách trên thiết bị.

Tham số
testInfo TestInformation: TestInformation cho lệnh gọi

testAppFileNames : Các tệp APK và gói cần cài đặt.

Gửi
DeviceNotAvailableException
TargetSetupError

retrieveApexInfo

protected ITestDevice.ApexInfo retrieveApexInfo (File testApexFile, 
                DeviceDescriptor deviceDescriptor)

Truy xuất ApexInfo chứa packageName và versionCode từ tệp apex đã cho.

Tham số
testApexFile File: Tệp apex mà chúng ta truy xuất thông tin.

deviceDescriptor DeviceDescriptor

Giá trị trả về
ITestDevice.ApexInfo ApexInfo chứa packageName và versionCode của tệp đã cho

Gửi
TargetSetupError nếu trình phân tích cú pháp aapt không phân tích cú pháp được tệp.