INativeDevice

public interface INativeDevice

com.android.tradefed.device.INativeDevice


ให้ API ระดับที่เชื่อถือได้และสูงกว่าเล็กน้อยแก่ ddmlib IDevice

ลองคำสั่งอุปกรณ์ตามจำนวนที่กำหนดได้ และจัดเตรียมอินเทอร์เฟซการกู้คืนอุปกรณ์สำหรับอุปกรณ์ที่ไม่ตอบสนอง

สรุป

ค่าคงที่

int UNKNOWN_API_LEVEL

ค่าเริ่มต้นเมื่อตรวจไม่พบระดับ API

วิธีการสาธารณะ

abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

ตรวจสอบว่าคุณลักษณะใดรองรับหรือไม่โดยพิจารณาจากระดับที่รองรับน้อยที่สุด

abstract void clearLogcat ()

ลบข้อมูล logcat ที่สะสมไว้

abstract void deleteFile (String deviceFilePath)

วิธีตัวช่วยลบไฟล์หรือไดเรกทอรีในเครื่อง

abstract boolean deviceSoftRestarted ( ProcessInfo prevSystemServerProcess)

วิธีตัวช่วยเพื่อตรวจสอบว่าอุปกรณ์รีสตาร์ทอย่างนุ่มนวลหรือไม่โดยเปรียบเทียบ system_server ปัจจุบันกับ system_server ProcessInfo ก่อนหน้า

abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)

วิธีการช่วยเหลือเพื่อตรวจสอบว่าอุปกรณ์รีสตาร์ทอย่างนุ่มนวลตั้งแต่เวลา UTC ตั้งแต่ epoch จากอุปกรณ์และ ERROR(/TimeUnit)

abstract boolean disableAdbRoot ()

ปิด adb root

abstract boolean doesFileExist (String deviceFilePath)

วิธีการช่วยเหลือเพื่อตรวจสอบว่ามีไฟล์บนอุปกรณ์อยู่หรือไม่

abstract boolean enableAdbRoot ()

เปิด adb root

abstract String executeAdbCommand (long timeout, String... commandArgs)

วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง adb เป็นคำสั่งระบบที่มีการหมดเวลาที่ระบุ

abstract String executeAdbCommand (String... commandArgs)

เมธอด Helper ซึ่งเรียกใช้คำสั่ง adb เป็นคำสั่งระบบ

abstract String executeAdbCommand (long timeout, envMap, String... commandArgs) executeAdbCommand (long timeout, envMap, String... commandArgs)

วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง adb เป็นคำสั่งระบบที่มีการหมดเวลาที่ระบุ

abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)

วิธีตัวช่วยที่รันคำสั่ง fastboot เป็นคำสั่งระบบ

abstract CommandResult executeFastbootCommand (String... commandArgs)

วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง fastboot เป็นคำสั่งระบบโดยมีการหมดเวลาเริ่มต้น 2 นาที

abstract CommandResult executeLongFastbootCommand (String... commandArgs)

เมธอด Helper ซึ่งเรียกใช้คำสั่ง fastboot ที่ใช้เวลานานเป็นคำสั่งระบบ

abstract CommandResult executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs)

เมธอด Helper ซึ่งดำเนินการคำสั่ง fastboot ที่รันเป็นเวลานานเป็นคำสั่งระบบพร้อมตัวแปรสภาพแวดล้อมระบบ

abstract String executeShellCommand (String command)

เมธอด Helper ซึ่งรันคำสั่ง adb shell และส่งคืนเอาต์พุตเป็น String

abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

abstract void executeShellCommand (String command, IShellOutputReceiver receiver)

ดำเนินการคำสั่ง adb shell ที่กำหนด ลองใหม่หลายครั้งหากคำสั่งล้มเหลว

abstract CommandResult executeShellV2Command (String command)

เมธอด Helper ซึ่งรันคำสั่ง adb shell และส่งคืนผลลัพธ์เป็น CommandResult ที่บรรจุอย่างถูกต้องด้วยเอาต์พุตสถานะคำสั่ง stdout และ stderr

abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)

เมธอด Helper ซึ่งดำเนินการคำสั่งเชลล์ adb และส่งคืนผลลัพธ์เป็น CommandResult ที่บรรจุอย่างถูกต้องด้วยเอาต์พุตสถานะคำสั่งและ stderr

abstract CommandResult executeShellV2Command (String command, File pipeAsInput)

เมธอด Helper ซึ่งรันคำสั่ง adb shell และส่งคืนผลลัพธ์เป็น CommandResult ที่เติมข้อมูลเอาต์พุตสถานะคำสั่ง stdout และ stderr อย่างเหมาะสม

abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

abstract CommandResult fastbootWipePartition (String partition)

วิธีการช่วยเหลือซึ่งจะล้างพาร์ทิชันสำหรับอุปกรณ์

abstract int getApiLevel ()

รับระดับ API ของอุปกรณ์

abstract String getBasebandVersion ()

วิธีอำนวยความสะดวกในการรับเวอร์ชันเบสแบนด์ (วิทยุ) ของอุปกรณ์นี้

abstract Integer getBattery ()

ส่งกลับระดับแบตเตอรี่ปัจจุบันของอุปกรณ์หรือค่า Null หากไม่มีระดับแบตเตอรี่

abstract boolean getBooleanProperty (String name, boolean defaultValue)

ส่งกลับค่าบูลีนของคุณสมบัติที่กำหนด

abstract getBootHistory ()

วิธีตัวช่วยรวบรวมแผนที่ประวัติการบูตพร้อมเวลาบูตและเหตุผลในการบูต

abstract getBootHistorySince (long utcEpochTime, TimeUnit timeUnit)

เมธอด Helper รวบรวมแมปประวัติการบูตพร้อมเวลาบูตและเหตุผลการบูตตั้งแต่เวลาที่กำหนดตั้งแต่ยุคจากอุปกรณ์และหน่วยเวลาที่ระบุ

abstract String getBootloaderVersion ()

วิธีอำนวยความสะดวกในการรับเวอร์ชัน bootloader ของอุปกรณ์นี้

abstract String getBuildAlias ()

เรียกนามแฝงของบิลด์ที่อุปกรณ์กำลังทำงานอยู่

abstract String getBuildFlavor ()

เรียกรสชาติการสร้างสำหรับอุปกรณ์

abstract String getBuildId ()

ดึงบิลด์ที่อุปกรณ์กำลังทำงานอยู่

abstract String getBuildSigningKeys ()

ส่งกลับประเภทคีย์ที่ใช้เพื่อเซ็นอิมเมจอุปกรณ์

โดยทั่วไปแล้ว อุปกรณ์ Android อาจลงนามด้วยคีย์ทดสอบ (เช่นใน AOSP) หรือคีย์รีลีส (ควบคุมโดยผู้ผลิตอุปกรณ์แต่ละราย)

abstract DeviceDescriptor getCachedDeviceDescriptor ()

ส่งคืน DeviceDescriptor ที่แคชหากอุปกรณ์ได้รับการจัดสรร มิฉะนั้นส่งคืน DeviceDescriptor ปัจจุบัน

abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

ส่งคืน DeviceDescriptor ที่แคชหากอุปกรณ์ได้รับการจัดสรร มิฉะนั้นส่งคืน DeviceDescriptor ปัจจุบัน

abstract String[] getChildren (String deviceFilePath)

ทางเลือกในการใช้ IFileEntry ที่บางครั้งใช้งานไม่ได้เนื่องจากการอนุญาต

abstract AbstractConnection getConnection ()

ส่งกลับการเชื่อมต่อที่เกี่ยวข้องกับอุปกรณ์

abstract String getDeviceClass ()

รับคลาสอุปกรณ์

abstract long getDeviceDate ()

ส่งกลับวันที่ของอุปกรณ์ในหน่วยมิลลิวินาทีตั้งแต่ยุค

abstract DeviceDescriptor getDeviceDescriptor ()

ส่งกลับ DeviceDescriptor จากข้อมูลอุปกรณ์เพื่อรับข้อมูลโดยไม่ต้องผ่านวัตถุอุปกรณ์จริง

abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

ส่งกลับ DeviceDescriptor จากข้อมูลอุปกรณ์เพื่อรับข้อมูลโดยไม่ต้องผ่านวัตถุอุปกรณ์จริง

abstract TestDeviceState getDeviceState ()

รับสถานะของอุปกรณ์

abstract long getDeviceTimeOffset (Date date)

ตัวช่วยในการรับความแตกต่างของเวลาระหว่างอุปกรณ์กับ ERROR(/Date) ที่กำหนด

abstract InputStreamSource getEmulatorOutput ()

รับสตรีมของโปรแกรมจำลอง stdout และ stderr

abstract long getExternalStoreFreeSpace ()

วิธีการช่วยเหลือเพื่อกำหนดจำนวนพื้นที่ว่างบนที่จัดเก็บข้อมูลภายนอกของอุปกรณ์

abstract String getFastbootProductType ()

วิธีอำนวยความสะดวกในการรับประเภทผลิตภัณฑ์ของอุปกรณ์นี้เมื่ออยู่ในโหมด fastboot

abstract String getFastbootProductVariant ()

วิธีอำนวยความสะดวกในการรับประเภทผลิตภัณฑ์ของอุปกรณ์นี้เมื่ออยู่ในโหมด fastboot

abstract String getFastbootSerialNumber ()

ส่งกลับหมายเลขซีเรียลของโหมด fastboot

abstract String getFastbootVariable (String variableName)

ดึงค่าตัวแปร fastboot ที่กำหนดจากอุปกรณ์

abstract IFileEntry getFileEntry (String path)

เรียกข้อมูลอ้างอิงไปยังไฟล์ระยะไกลบนอุปกรณ์

abstract IDevice getIDevice ()

ส่งกลับการอ้างอิงไปยัง ddmlib IDevice ที่เกี่ยวข้อง

abstract long getIntProperty (String name, long defaultValue)

ส่งกลับค่าจำนวนเต็มของคุณสมบัติที่กำหนดจากอุปกรณ์

abstract long getLastExpectedRebootTimeMillis ()

ส่งคืนเวลาล่าสุดที่ Tradefed API ทริกเกอร์การรีบูตในหน่วยมิลลิวินาทีตั้งแต่ EPOCH ตามที่ส่งคืนโดย System.currentTimeMillis()

abstract int getLaunchApiLevel ()

