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)

สร้างอิมเมจ GKI system_dlkm หากมีที่เก็บถาวร system_dlkm

File extractSystemDlkmTarGzip(File systemDlkmArchive)

แตกไฟล์ system_dlkm tar gzip ลงในโฟลเดอร์ system_dlkm_staging

void flattenSystemDlkm(ITestDevice device, File systemDlkmStagingDir)

ทำให้ไดเรกทอรีการจัดเตรียม system_dlkm แบนราบเพื่อให้โมดูลเคอร์เนลทั้งหมดอยู่ภายใต้ /lib/modules โดยตรง

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 หากไม่มี boot.img ของ GKI ที่ถูกต้อง

วิธีการที่ได้รับการป้องกัน

addHashFooter

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

ตรวจสอบว่าอิมเมจบูต GKI เป็นไปตามที่คาดไว้ ส่งข้อยกเว้นหากไม่มี boot.img ที่ถูกต้อง

พารามิเตอร์
device ITestDevice: ITestDevice

buildInfo IBuildInfo: IBuildInfo ข้อมูลบิลด์

tmpDir File: ไดเรกทอรีชั่วคราว File

ส่ง
TargetSetupError หากไม่มี boot.img ของ GKI ที่ถูกต้อง
DeviceNotAvailableException

buildGkiSystemDlkmImg

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

สร้างอิมเมจ GKI system_dlkm หากมีที่เก็บถาวร 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 ฟังก์ชันนี้เป็น Wrapper รอบ ERROR(/TarUtil.extractTarGzipToTemp) เพื่อจำลองการแตกไฟล์สำหรับ การทำ Unit Test

พารามิเตอร์
systemDlkmArchive File: ไฟล์ tar gzip ของ system_dlkm ที่มีโมดูล GKI

การคืนสินค้า
File ไฟล์ที่มีเนื้อหา tar gzip ของ system_dlkm

ส่ง
java.io.IOException
IOException

flattenSystemDlkm

protected void flattenSystemDlkm (ITestDevice device, 
                File systemDlkmStagingDir)

ทำให้ไดเรกทอรีการจัดเตรียม system_dlkm แบนราบเพื่อให้โมดูลเคอร์เนลทั้งหมดอยู่ภายใต้ /lib/modules โดยตรง ซึ่งจำเป็นต่อการจับคู่เลย์เอาต์ไฟล์ system_dlkm ที่คาดไว้สำหรับบิลด์แพลตฟอร์ม

พารามิเตอร์
device ITestDevice: ITestDevice

systemDlkmStagingDir File: ไดเรกทอรีการจัดเตรียม system_dlkm File

ส่ง
IOException หรือ TargetSetupError หากมีข้อผิดพลาดในการทำให้ system_dlkm แบน
TargetSetupError

getDeviceKernelVersion

protected String[] getDeviceKernelVersion (ITestDevice device)

รับเวอร์ชันเคอร์เนลของอุปกรณ์จากอุปกรณ์ก่อนแฟลช

พารามิเตอร์
device ITestDevice: ITestDevice ที่ใช้รับเวอร์ชันเคอร์เนล

การคืนสินค้า
String[] ERROR(/String[]) ที่มีข้อมูลเวอร์ชันเคอร์เนลที่แยกวิเคราะห์แล้ว: [kernelVersion, patchLevel, pageSize] แสดงผล 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: File ไปยังไฟล์อิมเมจบูต (เช่น boot.img)

การคืนสินค้า
String[] ERROR(/String[]) ที่มีข้อมูลเวอร์ชันเคอร์เนลที่แยกวิเคราะห์แล้ว: [kernelVersion, patchLevel, pageSize] แสดงผล 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 หากไม่มี boot.img ของ GKI ที่ถูกต้อง

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 หากไม่มี boot.img ของ GKI ที่ถูกต้อง
DeviceNotAvailableException