GkiDeviceFlashPreparer

public class GkiDeviceFlashPreparer
extends BaseTargetPreparer implements ILabPreparer

java.lang.Object
   ↳ com.android.tradefed.targetprep.BaseTargetPreparer
     ↳ com.android.tradefed.targetprep.GkiDeviceFlashPreparer


Một trình chuẩn bị mục tiêu sẽ flash thiết bị bằng hình ảnh chung của nhân chung Android. Vui lòng truy cập https://source.android.com/devices/architecture/kernel/android-common để biết thông tin chi tiết.

Tóm tắt

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

GkiDeviceFlashPreparer()

Phương thức công khai

void setUp(TestInformation testInfo)

Thực hiện quy trình thiết lập mục tiêu để kiểm thử.

void validateGkiBootImg(ITestDevice device, IBuildInfo buildInfo)

Xác thực hình ảnh khởi động GKI theo dự kiến.

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

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

Xác thực hình ảnh khởi động GKI theo dự kiến.

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

Tạo hình ảnh system_dlkm GKI nếu bạn cung cấp kho lưu trữ system_dlkm.

File extractSystemDlkmTarGzip(File systemDlkmArchive)

Giải nén tệp system_dlkm tar gzip vào thư mục system_dlkm_staging.

void flattenSystemDlkm(ITestDevice device, File systemDlkmStagingDir)

Làm phẳng thư mục dàn dựng system_dlkm để tất cả các mô-đun kernel đều nằm ngay trong /lib/modules.

String[] getDeviceKernelVersion(ITestDevice device)

Lấy phiên bản kernel thiết bị từ thiết bị trước khi cài đặt ROM.

IHostOptions getHostOptions()

Tạo một tham chiếu đến IHostOptions

String[] getKernelVersionFromImage(File image)

Trích xuất phiên bản kernel từ tệp hình ảnh boot/vendor_boot/system_dlkm/vendor_dlkm.

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

Lấy tệp được yêu cầu từ tệp nguồn (zip hoặc thư mục) theo tên tệp được yêu cầu.

IRunUtil getRunUtil()

Lấy thực thể IRunUtil để sử dụng.

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

Xác thực hình ảnh khởi động GKI theo dự kiến.

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

Xác thực các phiên bản hạt nhân trong hình ảnh như dự kiến.

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

GkiDeviceFlashPreparer

public GkiDeviceFlashPreparer ()

Phương thức công khai

setUp

public void setUp (TestInformation testInfo)

Thực hiện quy trình thiết lập mục tiêu để kiểm thử.

Tham số
testInfo TestInformation: TestInformation của lời gọi.

Gửi
BuildError
DeviceNotAvailableException
TargetSetupError

validateGkiBootImg

public void validateGkiBootImg (ITestDevice device, 
                IBuildInfo buildInfo)

Xác thực hình ảnh khởi động GKI theo dự kiến. (Không dùng nữa. Vui lòng gọi bằng tmpDir đã cung cấp)

Tham số
device ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo thông tin bản dựng

Gửi
TargetSetupError nếu không có boot.img gki hợp lệ

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

addHashFooter

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

Xác thực hình ảnh khởi động GKI theo dự kiến. Phát sinh ngoại lệ nếu không có boot.img hợp lệ.

Tham số
device ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo thông tin bản dựng

tmpDir File: thư mục tạm thời File

Gửi
TargetSetupError nếu không có boot.img gki hợp lệ
DeviceNotAvailableException

buildGkiSystemDlkmImg

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

Tạo hình ảnh system_dlkm GKI nếu bạn cung cấp kho lưu trữ system_dlkm.

Tham số
device ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo thông tin bản dựng

tmpDir File: thư mục tạm thời File

Gửi
TargetSetupError nếu có lỗi xảy ra khi tạo tệp hình ảnh.

extractSystemDlkmTarGzip

protected File extractSystemDlkmTarGzip (File systemDlkmArchive)

Giải nén tệp system_dlkm tar gzip vào thư mục system_dlkm_staging. Hàm này là một trình bao bọc xung quanh ERROR(/TarUtil.extractTarGzipToTemp) để tạo ra các phương thức giả cho việc kiểm thử đơn vị.

Tham số
systemDlkmArchive File: tệp gzip system_dlkm tar chứa các mô-đun GKI.

Giá trị trả về
File Tệp chứa nội dung gzip tar system_dlkm.

