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)

adb root และมาунтอุปกรณ์อีกครั้งก่อนพุชไฟล์ใน /system

ตัวสร้างแบบสาธารณะ

ModuleOemTargetPreparer

public ModuleOemTargetPreparer ()

เมธอดสาธารณะ

checkModuleAfterPush

public void checkModuleAfterPush (ITestDevice device, 
                 pushedModules)

ตรวจสอบชื่อโมดูลและรหัสเวอร์ชันหลังจากพุช

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

pushedModules : รายการโมดูลที่พุช

การโยน
TargetSetupError throw exception if no module pushed
DeviceNotAvailableException throw exception if no device available

setUp

public void setUp (TestInformation testInfo)

ตั้งค่าเป้าหมายสําหรับการทดสอบ พุชโมดูลเพื่อแทนที่โมดูลที่โหลดล่วงหน้า

พารามิเตอร์
testInfo TestInformation: TestInformation ของการเรียกใช้

การโยน
TargetSetupError if fatal error occurred setting up environment
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 if cannot find the path of the package

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)

adb root และมาунтอุปกรณ์อีกครั้งก่อนพุชไฟล์ใน /system

พารามิเตอร์
testInfo TestInformation: TestInformation สำหรับการเรียกใช้

การโยน
TargetSetupError หากอุปกรณ์ไม่มาเทรดอีกครั้ง
DeviceNotAvailableException