รับระดับ API ที่เปิดตัวครั้งแรกของอุปกรณ์

abstract InputStreamSource getLogcat ()

คว้าสตรีมภาพรวมของข้อมูล logcat

abstract InputStreamSource getLogcat (int maxBytes)

คว้าสตรีมสแน็ปช็อตของ maxBytes ล่าสุดของข้อมูล logcat ที่จับได้

abstract InputStreamSource getLogcatDump ()

รับการถ่ายโอนข้อมูลของ logcat ปัจจุบันสำหรับอุปกรณ์

abstract InputStreamSource getLogcatSince (long date)

รับสตรีมสแน็ปช็อตของข้อมูล logcat ที่บันทึกโดยเริ่มต้นวันที่ที่ระบุ

abstract String getMountPoint (String mountName)

ส่งกลับจุดเชื่อมต่อ

abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

ส่งคืน MountPointInfo ที่สอดคล้องกับเส้นทางเมาต์พอยต์ที่ระบุ หรือ null หากพาธนั้นไม่มีสิ่งใดเมาต์ หรือมิฉะนั้นจะไม่ปรากฏใน /proc/mounts เป็นจุดเมานท์

abstract getMountPointInfo ()

ส่งคืนข้อมูลที่แยกวิเคราะห์ใน /proc/mounts บนอุปกรณ์

abstract long getPartitionFreeSpace (String partition)

วิธีการช่วยเหลือเพื่อกำหนดจำนวนพื้นที่ว่างบนพาร์ติชันอุปกรณ์

abstract ProcessInfo getProcessByName (String processName)

วิธีการช่วยเหลือเรียกใช้คำสั่ง "pidof" และ "stat" และส่งคืนวัตถุ ProcessInfo ด้วย PID และเวลาเริ่มต้นกระบวนการของกระบวนการที่กำหนด

abstract String getProcessPid (String process)

คืนค่า pid ของบริการหรือค่า null หากเกิดข้อผิดพลาด

abstract String getProductType ()

วิธีอำนวยความสะดวกในการรับประเภทผลิตภัณฑ์ของอุปกรณ์นี้

abstract String getProductVariant ()

วิธีอำนวยความสะดวกในการรับผลิตภัณฑ์ย่อยของอุปกรณ์นี้

abstract String getProperty (String name)

ดึงค่าคุณสมบัติที่กำหนดจากอุปกรณ์

abstract ITestDevice.RecoveryMode getRecoveryMode ()

รับโหมดการกู้คืนปัจจุบันที่ใช้สำหรับอุปกรณ์

abstract String getSerialNumber ()

วิธีที่สะดวกในการรับหมายเลขซีเรียลของอุปกรณ์นี้

abstract getTombstones ()

ดึงและส่งคืนรายการหินหลุมฝังศพจากอุปกรณ์

abstract long getTotalMemory ()

ส่งคืนขนาดหน่วยความจำฟิสิคัลทั้งหมดเป็นไบต์หรือ -1 ในกรณีที่เกิดข้อผิดพลาดภายใน

abstract boolean getUseFastbootErase ()

รับว่าจะใช้การลบ fastboot หรือรูปแบบ fastboot เพื่อล้างพาร์ติชันบนอุปกรณ์

abstract boolean isAdbRoot ()
abstract boolean isAdbTcp ()
abstract boolean isAppEnumerationSupported ()

ตรวจสอบว่าแพลตฟอร์มบนอุปกรณ์รองรับการแจงนับแอปหรือไม่

abstract boolean isBypassLowTargetSdkBlockSupported ()

ตรวจสอบว่าแพลตฟอร์มบนอุปกรณ์รองรับการเลี่ยงผ่านบล็อก sdk เป้าหมายต่ำในการติดตั้งแอปหรือไม่

abstract boolean isDeviceEncrypted ()

ส่งคืนหากอุปกรณ์ได้รับการเข้ารหัส

abstract boolean isDirectory (String deviceFilePath)

คืนค่า True หากพาธบนอุปกรณ์เป็นไดเร็กทอรี หากเป็นเท็จ หากไม่ใช่

abstract boolean isEncryptionSupported ()

ส่งกลับหากอุปกรณ์รองรับการเข้ารหัส

abstract boolean isExecutable (String fullPath)

คืนค่า True หากพาธไฟล์บนอุปกรณ์เป็นไฟล์เรียกทำงาน หากเป็นเท็จ หากไม่เป็นเช่นนั้น

abstract boolean isHeadless ()

คืนค่าจริงหากอุปกรณ์ไม่มีส่วนหัว (ไม่มีหน้าจอ) หากเป็นเท็จมิฉะนั้น

abstract boolean isRuntimePermissionSupported ()

ตรวจสอบว่าแพลตฟอร์มบนอุปกรณ์รองรับการให้สิทธิ์รันไทม์หรือไม่

abstract boolean isStateBootloaderOrFastbootd ()

คืนค่าจริงหากอุปกรณ์อยู่ใน TestDeviceState#FASTBOOT หรือ TestDeviceState.FASTBOOTD

abstract boolean logAnrs ( ITestLogger logger)

รวบรวมและบันทึก ANR จากอุปกรณ์

abstract void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)

บันทึกข้อความใน logcat ของอุปกรณ์

abstract void nonBlockingReboot ()

ออกคำสั่งเพื่อรีบูตอุปกรณ์และส่งคืนเมื่อคำสั่งเสร็จสิ้น และเมื่อ adb มองไม่เห็นอุปกรณ์อีกต่อไป

abstract void postBootSetup ()

ทำตามคำแนะนำเพื่อกำหนดค่าอุปกรณ์สำหรับการทดสอบหลังจากการบู๊ตทุกครั้ง

default void postInvocationTearDown ()

วิธีนี้เลิกใช้แล้ว ใช้ postInvocationTearDown(Throwable) แทน

abstract void postInvocationTearDown (Throwable invocationException)

ขั้นตอนเพิ่มเติมสำหรับการล้างข้อมูลที่จำเป็นเฉพาะอุปกรณ์ซึ่งจะดำเนินการหลังจากการเรียกใช้เสร็จสิ้น

default void preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes)

ขั้นตอนเพิ่มเติมสำหรับการตั้งค่าที่จำเป็นเฉพาะอุปกรณ์ซึ่งจะดำเนินการบนอุปกรณ์ก่อนขั้นตอนการเรียกใช้

abstract boolean pullDir (String deviceFilePath, File localDir)

ดึงเนื้อหาไดเร็กทอรีซ้ำจากอุปกรณ์

abstract File pullFile (String remoteFilePath, int userId)

ดึงไฟล์ออกจากอุปกรณ์ เก็บไว้ในเครื่องชั่วคราว ERROR(/File) และส่งกลับ File นั้น

abstract File pullFile (String remoteFilePath)

ดึงไฟล์ออกจากอุปกรณ์ เก็บไว้ในเครื่องชั่วคราว ERROR(/File) และส่งกลับ File นั้น

abstract boolean pullFile (String remoteFilePath, File localFile)

ดึงไฟล์ออกจากอุปกรณ์

abstract boolean pullFile (String remoteFilePath, File localFile, int userId)

ดึงไฟล์ออกจากอุปกรณ์

abstract String pullFileContents (String remoteFilePath)

ดึงไฟล์ออกจากอุปกรณ์และส่งคืนเนื้อหา

abstract File pullFileFromExternal (String remoteFilePath)

วิธีอำนวยความสะดวกในการดึงไฟล์จากที่จัดเก็บข้อมูลภายนอกของอุปกรณ์ จัดเก็บไว้ใน ERROR(/File) ชั่วคราวในเครื่อง และส่งคืนการอ้างอิงไปยัง File นั้น

abstract boolean pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories)

พุชเนื้อหาไดเร็กทอรีซ้ำไปยังอุปกรณ์โดยไม่รวมไดเร็กทอรีบางตัวที่ถูกกรอง

abstract boolean pushDir (File localDir, String deviceFilePath)

พุชเนื้อหาไดเร็กทอรีซ้ำไปยังอุปกรณ์

abstract boolean pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded)

ตัวแปรของ pushFile(File, String) ซึ่งสามารถเลือกที่จะพิจารณาประเมินความต้องการสำหรับผู้ให้บริการเนื้อหา

abstract boolean pushFile (File localFile, String deviceFilePath)

พุชไฟล์ไปยังอุปกรณ์

abstract boolean pushString (String contents, String deviceFilePath)

ไฟล์พุชที่สร้างจากสตริงไปยังอุปกรณ์

abstract void reboot ()

รีบูตอุปกรณ์เข้าสู่โหมด adb

abstract void reboot (String reason)

รีบูตอุปกรณ์เข้าสู่โหมด adb พร้อม reason ที่กำหนดให้คงอยู่ตลอดการรีบูต

abstract void rebootIntoBootloader ()

รีบูตอุปกรณ์เข้าสู่โหมด bootloader

abstract void rebootIntoFastbootd ()

รีบูตอุปกรณ์เข้าสู่โหมด fastbootd

abstract void rebootIntoRecovery ()

รีบูตอุปกรณ์เข้าสู่โหมดการกู้คืน adb

abstract void rebootIntoSideload (boolean autoReboot)

รีบูตอุปกรณ์เข้าสู่โหมด adb sideload (โปรดทราบว่านี่เป็นโหมดพิเศษภายใต้การกู้คืน)

บล็อกจนกว่าอุปกรณ์จะเข้าสู่โหมดไซด์โหลด

abstract void rebootIntoSideload ()

รีบูตอุปกรณ์เข้าสู่โหมด adb sideload (โปรดทราบว่านี่เป็นโหมดพิเศษภายใต้การกู้คืน)

บล็อกจนกว่าอุปกรณ์จะเข้าสู่โหมดไซด์โหลด

abstract void rebootUntilOnline ()

ทางเลือกในการ reboot() ที่บล็อกเฉพาะจนกว่าอุปกรณ์จะออนไลน์เช่น adb มองเห็นได้

abstract void rebootUntilOnline (String reason)

ทางเลือกในการ reboot() ที่บล็อกเฉพาะจนกว่าอุปกรณ์จะออนไลน์เช่น adb มองเห็นได้

abstract void rebootUserspace ()

รีบูตเฉพาะส่วน userspace ของอุปกรณ์

abstract void rebootUserspaceUntilOnline ()

