Cài đặtApexModuleTargetPreparer
public class InstallApexModuleTargetPreparer
extends SuiteApkInstaller
Các lớp con trực tiếp đã biết |
Bản tóm tắt
Phương pháp được bảo vệ |
---|
void | addApksToTestFiles () |
| collectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo) collectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo) Thu thập thông tin đỉnh từ các mô-đun đỉnh để kiểm tra kích hoạt. |
boolean | containsPersistentApk ( testAppFileNames, TestInformation testInfo) containsPersistentApk ( testAppFileNames, TestInformation testInfo) Kiểm tra xem các tệp đầu vào có chứa bất kỳ apk liên tục nào không. |
| getApkInstalled () |
String | getBundletoolFileName () |
BundletoolUtil | getBundletoolUtil () |
String | getModuleKeywordFromApexPackageName (String packageName) Lấy từ khóa (ví dụ: 'tzdata' cho com.android.tzdata.apex) từ tên gói apex. |
| getModulesFailToActivate ( activatedApexes) 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 tách cho các gói ứng dụng được chỉ định. |
void | initBundletoolUtil (TestInformation testInfo) Khởi tạo tiện ích Bundletool cho lớp này. |
void | installTrain (TestInformation testInfo, moduleFilenames, String[] extraArgs) installTrain (TestInformation testInfo, moduleFilenames, String[] extraArgs) Cố gắng cài đặt một đoàn tàu chính có chứa đỉnh trên thiết bị. |
void | installUsingBundleTool (TestInformation testInfo, testAppFileNames) installUsingBundleTool (TestInformation testInfo, testAppFileNames) Cố gắng cài đặt (các) mô-đun đường chính bằng cách sử dụng Bundletool. |
void | installer (TestInformation testInfo, testAppFileNames) installer (TestInformation testInfo, testAppFileNames) Cố gắng cài đặt gói hoặc gói chia nhỏ trên thiết bị. |
boolean | isPersistentApk (File filename, TestInformation testInfo) Kiểm tra xem apk có phải là apk liên tục hay không. |
ITestDevice.ApexInfo | retrieveApexInfo (File testApexFile, DeviceDescriptor deviceDescriptor) Truy xuất ApexInfo chứa packageName và versionCode từ tệp apex đã cho. |
Lĩnh vực
APEX_SUFFIX
protected static final String APEX_SUFFIX
APK_SUFFIX
protected static final String APK_SUFFIX
SPLIT_APKS_SUFFIX
protected static final String SPLIT_APKS_SUFFIX
Nhà thầu xây dựng công cộng
Cài đặtApexModuleTargetPreparer
public InstallApexModuleTargetPreparer ()
Phương pháp công cộng
public getModulesToInstall (TestInformation testInfo)
Lấy các mô-đun cần được cài đặt trên tàu, dựa trên các mô-đun được tải sẵn trên thiết bị. Các mô-đun không được tải sẵn sẽ không được cài đặt.
Trả lại |
---|
| Danh sách trong số các mô-đun sẽ được cài đặt trên thiết bị. |
Ném |
---|
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 thể cài đặt mô-đun. |
setIgnoreIfNotPreloaded
public void setIgnoreIfNotPreloaded (boolean skip)
setSkipApexTearDown
public void setSkipApexTearDown (boolean skip)
public void setUp (TestInformation testInfo)
Thông số |
---|
testInfo | TestInformation |
Ném |
---|
BuildError | |
DeviceNotAvailableException | |
TargetSetupError | |
public void tearDown (TestInformation testInfo,
Throwable e)
Thông số |
---|
testInfo | TestInformation |
e | Throwable |
Ném |
---|
DeviceNotAvailableException | |
Phương pháp được bảo vệ
addApksToTestFiles
protected void addApksToTestFiles ()
protected collectApexInfoFromApexModules ( testAppFileNames,
TestInformation testInfo)
Thu thập thông tin đỉnh từ các mô-đun đỉnh để kiểm tra kích hoạt.
Thông số |
---|
testAppFileNames | : Danh sách tên file của các module cần cài đặt |
testInfo | TestInformation : TestInformation |
Trả lại |
---|
| một danh sách chứa thông tin apex của các mô-đun apex trong danh sách tệp đầu vào |
protected boolean containsPersistentApk ( testAppFileNames,
TestInformation testInfo)
Kiểm tra xem các tệp đầu vào có chứa bất kỳ apk liên tục nào không.
Thông số |
---|
testAppFileNames | : Danh sách tên file của các module cần cài đặt |
testInfo | TestInformation : TestInformation |
Trả lại |
---|
boolean | true nếu tệp đầu vào chứa mô-đun apk liên tục. |
Ném |
---|
DeviceNotAvailableException | |
TargetSetupError | |
getApkĐã cài đặt
protected getApkInstalled ()
protected String getBundletoolFileName ()
getModuleKeywordFromApexPackageName
protected String getModuleKeywordFromApexPackageName (String packageName)
Lấy từ khóa (ví dụ: 'tzdata' cho com.android.tzdata.apex) từ tên gói apex.
Thông số |
---|
packageName | String : Tên gói của tệp apex. |
Trả lại |
---|
String | a string Từ khóa của tên gói apex. |
getModulesFailToActivate
protected getModulesFailToActivate ( activatedApexes)
Nhận các mô-đun không kích hoạt được.
Thông số |
---|
activatedApexes | : Tập hợp các đỉnh hoạt động trên thiết bị |
Trả lại |
---|
| một danh sách chứa thông tin đỉnh của các mô-đun đỉnh đầu vào không được kích hoạt. |
Ném |
---|
DeviceNotAvailableException | |
TargetSetupError | |
protected getSplitsForApks (TestInformation testInfo,
File moduleFile)
Trích xuất và trả về các phần tách cho các gói ứng dụng được chỉ định.
Thông số |
---|
testInfo | TestInformation : TestInformation |
moduleFile | File : Tệp mô-đun để trích xuất các phần tách từ đó. |
Trả lại |
---|
| một Tệp [] chứa các phần tách. |
Ném |
---|
TargetSetupError | nếu không tìm thấy Bundletool hoặc tệp thông số thiết bị không tạo được. |
protected void initBundletoolUtil (TestInformation testInfo)
Khởi tạo tiện ích Bundletool cho lớp này.
Ném |
---|
TargetSetupError | nếu không tìm thấy Bundletool. |
protected void installTrain (TestInformation testInfo,
moduleFilenames,
String[] extraArgs)
Cố gắng cài đặt một đoàn tàu chính có chứa đỉnh trên thiết bị.
Thông số |
---|
testInfo | TestInformation : TestInformation |
moduleFilenames | : Danh sách chuỗi. Danh sách tên tệp của các mô-đun đường chính sẽ được cài đặt. |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
TargetSetupError | |
protected void installUsingBundleTool (TestInformation testInfo,
testAppFileNames)
Cố gắng cài đặt (các) mô-đun đường chính bằng cách sử dụng Bundletool.
Thông số |
---|
testInfo | TestInformation : TestInformation |
testAppFileNames | : tên tệp của các mô-đun được tải sẵn để cài đặt. |
Ném |
---|
DeviceNotAvailableException | |
TargetSetupError | |
protected void installer (TestInformation testInfo,
testAppFileNames)
Cố gắng cài đặt gói hoặc gói chia nhỏ trên thiết bị.
Thông số |
---|
testInfo | TestInformation : TestInformation cho lệnh gọi |
testAppFileNames | : Các gói ứng dụng và gói của chúng sẽ được cài đặt. |
Ném |
---|
DeviceNotAvailableException | |
TargetSetupError | |
protected boolean isPersistentApk (File filename,
TestInformation testInfo)
Kiểm tra xem apk có phải là apk liên tục hay không.
Thông số |
---|
filename | File : Tệp mô-đun apk để kiểm tra |
testInfo | TestInformation : TestInformation |
Trả lại |
---|
boolean | true nếu đây là mô-đun apk liên tục. |
Ném |
---|
DeviceNotAvailableException | |
TargetSetupError | |
truy xuấtApexInfo
protected ITestDevice.ApexInfo retrieveApexInfo (File testApexFile,
DeviceDescriptor deviceDescriptor)
Truy xuất ApexInfo chứa packageName và versionCode từ tệp apex đã cho.
Thông số |
---|
testApexFile | File : Tệp đỉnh mà chúng tôi lấy thông tin từ đó. |
deviceDescriptor | DeviceDescriptor |
Trả lại |
---|
ITestDevice.ApexInfo | một ApexInfo chứa tên gói và mã phiên bản của tệp đã cho |
Ném |
---|
TargetSetupError | nếu trình phân tích cú pháp aapt không phân tích được tệp. |