Gửi
java.io.IOException
IOException

flattenSystemDlkm

protected void flattenSystemDlkm (ITestDevice device, 
                File systemDlkmStagingDir)

Làm phẳng thư mục dàn dựng system_dlkm để tất cả các mô-đun kernel đều nằm ngay trong /lib/modules. Điều này là cần thiết để khớp với bố cục tệp system_dlkm dự kiến cho các bản dựng nền tảng.

Tham số
device ITestDevice: ITestDevice

systemDlkmStagingDir File: thư mục dàn dựng system_dlkm File

Gửi
IOException hoặc TargetSetupError nếu có lỗi khi làm phẳng system_dlkm.
TargetSetupError

getDeviceKernelVersion

protected String[] getDeviceKernelVersion (ITestDevice device)

Lấy phiên bản kernel thiết bị từ thiết bị trước khi cài đặt ROM.

Tham số
device ITestDevice: ITestDevice để lấy phiên bản kernel.

Giá trị trả về
String[] Một ERROR(/String[]) chứa thông tin phiên bản kernel đã phân tích cú pháp: [kernelVersion, patchLevel, pageSize]. Trả về giá trị rỗng nếu không phân tích cú pháp được chuỗi phiên bản.2

Gửi
DeviceNotAvailableException

getHostOptions

protected IHostOptions getHostOptions ()

Tạo một tham chiếu đến IHostOptions

Giá trị trả về
IHostOptions IHostOptions để sử dụng

getKernelVersionFromImage

protected String[] getKernelVersionFromImage (File image)

Trích xuất phiên bản kernel từ tệp hình ảnh boot/vendor_boot/system_dlkm/vendor_dlkm. Phương thức này đọc tệp hình ảnh boot/vendor_boot/system_dlkm/vendor_dlkm và tìm kiếm một mẫu cụ thể trong các chuỗi phiên bản kernel Android. Sau đó, tập lệnh này sẽ phân tích cú pháp chuỗi tìm được để trích xuất phiên bản kernel ở định dạng chuẩn hoá.

Tham số
image File: File đến tệp hình ảnh khởi động (ví dụ: boot.img).

Giá trị trả về
String[] Một ERROR(/String[]) chứa thông tin phiên bản kernel đã phân tích cú pháp: [kernelVersion, patchLevel, pageSize]. Trả về giá trị rỗng nếu không phân tích cú pháp được chuỗi phiên bản.

getRequestedFile

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

Lấy tệp được yêu cầu từ tệp nguồn (zip hoặc thư mục) theo tên tệp được yêu cầu.

Tệp nguồn được cung cấp có thể là tệp zip. Phương thức này sẽ giải nén tệp đó vào thư mục tạm thời và tìm tệp được yêu cầu theo tên tệp được cung cấp.

Tệp nguồn bạn cung cấp có thể là một thư mục tệp. Phương thức này sẽ tìm tệp được yêu cầu theo tên tệp được cung cấp.

Tham số
device ITestDevice: ITestDevice

requestedFileName String: tên tệp được yêu cầu ở dạng chuỗi

sourceFile File: tệp nguồn

tmpDir File

Giá trị trả về
File tệp được chỉ định theo tên tệp được yêu cầu

Gửi
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

getRunUtil

protected IRunUtil getRunUtil ()

Lấy thực thể IRunUtil để sử dụng.

Giá trị trả về
IRunUtil IRunUtil để sử dụng

parseKernelVersion

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

Tham số
source String

kernelVersionString String

Giá trị trả về
String[]

validateGkiBootImg

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

Xác thực hình ảnh khởi động GKI theo dự kiến. Phát sinh ngoại lệ nếu không có boot.img hợp lệ.

Tham số
device ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo thông tin bản dựng

tmpDir File: thư mục tạm thời File

Gửi
TargetSetupError nếu không có boot.img gki hợp lệ

validateKernelCompatibility

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

Tham số
imageName String

imageVersion String

bootVersion String

device ITestDevice

Gửi
TargetSetupError

validateKernelVersion

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

Xác thực các phiên bản hạt nhân trong hình ảnh như dự kiến. Phát sinh ngoại lệ nếu không hợp lệ.

Tham số
device ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo thông tin bản dựng

tmpDir File: thư mục tạm thời File

Gửi
TargetSetupError nếu không có boot.img gki hợp lệ
DeviceNotAvailableException