ทางเลือกอื่นในการ rebootUserspace() ()} ที่บล็อกเฉพาะจนกว่าอุปกรณ์จะออนไลน์ เช่น adb มองเห็นได้

abstract void remountSystemReadOnly ()

ทำให้พาร์ติชันระบบบนอุปกรณ์เป็นแบบอ่านอย่างเดียว

abstract void remountSystemWritable ()

ทำให้พาร์ติชันระบบบนอุปกรณ์สามารถเขียนได้

abstract void remountVendorReadOnly ()

ทำให้พาร์ติชันผู้ขายบนอุปกรณ์เป็นแบบอ่านอย่างเดียว

abstract void remountVendorWritable ()

ทำให้พาร์ติชันผู้ขายบนอุปกรณ์สามารถเขียนได้

abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)

วิธีการที่สะดวกสำหรับการดำเนินการ ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) โดยมีผู้ฟังอย่างน้อยหนึ่งรายที่ส่งผ่านเป็นพารามิเตอร์

abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners)

เรียกใช้การทดสอบเครื่องมือและให้การกู้คืนอุปกรณ์

abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners)

เหมือนกับ ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) แต่รันการทดสอบ สำหรับผู้ใช้ที่กำหนด

abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)

เหมือนกับ ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) แต่รันการทดสอบสำหรับผู้ใช้ที่กำหนด

abstract void setDate (Date date)

ตั้งวันที่บนอุปกรณ์

หมายเหตุ: การตั้งค่าวันที่บนอุปกรณ์จำเป็นต้องรูท

abstract void setOptions ( TestDeviceOptions options)

ตั้งค่า TestDeviceOptions สำหรับอุปกรณ์

abstract boolean setProperty (String propKey, String propValue)

ตั้งค่าคุณสมบัติที่กำหนดบนอุปกรณ์

abstract void setRecovery ( IDeviceRecovery recovery)

ตั้งค่า IDeviceRecovery เพื่อใช้สำหรับอุปกรณ์นี้

abstract void setRecoveryMode ( ITestDevice.RecoveryMode mode)

ตั้งค่าโหมดการกู้คืนปัจจุบันเพื่อใช้กับอุปกรณ์

abstract void setUseFastbootErase (boolean useFastbootErase)

ตั้งค่าว่าจะใช้การลบ fastboot หรือรูปแบบ fastboot เพื่อล้างพาร์ติชันบนอุปกรณ์

abstract void startLogcat ()

เริ่มบันทึกเอาต์พุต logcat จากอุปกรณ์ในพื้นหลัง

abstract void stopEmulatorOutput ()

ปิดและลบเอาต์พุตตัวจำลอง

abstract void stopLogcat ()

หยุดบันทึกเอาต์พุต logcat จากอุปกรณ์ และละทิ้งข้อมูล logcat ที่บันทึกไว้ในปัจจุบัน

abstract String switchToAdbTcp ()

เปลี่ยนอุปกรณ์เป็นโหมด adb-over-tcp

abstract boolean switchToAdbUsb ()

เปลี่ยนอุปกรณ์เป็น adb ผ่านโหมด usb

abstract boolean syncFiles (File localFileDir, String deviceFilePath)

เพิ่มการซิงค์เนื้อหาของไดเร็กทอรีไฟล์ในเครื่องกับอุปกรณ์

abstract boolean unlockDevice ()

ปลดล็อกอุปกรณ์หากอุปกรณ์อยู่ในสถานะเข้ารหัส

abstract boolean waitForBootComplete (long timeOut)

บล็อกจนกว่าจะมีการตั้งค่าแฟล็กการบู๊ตเสร็จสมบูรณ์ของอุปกรณ์

abstract boolean waitForDeviceAvailable ()

รอให้อุปกรณ์ตอบสนองและพร้อมสำหรับการทดสอบ

abstract boolean waitForDeviceAvailable (long waitTime)

รอให้อุปกรณ์ตอบสนองและพร้อมสำหรับการทดสอบ

abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)

รอให้อุปกรณ์ตอบสนองและพร้อมใช้งานโดยไม่ต้องพิจารณาเส้นทางการกู้คืน

abstract void waitForDeviceBootloader ()

บล็อกจนกว่าอุปกรณ์จะมองเห็นได้ผ่าน fastboot

abstract boolean waitForDeviceInRecovery (long waitTime)

บล็อกเพื่อให้อุปกรณ์อยู่ในสถานะ 'การกู้คืน adb' (โปรดทราบว่าสิ่งนี้แตกต่างจาก IDeviceRecovery )

abstract boolean waitForDeviceInSideload (long waitTime)

บล็อกเพื่อให้อุปกรณ์อยู่ในสถานะ "adb sideload"

abstract boolean waitForDeviceNotAvailable (long waitTime)

บล็อกไม่ให้อุปกรณ์พร้อมใช้งาน เช่น ขาดหายไปจาก adb

abstract void waitForDeviceOnline ()

บล็อกจนกว่าอุปกรณ์จะมองเห็นได้ผ่าน adb

abstract void waitForDeviceOnline (long waitTime)

บล็อกจนกว่าอุปกรณ์จะมองเห็นได้ผ่าน adb

abstract boolean waitForDeviceShell (long waitTime)

รอให้อุปกรณ์ตอบสนองต่อคำสั่ง adb shell พื้นฐาน

ค่าคงที่

UNKNOWN_API_LEVEL

public static final int UNKNOWN_API_LEVEL

ค่าเริ่มต้นเมื่อตรวจไม่พบระดับ API

ค่าคงที่: -1 (0xffffffff)

วิธีการสาธารณะ

ตรวจสอบApiLevelAgainstNextRelease

public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

ตรวจสอบว่าคุณลักษณะใดรองรับหรือไม่โดยพิจารณาจากระดับที่รองรับน้อยที่สุด วิธีนี้คำนึงถึงคุณลักษณะที่ยังไม่ได้เผยแพร่ ก่อนที่ระดับ API จะเพิ่มขึ้น

พารามิเตอร์
strictMinLevel int : ระดับต่ำสุดที่เข้มงวดที่สนับสนุนคุณลักษณะนี้

ส่งคืน
boolean จริงหากรองรับระดับ เป็นอย่างอื่น

พ่น
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

เคลียร์ Logcat

public abstract void clearLogcat ()

ลบข้อมูล logcat ที่สะสมไว้

สิ่งนี้มีประโยชน์สำหรับกรณีที่คุณต้องการให้แน่ใจว่า ITestDevice#getLogcat() ส่งคืนเฉพาะข้อมูลบันทึกที่สร้างหลังจากจุดหนึ่งเท่านั้น (เช่น หลังจากแฟลชบิลด์อุปกรณ์ใหม่ เป็นต้น)

ลบไฟล์

public abstract void deleteFile (String deviceFilePath)

วิธีตัวช่วยลบไฟล์หรือไดเรกทอรีในเครื่อง

พารามิเตอร์
deviceFilePath String : เส้นทางที่สมบูรณ์ของไฟล์บนอุปกรณ์

พ่น
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

deviceSoftRestarted

public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)

วิธีตัวช่วยเพื่อตรวจสอบว่าอุปกรณ์รีสตาร์ทอย่างนุ่มนวลหรือไม่โดยเปรียบเทียบ system_server ปัจจุบันกับ system_server ProcessInfo ก่อนหน้า ใช้ getProcessByName(String) เพื่อรับ ProcessInfo

พารามิเตอร์
prevSystemServerProcess ProcessInfo : system_server ก่อนหน้าประมวลผล ProcessInfo

ส่งคืน
boolean true หากอุปกรณ์รีสตาร์ทอย่างนุ่มนวล

พ่น
RuntimeException หากอุปกรณ์มีเหตุผลในการบู๊ตที่ผิดปกติ
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

deviceSoftRestartedตั้งแต่

public abstract boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

วิธีการช่วยเหลือเพื่อตรวจสอบว่าอุปกรณ์รีสตาร์ทอย่างนุ่มนวลตั้งแต่เวลา UTC ตั้งแต่ epoch จากอุปกรณ์และ ERROR(/TimeUnit) Soft-Restart หมายถึง system_server ที่รีสตาร์ทนอกการฮาร์ดรีบูตอุปกรณ์ (เช่น: การรีบูตที่ร้องขอ) สามารถรับ utcEpochTime ของอุปกรณ์ปัจจุบันในหน่วยมิลลิวินาทีได้โดยใช้วิธี getDeviceDate()

พารามิเตอร์
utcEpochTime long : เวลาของอุปกรณ์เป็นวินาทีตั้งแต่ยุค

timeUnit TimeUnit : หน่วยเวลา TimeUnit สำหรับ utcEpochTime ที่กำหนด

ส่งคืน
boolean true หากอุปกรณ์รีสตาร์ทอย่างนุ่มนวล

พ่น
RuntimeException หากอุปกรณ์มีเหตุผลในการบู๊ตที่ผิดปกติ
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

ปิดการใช้งาน AdbRoot

public abstract boolean disableAdbRoot ()

ปิด adb root

การปิดใช้งาน adb root อาจทำให้อุปกรณ์ตัดการเชื่อมต่อจาก adb วิธีนี้จะบล็อกจนกว่าอุปกรณ์จะพร้อมใช้งาน

ส่งคืน
boolean true ถ้าสำเร็จ

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

มีไฟล์อยู่

public abstract boolean doesFileExist (String deviceFilePath)

วิธีการช่วยเหลือเพื่อตรวจสอบว่ามีไฟล์บนอุปกรณ์อยู่หรือไม่

พารามิเตอร์
deviceFilePath String : เส้นทางที่แน่นอนของไฟล์บนอุปกรณ์ที่จะตรวจสอบ

ส่งคืน
boolean true ถ้ามีไฟล์อยู่ มิฉะนั้นจะ false

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

เปิดใช้งาน AdbRoot

public abstract boolean enableAdbRoot ()

เปิด adb root หากการตั้งค่า "เปิดใช้งานรูท" เป็น "เท็จ" จะบันทึกข้อความและส่งคืนโดยไม่เปิดใช้งานรูท

การเปิดใช้งาน adb root อาจทำให้อุปกรณ์ตัดการเชื่อมต่อจาก adb วิธีนี้จะบล็อกจนกว่าอุปกรณ์จะพร้อมใช้งาน

ส่งคืน
boolean true ถ้าสำเร็จ

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดำเนินการ AdbCommand

public abstract String executeAdbCommand (long timeout, 
                String... commandArgs)

วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง adb เป็นคำสั่งระบบที่มีการหมดเวลาที่ระบุ

ควรใช้ executeShellCommand(String) แทนหากทำได้ เนื่องจากวิธีนี้ให้การตรวจจับความล้มเหลวและประสิทธิภาพที่ดีกว่า

พารามิเตอร์
timeout long : เวลาเป็นมิลลิวินาทีก่อนที่อุปกรณ์จะถือว่าไม่ตอบสนอง 0L สำหรับการหมดเวลา

commandArgs String : คำสั่ง adb และอาร์กิวเมนต์ที่จะเรียกใช้

ส่งคืน
String stdout จากคำสั่ง null ถ้าคำสั่งล้มเหลวในการดำเนินการ

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดำเนินการ AdbCommand

public abstract String executeAdbCommand (String... commandArgs)

เมธอด Helper ซึ่งเรียกใช้คำสั่ง adb เป็นคำสั่งระบบ

ควรใช้ executeShellCommand(String) แทนหากทำได้ เนื่องจากวิธีนี้ให้การตรวจจับความล้มเหลวและประสิทธิภาพที่ดีกว่า

พารามิเตอร์
commandArgs String : คำสั่ง adb และอาร์กิวเมนต์ที่จะเรียกใช้

ส่งคืน
String stdout จากคำสั่ง null ถ้าคำสั่งล้มเหลวในการดำเนินการ

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดำเนินการ AdbCommand

public abstract String executeAdbCommand (long timeout, 
                 envMap, 
                String... commandArgs)

วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง adb เป็นคำสั่งระบบที่มีการหมดเวลาที่ระบุ

ควรใช้ executeShellCommand(String) แทนหากทำได้ เนื่องจากวิธีนี้ให้การตรวจจับความล้มเหลวและประสิทธิภาพที่ดีกว่า

พารามิเตอร์
timeout long : เวลาเป็นมิลลิวินาทีก่อนที่อุปกรณ์จะถือว่าไม่ตอบสนอง 0L สำหรับการหมดเวลา

envMap : สภาพแวดล้อมที่จะตั้งค่าสำหรับคำสั่ง

commandArgs String : คำสั่ง adb และอาร์กิวเมนต์ที่จะเรียกใช้

ส่งคืน
String stdout จากคำสั่ง null ถ้าคำสั่งล้มเหลวในการดำเนินการ

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดำเนินการ FastbootCommand

public abstract CommandResult executeFastbootCommand (long timeout, 
                String... commandArgs)

วิธีตัวช่วยที่รันคำสั่ง fastboot เป็นคำสั่งระบบ

คาดว่าจะใช้เมื่ออุปกรณ์อยู่ในโหมด fastboot แล้ว

พารามิเตอร์
timeout long : เวลาเป็นมิลลิวินาทีก่อนที่คำสั่งจะหมดอายุ

commandArgs String : คำสั่ง fastboot และอาร์กิวเมนต์ที่จะรัน

ส่งคืน
CommandResult CommandResult ที่มีเอาต์พุตของคำสั่ง

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดำเนินการ FastbootCommand

public abstract CommandResult executeFastbootCommand (String... commandArgs)

วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง fastboot เป็นคำสั่งระบบโดยมีการหมดเวลาเริ่มต้น 2 นาที

คาดว่าจะใช้เมื่ออุปกรณ์อยู่ในโหมด fastboot แล้ว

พารามิเตอร์
commandArgs String : คำสั่ง fastboot และอาร์กิวเมนต์ที่จะรัน

ส่งคืน
CommandResult CommandResult ที่มีเอาต์พุตของคำสั่ง

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดำเนินการ LongFastbootCommand

public abstract CommandResult executeLongFastbootCommand (String... commandArgs)

เมธอด Helper ซึ่งเรียกใช้คำสั่ง fastboot ที่ใช้เวลานานเป็นคำสั่งระบบ

เหมือนกันกับ executeFastbootCommand(String) ยกเว้นใช้การหมดเวลาที่นานขึ้น

พารามิเตอร์
commandArgs String : คำสั่ง fastboot และอาร์กิวเมนต์ที่จะรัน

ส่งคืน
CommandResult CommandResult ที่มีเอาต์พุตของคำสั่ง

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดำเนินการ LongFastbootCommand

public abstract CommandResult executeLongFastbootCommand ( envVarMap, 
                String... commandArgs)

เมธอด Helper ซึ่งดำเนินการคำสั่ง fastboot ที่รันเป็นเวลานานเป็นคำสั่งระบบพร้อมตัวแปรสภาพแวดล้อมระบบ

เหมือนกันกับ executeFastbootCommand(String) ยกเว้นใช้การหมดเวลาที่นานขึ้น

พารามิเตอร์
envVarMap : ตัวแปรสภาวะแวดล้อมระบบที่คำสั่ง fastboot รันด้วย

commandArgs String : คำสั่ง fastboot และอาร์กิวเมนต์ที่จะรัน

ส่งคืน
CommandResult CommandResult ที่มีเอาต์พุตของคำสั่ง

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดำเนินการเชลล์คำสั่ง

public abstract String executeShellCommand (String command)

เมธอด Helper ซึ่งรันคำสั่ง adb shell และส่งคืนเอาต์พุตเป็น String

พารามิเตอร์
command String : คำสั่ง adb shell ที่จะรัน

ส่งคืน
String เอาต์พุตของเชลล์

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดำเนินการเชลล์คำสั่ง

public abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

พารามิเตอร์
command String : คำสั่ง adb shell ที่จะรัน

receiver IShellOutputReceiver : IShellOutputReceiver เพื่อส่งเอาต์พุตเชลล์ไปยัง

maxTimeToOutputShellResponse long : ระยะเวลาสูงสุดที่คำสั่งได้รับอนุญาตให้ไม่แสดงการตอบสนองใด ๆ หน่วยตามที่กำหนดไว้ใน timeUnit

timeUnit TimeUnit : หน่วยสำหรับ maxTimeToOutputShellResponse

retryAttempts int : จำนวนครั้งสูงสุดในการลองคำสั่งอีกครั้งหากล้มเหลวเนื่องจากข้อยกเว้น DeviceNotResponsiveException จะถูกส่งออกไป หากดำเนินการ retryAttempts ไม่สำเร็จ

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดูสิ่งนี้ด้วย:

ดำเนินการเชลล์คำสั่ง

public abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeoutForCommand, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

พารามิเตอร์
command String : คำสั่ง adb shell ที่จะรัน

receiver IShellOutputReceiver : IShellOutputReceiver เพื่อส่งเอาต์พุตเชลล์ไปยัง

maxTimeoutForCommand long : หมดเวลาสูงสุดสำหรับคำสั่งที่จะเสร็จสมบูรณ์; หน่วยตามที่กำหนดไว้ใน timeUnit

maxTimeToOutputShellResponse long : ระยะเวลาสูงสุดที่คำสั่งได้รับอนุญาตให้ไม่แสดงการตอบสนองใด ๆ หน่วยตามที่กำหนดไว้ใน timeUnit

timeUnit TimeUnit : หน่วยสำหรับ maxTimeToOutputShellResponse

retryAttempts int : จำนวนครั้งสูงสุดในการลองคำสั่งอีกครั้งหากล้มเหลวเนื่องจากข้อยกเว้น DeviceNotResponsiveException จะถูกส่งออกไป หากดำเนินการ retryAttempts ไม่สำเร็จ

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดูสิ่งนี้ด้วย:

ดำเนินการเชลล์คำสั่ง

public abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver)

ดำเนินการคำสั่ง adb shell ที่กำหนด ลองใหม่หลายครั้งหากคำสั่งล้มเหลว

รูปแบบที่เรียบง่ายกว่าของ executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int) ด้วยค่าเริ่มต้น

พารามิเตอร์
command String : คำสั่ง adb shell ที่จะรัน

receiver IShellOutputReceiver : IShellOutputReceiver เพื่อส่งเอาต์พุตเชลล์ไปยัง

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

รันคำสั่ง ShellV2

public abstract CommandResult executeShellV2Command (String command)

เมธอด Helper ซึ่งรันคำสั่ง adb shell และส่งคืนผลลัพธ์เป็น CommandResult ที่บรรจุอย่างถูกต้องด้วยเอาต์พุตสถานะคำสั่ง stdout และ stderr

พารามิเตอร์
command String : คำสั่งที่ควรเรียกใช้

ส่งคืน
CommandResult ผลลัพธ์ใน CommandResult

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

รันคำสั่ง ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                OutputStream pipeToOutput)

เมธอด Helper ซึ่งดำเนินการคำสั่งเชลล์ adb และส่งคืนผลลัพธ์เป็น CommandResult ที่บรรจุอย่างถูกต้องด้วยเอาต์พุตสถานะคำสั่งและ stderr stdout ถูกส่งไปยังสตรีมที่ระบุ

พารามิเตอร์
command String : คำสั่งที่ควรเรียกใช้

pipeToOutput OutputStream : ERROR(/OutputStream) ที่เอาต์พุต std จะถูกเปลี่ยนเส้นทางหรือเป็น null

ส่งคืน
CommandResult ผลลัพธ์ใน CommandResult

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

รันคำสั่ง ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                File pipeAsInput)

เมธอด Helper ซึ่งรันคำสั่ง adb shell และส่งคืนผลลัพธ์เป็น CommandResult ที่บรรจุอย่างถูกต้องด้วยเอาต์พุตสถานะคำสั่ง stdout และ stderr

พารามิเตอร์
command String : คำสั่งที่ควรเรียกใช้

pipeAsInput File : ERROR(/File) ที่จะถูกไพพ์เป็นอินพุตไปยังคำสั่ง หรือค่าว่าง

ส่งคืน
CommandResult ผลลัพธ์ใน CommandResult

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

รันคำสั่ง ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

พารามิเตอร์
command String : คำสั่ง adb shell ที่จะรัน

maxTimeoutForCommand long : หมดเวลาสูงสุดสำหรับคำสั่งที่จะเสร็จสมบูรณ์; หน่วยตามที่กำหนดไว้ใน timeUnit

timeUnit TimeUnit : หน่วยสำหรับ maxTimeToOutputShellResponse

retryAttempts int : จำนวนครั้งสูงสุดในการลองคำสั่งอีกครั้งหากล้มเหลวเนื่องจากข้อยกเว้น DeviceNotResponsiveException จะถูกส่งออกไป หากดำเนินการ retryAttempts ไม่สำเร็จ

ส่งคืน
CommandResult

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดูสิ่งนี้ด้วย:

รันคำสั่ง ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

พารามิเตอร์
command String : คำสั่ง adb shell ที่จะรัน

maxTimeoutForCommand long : หมดเวลาสูงสุดสำหรับคำสั่งที่จะเสร็จสมบูรณ์; หน่วยตามที่กำหนดไว้ใน timeUnit

timeUnit TimeUnit : หน่วยสำหรับ maxTimeToOutputShellResponse

ส่งคืน
CommandResult

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดูสิ่งนี้ด้วย:

รันคำสั่ง ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

พารามิเตอร์
command String : คำสั่ง adb shell ที่จะรัน

pipeAsInput File : ERROR(/File) ที่จะถูกไพพ์เป็นอินพุตไปยังคำสั่ง หรือค่าว่าง

pipeToOutput OutputStream : ERROR(/OutputStream) ที่เอาต์พุต std จะถูกเปลี่ยนเส้นทางหรือเป็น null

maxTimeoutForCommand long : หมดเวลาสูงสุดสำหรับคำสั่งที่จะเสร็จสมบูรณ์; หน่วยตามที่กำหนดไว้ใน timeUnit

timeUnit TimeUnit : หน่วยสำหรับ maxTimeToOutputShellResponse

retryAttempts int : จำนวนครั้งสูงสุดในการลองคำสั่งอีกครั้งหากล้มเหลวเนื่องจากข้อยกเว้น DeviceNotResponsiveException จะถูกส่งออกไป หากดำเนินการ retryAttempts ไม่สำเร็จ

ส่งคืน
CommandResult

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดูสิ่งนี้ด้วย:

รันคำสั่ง ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                OutputStream pipeToError, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

ดำเนินการคำสั่ง adb shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง

พารามิเตอร์
command String : คำสั่ง adb shell ที่จะรัน

pipeAsInput File : ERROR(/File) ที่จะถูกไพพ์เป็นอินพุตไปยังคำสั่ง หรือค่าว่าง

pipeToOutput OutputStream : ERROR(/OutputStream) ที่เอาต์พุต std จะถูกเปลี่ยนเส้นทางหรือเป็น null

pipeToError OutputStream : ERROR(/OutputStream) ที่ข้อผิดพลาด std จะถูกเปลี่ยนเส้นทางหรือ null

maxTimeoutForCommand long : หมดเวลาสูงสุดสำหรับคำสั่งที่จะเสร็จสมบูรณ์; หน่วยตามที่กำหนดไว้ใน timeUnit

timeUnit TimeUnit : หน่วยสำหรับ maxTimeToOutputShellResponse

retryAttempts int : จำนวนครั้งสูงสุดในการลองคำสั่งอีกครั้งหากล้มเหลวเนื่องจากข้อยกเว้น DeviceNotResponsiveException จะถูกส่งออกไป หากดำเนินการ retryAttempts ไม่สำเร็จ

ส่งคืน
CommandResult

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

ดูสิ่งนี้ด้วย:

fastbootWipeพาร์ติชัน

public abstract CommandResult fastbootWipePartition (String partition)

วิธีการช่วยเหลือซึ่งจะล้างพาร์ทิชันสำหรับอุปกรณ์

หาก getUseFastbootErase() เป็น true ระบบจะใช้การลบ fastboot เพื่อล้างพาร์ติชัน จากนั้นอุปกรณ์จะต้องสร้างระบบไฟล์ในครั้งต่อไปที่อุปกรณ์บูท มิฉะนั้นจะใช้รูปแบบ fastboot ซึ่งจะสร้างระบบไฟล์ใหม่บนอุปกรณ์

คาดว่าจะใช้เมื่ออุปกรณ์อยู่ในโหมด fastboot แล้ว

พารามิเตอร์
partition String : พาร์ติชันที่จะล้าง

ส่งคืน
CommandResult CommandResult ที่มีเอาต์พุตของคำสั่ง

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

รับApiLevel

public abstract int getApiLevel ()

รับระดับ API ของอุปกรณ์ ค่าเริ่มต้นคือ UNKNOWN_API_LEVEL

ส่งคืน
int จำนวนเต็มที่ระบุระดับ API ของอุปกรณ์

พ่น
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBasebandVersion

public abstract String getBasebandVersion ()

วิธีอำนวยความสะดวกในการรับเวอร์ชันเบสแบนด์ (วิทยุ) ของอุปกรณ์นี้ การรับเวอร์ชันวิทยุเป็นอุปกรณ์เฉพาะ ดังนั้นจึงอาจไม่ส่งคืนข้อมูลที่ถูกต้องสำหรับอุปกรณ์ทั้งหมด วิธีนี้ใช้คุณสมบัติ gsm.version.baseband เพื่อส่งคืนข้อมูลเวอร์ชันที่ถูกต้อง สิ่งนี้ไม่ถูกต้องสำหรับอุปกรณ์ CDMA บางรุ่น และเวอร์ชันที่ส่งคืนที่นี่อาจไม่ตรงกับเวอร์ชันที่รายงานจาก fastboot และอาจไม่ส่งคืนเวอร์ชันสำหรับวิทยุ CDMA TL;DR วิธีนี้รายงานเฉพาะเวอร์ชันที่ถูกต้อง หากคุณสมบัติ gsm.version.baseband เหมือนกับเวอร์ชันที่ส่งคืนโดย fastboot getvar version-baseband

ส่งคืน
String เวอร์ชันเบสแบนด์ String หรือ null หากไม่สามารถระบุได้ (อุปกรณ์ไม่มีวิทยุหรือไม่สามารถอ่านสตริงเวอร์ชันได้)

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายไปและไม่สามารถกู้คืนได้

รับแบตเตอรี่

public abstract Integer getBattery ()

ส่งกลับระดับแบตเตอรี่ปัจจุบันของอุปกรณ์หรือค่า Null หากไม่มีระดับแบตเตอรี่

ส่งคืน
Integer

getBooleanProperty

public abstract boolean getBooleanProperty (String name, 
                boolean defaultValue)

ส่งกลับค่าบูลีนของคุณสมบัติที่กำหนด

พารามิเตอร์
name String : ชื่อคุณสมบัติ

defaultValue boolean : ค่าเริ่มต้นที่จะส่งคืนหากคุณสมบัติว่างเปล่าหรือไม่มีอยู่

ส่งคืน
boolean true ถ้าคุณสมบัติมีค่าเป็น "1" , "y" , "yes" , "on" หรือ "true" , false ถ้าคุณสมบัติมีค่าเป็น "0" , "n" , "no" , "off" , "false" หรือ defaultValue เป็นอย่างอื่น

พ่น
DeviceNotAvailableException

รับประวัติการบูต

public abstract  getBootHistory ()

วิธีตัวช่วยรวบรวมแผนที่ประวัติการบูตพร้อมเวลาบูตและเหตุผลในการบูต

ส่งคืน
แผนที่เวลาบูต (เวลา UTC เป็นวินาทีตั้งแต่ยุค) และเหตุผลในการบูต

พ่น
DeviceNotAvailableException

getBootHistoryตั้งแต่

public abstract  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

เมธอด Helper รวบรวมแมปประวัติการบูตพร้อมเวลาบูตและเหตุผลการบูตตั้งแต่เวลาที่กำหนดตั้งแต่ยุคจากอุปกรณ์และหน่วยเวลาที่ระบุ สามารถรับ utcEpochTime ของอุปกรณ์ปัจจุบันในหน่วยมิลลิวินาทีได้โดยใช้วิธี getDeviceDate()

พารามิเตอร์
utcEpochTime long : เวลาของอุปกรณ์ตั้งแต่ยุค

timeUnit TimeUnit : หน่วยเวลา TimeUnit

ส่งคืน
แผนที่เวลาบูต (เวลา UTC เป็นวินาทีตั้งแต่ยุค) และเหตุผลในการบูต

พ่น
DeviceNotAvailableException

รับ BootloaderVersion

public abstract String getBootloaderVersion ()

วิธีอำนวยความสะดวกในการรับเวอร์ชัน bootloader ของอุปกรณ์นี้

จะพยายามดึงเวอร์ชัน bootloader จากสถานะปัจจุบันของอุปกรณ์ (เช่น หากอุปกรณ์อยู่ในโหมด fastboot อุปกรณ์จะพยายามดึงเวอร์ชันจาก fastboot)

ส่งคืน
String เวอร์ชัน bootloader String หรือ null หากไม่พบ

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

getBuildAlias

public abstract String getBuildAlias ()

เรียกนามแฝงของบิลด์ที่อุปกรณ์กำลังทำงานอยู่

Build alias มักจะเป็นสตริงที่อ่านง่ายกว่า build id (โดยทั่วไปจะเป็นตัวเลขสำหรับ Nexus builds) ตัวอย่างเช่น รุ่นสุดท้ายของ Android 4.2 มี build alias JDQ39 และ build id 573038

ส่งคืน
String นามแฝงของบิลด์หรือถอยกลับเป็นรหัสบิลด์หากไม่สามารถเรียกคืนได้

พ่น
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBuildFlavor

public abstract String getBuildFlavor ()

เรียกรสชาติการสร้างสำหรับอุปกรณ์

ส่งคืน
String สร้างรสชาติหรือเป็นโมฆะหากไม่สามารถเรียกคืนได้

พ่น
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBuildId

public abstract String getBuildId ()

ดึงบิลด์ที่อุปกรณ์กำลังทำงานอยู่

ส่งคืน
String ID ของบิลด์หรือ IBuildInfo#UNKNOWN_BUILD_ID หากไม่สามารถเรียกคืนได้

พ่น
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBuildSigningKeys

public abstract String getBuildSigningKeys ()

ส่งกลับประเภทคีย์ที่ใช้เพื่อเซ็นอิมเมจอุปกรณ์

โดยทั่วไปแล้ว อุปกรณ์ Android อาจลงนามด้วยคีย์ทดสอบ (เช่นใน AOSP) หรือคีย์รีลีส (ควบคุมโดยผู้ผลิตอุปกรณ์แต่ละราย)

ส่งคืน
String หากพบรหัสการลงนาม มิฉะนั้นจะเป็นโมฆะ

พ่น
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getCachedDeviceDescriptor

public abstract DeviceDescriptor getCachedDeviceDescriptor ()

ส่งคืน DeviceDescriptor ที่แคชหากอุปกรณ์ได้รับการจัดสรร มิฉะนั้นส่งคืน DeviceDescriptor ปัจจุบัน

ส่งคืน
DeviceDescriptor

getCachedDeviceDescriptor

public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

ส่งคืน DeviceDescriptor ที่แคชหากอุปกรณ์ได้รับการจัดสรร มิฉะนั้นส่งคืน DeviceDescriptor ปัจจุบัน

พารามิเตอร์
shortDescriptor boolean : จะจำกัด descriptor เป็นข้อมูลขั้นต่ำเปล่าหรือไม่

ส่งคืน
DeviceDescriptor

รับเด็ก

public abstract String[] getChildren (String deviceFilePath)

ทางเลือกในการใช้ IFileEntry ที่บางครั้งใช้งานไม่ได้เนื่องจากการอนุญาต

พารามิเตอร์
deviceFilePath String : คือเส้นทางบนอุปกรณ์ที่จะทำการค้นหา

ส่งคืน
String[] อาร์เรย์ของสตริงที่มีไฟล์ทั้งหมดในเส้นทางบนอุปกรณ์

พ่น
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

รับการเชื่อมต่อ

public abstract AbstractConnection getConnection ()

ส่งกลับการเชื่อมต่อที่เกี่ยวข้องกับอุปกรณ์

ส่งคืน
AbstractConnection

getDeviceClass

public abstract String getDeviceClass ()

รับคลาสอุปกรณ์

ส่งคืน
String คลาสอุปกรณ์ String

รับวันที่อุปกรณ์

public abstract long getDeviceDate ()

ส่งกลับวันที่ของอุปกรณ์ในหน่วยมิลลิวินาทีตั้งแต่ยุค

ส่งคืน
long วันที่ของอุปกรณ์ในรูปแบบยุค

พ่น
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getDeviceDescriptor

public abstract DeviceDescriptor getDeviceDescriptor ()

ส่งกลับ DeviceDescriptor จากข้อมูลอุปกรณ์เพื่อรับข้อมูลโดยไม่ต้องผ่านวัตถุอุปกรณ์จริง

ส่งคืน
DeviceDescriptor

getDeviceDescriptor

public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

ส่งกลับ DeviceDescriptor จากข้อมูลอุปกรณ์เพื่อรับข้อมูลโดยไม่ต้องผ่านวัตถุอุปกรณ์จริง

พารามิเตอร์
shortDescriptor boolean : จะจำกัด descriptor เป็นข้อมูลขั้นต่ำเปล่าหรือไม่

ส่งคืน
DeviceDescriptor

รับสถานะอุปกรณ์

public abstract TestDeviceState getDeviceState ()

รับสถานะของอุปกรณ์

ส่งคืน
TestDeviceState

getDeviceTimeOffset

public abstract long getDeviceTimeOffset (Date date)

ตัวช่วยในการรับความแตกต่างของเวลาระหว่างอุปกรณ์กับ ERROR(/Date) ที่กำหนด ใช้เวลายุคภายใน

พารามิเตอร์
date Date

ส่งคืน
long ความแตกต่างในหน่วยมิลลิวินาที

พ่น
DeviceNotAvailableException

getEmulatorOutput

public abstract InputStreamSource getEmulatorOutput ()

รับสตรีมของโปรแกรมจำลอง stdout และ stderr

ส่งคืน
InputStreamSource เอาต์พุตโปรแกรมจำลอง

getExternalStoreFreeSpace

public abstract long getExternalStoreFreeSpace ()

วิธีการช่วยเหลือเพื่อกำหนดจำนวนพื้นที่ว่างบนที่จัดเก็บข้อมูลภายนอกของอุปกรณ์

ส่งคืน
long จำนวนพื้นที่ว่างในหน่วย KB

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

getFastbootProductType

public abstract String getFastbootProductType ()

วิธีอำนวยความสะดวกในการรับประเภทผลิตภัณฑ์ของอุปกรณ์นี้เมื่ออยู่ในโหมด fastboot

ควรใช้วิธีนี้เฉพาะในกรณีที่อุปกรณ์ควรอยู่ใน fastboot วิธีนี้ค่อนข้างปลอดภัยกว่าเมธอด getProductType() ทั่วไปเล็กน้อยในกรณีนี้ เนื่องจาก ITestDevice จะรู้วิธีกู้คืนอุปกรณ์เป็น fastboot หากอุปกรณ์อยู่ในสถานะไม่ถูกต้องหรือไม่ตอบสนอง

ส่งคืน
String ชื่อประเภทผลิตภัณฑ์ String หรือ null หากไม่สามารถกำหนดได้

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

getFastbootProductVariant

public abstract String getFastbootProductVariant ()

วิธีอำนวยความสะดวกในการรับประเภทผลิตภัณฑ์ของอุปกรณ์นี้เมื่ออยู่ในโหมด fastboot

ควรใช้วิธีนี้เฉพาะในกรณีที่อุปกรณ์ควรอยู่ใน fastboot วิธีนี้ค่อนข้างปลอดภัยกว่าเมธอด getProductType() ทั่วไปเล็กน้อยในกรณีนี้ เนื่องจาก ITestDevice จะรู้วิธีกู้คืนอุปกรณ์เป็น fastboot หากอุปกรณ์อยู่ในสถานะไม่ถูกต้องหรือไม่ตอบสนอง

ส่งคืน
String ชื่อประเภทผลิตภัณฑ์ String หรือ null หากไม่สามารถกำหนดได้

พ่น
DeviceNotAvailableException หากการเชื่อมต่อกับอุปกรณ์ขาดหายและไม่สามารถกู้คืนได้

รับ FastbootSerialNumber

public abstract String getFastbootSerialNumber ()

ส่งกลับหมายเลขซีเรียลของโหมด fastboot

ส่งคืน
String

รับ FastbootVariable

public abstract String getFastbootVariable (String variableName)

ดึงค่าตัวแปร fastboot ที่กำหนดจากอุปกรณ์

พารามิเตอร์
variableName String : ชื่อตัวแปร

ส่งคืน
String ค่าคุณสมบัติหรือ null หากไม่มีอยู่

พ่น
ไม่รองรับ OperationException
DeviceNotAvailableException

รับไฟล์เอนทรี

public abstract IFileEntry getFileEntry (String path)

เรียกข้อมูลอ้างอิงไปยังไฟล์ระยะไกลบนอุปกรณ์

พารามิเตอร์
path String : เส้นทางของไฟล์ที่จะดึงข้อมูล อาจเป็นเส้นทางสัมบูรณ์หรือเส้นทางสัมพัทธ์กับ '/' (เช่น รองรับทั้งไวยากรณ์ "/ system" และ "system")

ส่งคืน
IFileEntry IFileEntry หรือ null หากไม่พบไฟล์ตาม path ที่กำหนด

พ่น
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getIDevice

public abstract IDevice getIDevice ()

ส่งกลับการอ้างอิงไปยัง ddmlib IDevice ที่เกี่ยวข้อง

DDMS อาจจัดสรร IDevice ใหม่ทุกครั้งที่อุปกรณ์ตัดการเชื่อมต่อและเชื่อมต่อใหม่จาก adb ดังนั้นผู้โทรไม่ควรอ้างอิงถึง IDevice เพราะการอ้างอิงนั้นอาจล้าสมัย

ส่งคืน
IDevice IDevice

รับ IntProperty

public abstract long getIntProperty (String name, 
                long defaultValue)

ส่งกลับค่าจำนวนเต็มของคุณสมบัติที่กำหนดจากอุปกรณ์

พารามิเตอร์
name String : ชื่อคุณสมบัติ

defaultValue long : default value to return if property is empty or doesn't exist.

ส่งคืน
long the property value or defaultValue if the property is empty, doesn't exist, or doesn't have an integer value.

Throws
DeviceNotAvailableException

getLastExpectedRebootTimeMillis

public abstract long getLastExpectedRebootTimeMillis ()

Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by System.currentTimeMillis() .

ส่งคืน
long

getLaunchApiLevel

public abstract int getLaunchApiLevel ()

Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL .

ส่งคืน
int an integer indicating the first launched API Level of device

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getLogcat

public abstract InputStreamSource getLogcat ()

Grabs a snapshot stream of the logcat data.

Works in two modes:

  • If the logcat is currently being captured in the background, will return up to TestDeviceOptions.getMaxLogcatDataSize() bytes of the current contents of the background logcat capture
  • Otherwise, will return a static dump of the logcat data if device is currently responding

    ส่งคืน
    InputStreamSource

  • getLogcat

    public abstract InputStreamSource getLogcat (int maxBytes)

    Grabs a snapshot stream of the last maxBytes of captured logcat data.

    Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat() snapshot.

    พารามิเตอร์
    maxBytes int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory

    ส่งคืน
    InputStreamSource

    getLogcatDump

    public abstract InputStreamSource getLogcatDump ()

    Get a dump of the current logcat for device. Unlike getLogcat() , this method will always return a static dump of the logcat.

    Has the disadvantage that nothing will be returned if device is not reachable.

    ส่งคืน
    InputStreamSource a InputStreamSource of the logcat data. An empty stream is returned if fail to capture logcat data.

    getLogcatSince

    public abstract InputStreamSource getLogcatSince (long date)

    Grabs a snapshot stream of captured logcat data starting the date provided. The time on the device should be used getDeviceDate() .

    พารามิเตอร์
    date long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s')

    ส่งคืน
    InputStreamSource

    getMountPoint

    public abstract String getMountPoint (String mountName)

    Returns a mount point.

    Queries the device directly if the cached info in IDevice is not available.

    TODO: move this behavior to IDevice#getMountPoint(String)

    พารามิเตอร์
    mountName String : the name of the mount point

    ส่งคืน
    String the mount point or null

    getMountPointInfo

    public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

    Returns a MountPointInfo corresponding to the specified mountpoint path, or null if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.

    พารามิเตอร์
    mountpoint String

    ส่งคืน
    ITestDevice.MountPointInfo A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts"

    Throws
    DeviceNotAvailableException

    getMountPointInfo

    public abstract  getMountPointInfo ()

    Returns a parsed version of the information in /proc/mounts on the device

    ส่งคืน
    A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts"

    Throws
    DeviceNotAvailableException

    getPartitionFreeSpace

    public abstract long getPartitionFreeSpace (String partition)

    Helper method to determine amount of free space on device partition.

    พารามิเตอร์
    partition String

    ส่งคืน
    long the amount of free space in KB

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    getProcessByName

    public abstract ProcessInfo getProcessByName (String processName)

    Helper method runs the "pidof" and "stat" command and returns ProcessInfo object with PID and process start time of the given process.

    พารามิเตอร์
    processName String : the proces name String.

    ส่งคืน
    ProcessInfo ProcessInfo of given processName

    Throws
    DeviceNotAvailableException

    getProcessPid

    public abstract String getProcessPid (String process)

    Returns the pid of the service or null if something went wrong.

    พารามิเตอร์
    process String : The proces name String.

    ส่งคืน
    String

    Throws
    DeviceNotAvailableException

    getProductType

    public abstract String getProductType ()

    Convenience method to get the product type of this device.

    This method will work if device is in either adb or fastboot mode.

    ส่งคืน
    String the String product type name. Will not be null

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered, or if product type can not be determined

    getProductVariant

    public abstract String getProductVariant ()

    Convenience method to get the product variant of this device.

    This method will work if device is in either adb or fastboot mode.

    ส่งคืน
    String the String product variant name or null if it cannot be determined

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    getProperty

    public abstract String getProperty (String name)

    Retrieve the given property value from the device.

    พารามิเตอร์
    name String : the property name

    ส่งคืน
    String the property value or null if it does not exist

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    getRecoveryMode

    public abstract ITestDevice.RecoveryMode getRecoveryMode ()

    Get the current recovery mode used for the device.

    ส่งคืน
    ITestDevice.RecoveryMode the current recovery mode used for the device.

    getSerialNumber

    public abstract String getSerialNumber ()

    Convenience method to get serial number of this device.

    ส่งคืน
    String the String serial number

    getTombstones

    public abstract  getTombstones ()

    Fetch and return the list of tombstones from the devices. Requires root.

    method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException will terminate the method early.

    ส่งคืน
    A list of tombstone files, empty if no tombstone.

    Throws
    DeviceNotAvailableException

    getTotalMemory

    public abstract long getTotalMemory ()

    Returns total physical memory size in bytes or -1 in case of internal error

    ส่งคืน
    long

    getUseFastbootErase

    public abstract boolean getUseFastbootErase ()

    Get whether to use fastboot erase or fastboot format to wipe a partition on the device.

    ส่งคืน
    boolean true if fastboot erase will be used or false if fastboot format will be used.

    isAdbRoot

    public abstract boolean isAdbRoot ()

    ส่งคืน
    boolean true if device currently has adb root, false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    isAdbTcp

    public abstract boolean isAdbTcp ()

    ส่งคืน
    boolean true if device is connected to adb-over-tcp, false otherwise.

    isAppEnumerationSupported

    public abstract boolean isAppEnumerationSupported ()

    Check whether platform on device supports app enumeration

    ส่งคืน
    boolean True if app enumeration is supported, false otherwise

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isBypassLowTargetSdkBlockSupported

    public abstract boolean isBypassLowTargetSdkBlockSupported ()

    Check whether platform on device supports bypassing low target sdk block on app installs

    ส่งคืน
    boolean True if bypass low target sdk block is supported, false otherwise

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isDeviceEncrypted

    public abstract boolean isDeviceEncrypted ()

    Returns if the device is encrypted.

    ส่งคืน
    boolean true if the device is encrypted.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    isDirectory

    public abstract boolean isDirectory (String deviceFilePath)

    Return True if the path on the device is a directory, false otherwise.

    พารามิเตอร์
    deviceFilePath String

    ส่งคืน
    boolean

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isEncryptionSupported

    public abstract boolean isEncryptionSupported ()

    Returns if encryption is supported on the device.

    ส่งคืน
    boolean true if the device supports encryption.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isExecutable

    public abstract boolean isExecutable (String fullPath)

    Returns True if the file path on the device is an executable file, false otherwise.

    พารามิเตอร์
    fullPath String

    ส่งคืน
    boolean

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isHeadless

    public abstract boolean isHeadless ()

    Return true if the device is headless (no screen), false otherwise.

    ส่งคืน
    boolean

    Throws
    DeviceNotAvailableException

    isRuntimePermissionSupported

    public abstract boolean isRuntimePermissionSupported ()

    Check whether platform on device supports runtime permission granting

    ส่งคืน
    boolean True if runtime permission are supported, false otherwise.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isStateBootloaderOrFastbootd

    public abstract boolean isStateBootloaderOrFastbootd ()

    Returns true if device is in TestDeviceState#FASTBOOT or TestDeviceState.FASTBOOTD .

    ส่งคืน
    boolean

    logAnrs

    public abstract boolean logAnrs (ITestLogger logger)

    Collects and log ANRs from the device.

    พารามิเตอร์
    logger ITestLogger : an ITestLogger to log the ANRs.

    ส่งคืน
    boolean True if the logging was successful, false otherwise.

    Throws
    DeviceNotAvailableException

    logOnDevice

    public abstract void logOnDevice (String tag, 
                    Log.LogLevel level, 
                    String format, 
                    Object... args)

    Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.

    พารามิเตอร์
    tag String : The tag under which we log our message in the logcat.

    level Log.LogLevel : The debug level of the message in the logcat.

    format String : The message format.

    args Object : the args to be replaced via String.format().

    nonBlockingReboot

    public abstract void nonBlockingReboot ()

    Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    postBootSetup

    public abstract void postBootSetup ()

    Perform instructions to configure device for testing that after every boot.

    Should be called after device is fully booted/available

    In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot.

    Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    postInvocationTearDown

    public void postInvocationTearDown ()

    This method is deprecated.
    Use postInvocationTearDown(Throwable) instead.

    Extra steps for device specific required clean up that will be executed after the invocation is done.

    postInvocationTearDown

    public abstract void postInvocationTearDown (Throwable invocationException)

    Extra steps for device specific required clean up that will be executed after the invocation is done.

    พารามิเตอร์
    invocationException Throwable : if any, the final exception raised by the invocation failure.

    preInvocationSetup

    public void preInvocationSetup (IBuildInfo info, 
                    MultiMap<String, String> attributes)

    Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.

    พารามิเตอร์
    info IBuildInfo : The IBuildInfo of the device.

    attributes MultiMap : The attributes stored in the invocation context

    Throws
    com.android.tradefed.targetprep.TargetSetupError
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException
    TargetSetupError

    pullDir

    public abstract boolean pullDir (String deviceFilePath, 
                    File localDir)

    Recursively pull directory contents from device.

    พารามิเตอร์
    deviceFilePath String : the absolute file path of the remote source

    localDir File : the local directory to pull files into

    ส่งคืน
    boolean true if file was pulled successfully. false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    pullFile

    public abstract File pullFile (String remoteFilePath, 
                    int userId)

    Retrieves a file off device, stores it in a local temporary ERROR(/File) , and returns that File .

    พารามิเตอร์
    remoteFilePath String : the absolute path to file on device.

    userId int : The user id to pull from

    ส่งคืน
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    pullFile

    public abstract File pullFile (String remoteFilePath)

    Retrieves a file off device, stores it in a local temporary ERROR(/File) , and returns that File .

    พารามิเตอร์
    remoteFilePath String : the absolute path to file on device.

    ส่งคืน
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    pullFile

    public abstract boolean pullFile (String remoteFilePath, 
                    File localFile)

    Retrieves a file off device.

    พารามิเตอร์
    remoteFilePath String : the absolute path to file on device.

    localFile File : the local file to store contents in. If non-empty, contents will be replaced.

    ส่งคืน
    boolean true if file was retrieved successfully. false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    pullFile

    public abstract boolean pullFile (String remoteFilePath, 
                    File localFile, 
                    int userId)

    Retrieves a file off device.

    พารามิเตอร์
    remoteFilePath String : the absolute path to file on device.

    localFile File : the local file to store contents in. If non-empty, contents will be replaced.

    userId int : The user id to pull from

    ส่งคืน
    boolean true if file was retrieved successfully. false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    pullFileContents

    public abstract String pullFileContents (String remoteFilePath)

    Retrieves a file off device, and returns the contents.

    พารามิเตอร์
    remoteFilePath String : the absolute path to file on device.

    ส่งคืน
    String A String containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    Throws
    DeviceNotAvailableException

    pullFileFromExternal

    public abstract File pullFileFromExternal (String remoteFilePath)

    A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File) , and return a reference to that File .

    พารามิเตอร์
    remoteFilePath String : the path to file on device, relative to the device's external storage mountpoint

    ส่งคืน
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    pushDir

    public abstract boolean pushDir (File localDir, 
                    String deviceFilePath, 
                     excludedDirectories)

    Recursively push directory contents to device while excluding some directories that are filtered.

    พารามิเตอร์
    localDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

    excludedDirectories : Set of excluded directories names that shouldn't be pushed.

    ส่งคืน
    boolean true if file was pushed successfully. false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    pushDir

    public abstract boolean pushDir (File localDir, 
                    String deviceFilePath)

    Recursively push directory contents to device.

    พารามิเตอร์
    localDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

    ส่งคืน
    boolean true if file was pushed successfully. false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    pushFile

    public abstract boolean pushFile (File localFile, 
                    String deviceFilePath, 
                    boolean evaluateContentProviderNeeded)

    Variant of pushFile(File, String) which can optionally consider evaluating the need for the content provider.

    พารามิเตอร์
    localFile File : the local file to push

    deviceFilePath String : the remote destination absolute file path

    evaluateContentProviderNeeded boolean : whether to check if we need the content provider

    ส่งคืน
    boolean true if file was pushed successfully. false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    pushFile

    public abstract boolean pushFile (File localFile, 
                    String deviceFilePath)

    Push a file to device. By default using a content provider.

    พารามิเตอร์
    localFile File : the local file to push

    deviceFilePath String : the remote destination absolute file path

    ส่งคืน
    boolean true if file was pushed successfully. false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    pushString

    public abstract boolean pushString (String contents, 
                    String deviceFilePath)

    Push file created from a string to device

    พารามิเตอร์
    contents String : the contents of the file to push

    deviceFilePath String : the remote destination absolute file path

    ส่งคืน
    boolean true if string was pushed successfully. false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    reboot

    public abstract void reboot ()

    Reboots the device into adb mode.

    Blocks until device becomes available.

    Throws
    DeviceNotAvailableException if device is not available after reboot

    reboot

    public abstract void reboot (String reason)

    Reboots the device into adb mode with given reason to be persisted across reboot.

    Blocks until device becomes available.

    Last reboot reason can be obtained by querying sys.boot.reason propety.

    พารามิเตอร์
    reason String : a reason for this reboot, or null if no reason is specified.

    Throws
    DeviceNotAvailableException if device is not available after reboot

    rebootIntoBootloader

    public abstract void rebootIntoBootloader ()

    Reboots the device into bootloader mode.

    Blocks until device is in bootloader mode.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    rebootIntoFastbootd

    public abstract void rebootIntoFastbootd ()

    Reboots the device into fastbootd mode.

    Blocks until device is in fastbootd mode.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    rebootIntoRecovery

    public abstract void rebootIntoRecovery ()

    Reboots the device into adb recovery mode.

    Blocks until device enters recovery

    Throws
    DeviceNotAvailableException if device is not available after reboot

    rebootIntoSideload

    public abstract void rebootIntoSideload (boolean autoReboot)

    Reboots the device into adb sideload mode (note that this is a special mode under recovery)

    Blocks until device enters sideload mode

    พารามิเตอร์
    autoReboot boolean : whether to automatically reboot the device after sideload

    Throws
    DeviceNotAvailableException if device is not in sideload after reboot

    rebootIntoSideload

    public abstract void rebootIntoSideload ()

    Reboots the device into adb sideload mode (note that this is a special mode under recovery)

    Blocks until device enters sideload mode

    Throws
    DeviceNotAvailableException if device is not in sideload after reboot

    rebootUntilOnline

    public abstract void rebootUntilOnline ()

    An alternate to reboot() that only blocks until device is online ie visible to adb.

    Throws
    DeviceNotAvailableException if device is not available after reboot

    rebootUntilOnline

    public abstract void rebootUntilOnline (String reason)

    An alternate to reboot() that only blocks until device is online ie visible to adb.

    พารามิเตอร์
    reason String : a reason for this reboot, or null if no reason is specified.

    Throws
    DeviceNotAvailableException if device is not available after reboot

    See also:

    rebootUserspace

    public abstract void rebootUserspace ()

    Reboots only userspace part of device.

    Blocks until device becomes available.

    WARNING. Userspace reboot is currently under active development, use it on your own risk.

    Throws
    DeviceNotAvailableException if device is not available after reboot

    rebootUserspaceUntilOnline

    public abstract void rebootUserspaceUntilOnline ()

    An alternate to rebootUserspace() ()} that only blocks until device is online ie visible to adb.

    Throws
    DeviceNotAvailableException if device is not available after reboot

    remountSystemReadOnly

    public abstract void remountSystemReadOnly ()

    Make the system partition on the device read-only. May reboot the device.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    remountSystemWritable

    public abstract void remountSystemWritable ()

    Make the system partition on the device writable. May reboot the device.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    remountVendorReadOnly

    public abstract void remountVendorReadOnly ()

    Make the vendor partition on the device read-only. May reboot the device.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    remountVendorWritable

    public abstract void remountVendorWritable ()

    Make the vendor partition on the device writable. May reboot the device.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    runInstrumentationTests

    public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                    ITestLifeCycleReceiver... listeners)

    Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) with one or more listeners passed as parameters.

    พารามิเตอร์
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners ITestLifeCycleReceiver : the test result listener(s)

    ส่งคืน
    boolean true if test command completed. false if it failed to complete, but recovery succeeded

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed.

    runInstrumentationTests

    public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                     listeners)

    Runs instrumentation tests, and provides device recovery.

    If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.

    If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.

    พารามิเตอร์
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners : the test result listeners

    ส่งคืน
    boolean true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed.

    runInstrumentationTestsAsUser

    public abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, 
                    int userId, 
                     listeners)

    Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) but runs the test for the given user.

    พารามิเตอร์
    runner IRemoteAndroidTestRunner

    userId int

    listeners

    ส่งคืน
    boolean

    Throws
    DeviceNotAvailableException

    runInstrumentationTestsAsUser

    public abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, 
                    int userId, 
                    ITestLifeCycleReceiver... listeners)

    Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) but runs the test for a given user.

    พารามิเตอร์
    runner IRemoteAndroidTestRunner

    userId int

    listeners ITestLifeCycleReceiver

    ส่งคืน
    boolean

    Throws
    DeviceNotAvailableException

    setDate

    public abstract void setDate (Date date)

    Sets the date on device

    Note: setting date on device requires root

    พารามิเตอร์
    date Date : specify a particular date; will use host date if null

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    setOptions

    public abstract void setOptions (TestDeviceOptions options)

    Set the TestDeviceOptions for the device

    พารามิเตอร์
    options TestDeviceOptions

    setProperty

    public abstract boolean setProperty (String propKey, 
                    String propValue)

    Sets the given property value on the device. Requires adb root is true.

    พารามิเตอร์
    propKey String : The key targeted to be set.

    propValue String : The property value to be set.

    ส่งคืน
    boolean returns True if the setprop command was successful, False otherwise.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    setRecovery

    public abstract void setRecovery (IDeviceRecovery recovery)

    Set the IDeviceRecovery to use for this device. Should be set when device is first allocated.

    พารามิเตอร์
    recovery IDeviceRecovery : the IDeviceRecovery

    setRecoveryMode

    public abstract void setRecoveryMode (ITestDevice.RecoveryMode mode)

    Set the current recovery mode to use for the device.

    Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etc

    พารามิเตอร์
    mode ITestDevice.RecoveryMode : whether 'recover till online only' mode should be on or not.

    setUseFastbootErase

    public abstract void setUseFastbootErase (boolean useFastbootErase)

    Set whether to use fastboot erase or fastboot format to wipe a partition on the device.

    พารามิเตอร์
    useFastbootErase boolean : true if fastboot erase should be used or false if fastboot format should be used.

    startLogcat

    public abstract void startLogcat ()

    Start capturing logcat output from device in the background.

    Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat.

    When the device is no longer in use, stopLogcat() must be called.

    startLogcat() and stopLogcat() do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.

    stopEmulatorOutput

    public abstract void stopEmulatorOutput ()

    Close and delete the emulator output.

    stopLogcat

    public abstract void stopLogcat ()

    Stop capturing logcat output from device, and discard currently saved logcat data.

    Will have no effect if logcat output is not being captured.

    switchToAdbTcp

    public abstract String switchToAdbTcp ()

    Switch device to adb-over-tcp mode.

    ส่งคืน
    String the tcp serial number or null if device could not be switched

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    switchToAdbUsb

    public abstract boolean switchToAdbUsb ()

    Switch device to adb over usb mode.

    ส่งคืน
    boolean true if switch was successful, false otherwise.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    syncFiles

    public abstract boolean syncFiles (File localFileDir, 
                    String deviceFilePath)

    Incrementally syncs the contents of a local file directory to device.

    Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date.

    Hidden files (with names starting with ".") will be ignored.

    Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.

    พารามิเตอร์
    localFileDir File : the local file directory containing files to recursively push.

    deviceFilePath String : the remote destination absolute file path root. All directories in thos file path must be readable. ie pushing to /data/local/tmp when adb is not root will fail

    ส่งคืน
    boolean true if files were synced successfully. false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    unlockDevice

    public abstract boolean unlockDevice ()

    Unlocks the device if the device is in an encrypted state.

    This method may restart the framework but will not call postBootSetup() . Therefore, the device might not be fully ready to be tested when this method returns.

    ส่งคืน
    boolean true if successful or if the device is unencrypted.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.
    UnsupportedOperationException if encryption is not supported on the device.

    waitForBootComplete

    public abstract boolean waitForBootComplete (long timeOut)

    Blocks until the device's boot complete flag is set.

    พารามิเตอร์
    timeOut long : time in msecs to wait for the flag to be set

    ส่งคืน
    boolean true if device's boot complete flag is set within the timeout

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    waitForDeviceAvailable

    public abstract boolean waitForDeviceAvailable ()

    Waits for the device to be responsive and available for testing. Uses default timeout.

    ส่งคืน
    boolean True if device is available, False if recovery is disabled and unavailable.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    waitForDeviceAvailable

    public abstract boolean waitForDeviceAvailable (long waitTime)

    Waits for the device to be responsive and available for testing.

    พารามิเตอร์
    waitTime long : the time in ms to wait

    ส่งคืน
    boolean True if device is available, False if recovery is disabled and unavailable.

    Throws
    DeviceNotAvailableException if device is still unresponsive after waitTime expires.

    waitForDeviceAvailableInRecoverPath

    public abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)

    Waits for the device to be responsive and available without considering recovery path.

    พารามิเตอร์
    waitTime long

    ส่งคืน
    boolean True if device is available, False if unavailable.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    waitForDeviceBootloader

    public abstract void waitForDeviceBootloader ()

    Blocks until device is visible via fastboot. Use default timeout.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    waitForDeviceInRecovery

    public abstract boolean waitForDeviceInRecovery (long waitTime)

    Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery ).

    พารามิเตอร์
    waitTime long : the time in ms to wait

    ส่งคืน
    boolean true if device boots into recovery before time expires. false otherwise

    waitForDeviceInSideload

    public abstract boolean waitForDeviceInSideload (long waitTime)

    Blocks for the device to be in the 'adb sideload' state

    พารามิเตอร์
    waitTime long : the time in ms to wait

    ส่งคืน
    boolean true if device boots into sideload before time expires. false otherwise

    waitForDeviceNotAvailable

    public abstract boolean waitForDeviceNotAvailable (long waitTime)

    Blocks for the device to be not available ie missing from adb

    พารามิเตอร์
    waitTime long : the time in ms to wait

    ส่งคืน
    boolean true if device becomes not available before time expires. false otherwise

    waitForDeviceOnline

    public abstract void waitForDeviceOnline ()

    Blocks until device is visible via adb. Uses default timeout

    Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable() instead.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    waitForDeviceOnline

    public abstract void waitForDeviceOnline (long waitTime)

    Blocks until device is visible via adb.

    Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable() instead.

    พารามิเตอร์
    waitTime long : the time in ms to wait

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    waitForDeviceShell

    public abstract boolean waitForDeviceShell (long waitTime)

    Waits for device to be responsive to a basic adb shell command.

    พารามิเตอร์
    waitTime long : the time in ms to wait

    ส่งคืน
    boolean true if device becomes responsive before waitTime elapses.