อุปกรณ์เนทีฟ
public class NativeDevice
extends Object
implements IManagedTestDevice , IConfigurationReceiver , ITestLoggerReceiver
java.lang.Object | |
↳ | com.android.tradefed.device.NativeDevice |
การใช้งานเริ่มต้นของอุปกรณ์ Android แบบไม่เต็มสแต็ก ITestDevice
สรุป
คลาสที่ซ้อนกัน | |
---|---|
class | NativeDevice.AdbAction |
class | NativeDevice.AdbShellAction |
class | NativeDevice.RebootDeviceAction |
ค่าคงที่ | |
---|---|
int | INVALID_USER_ID ค่าที่ส่งคืนสำหรับรหัสผู้ใช้ที่ไม่ถูกต้อง/ไม่พบ: UserHandle กำหนดค่า -10000 |
long | MAX_HOST_DEVICE_TIME_OFFSET |
int | MAX_RETRY_ATTEMPTS จำนวนเริ่มต้นของคำสั่งที่พยายามดำเนินการอีกครั้ง |
เขตข้อมูล | |
---|---|
public static final String | DEBUGFS_PATH |
protected static final String | SD_CARD |
protected static final String | STORAGE_EMULATED |
protected TestDeviceOptions | mOptions |
protected final IDeviceStateMonitor | mStateMonitor
|
ผู้รับเหมาก่อสร้างสาธารณะ | |
---|---|
NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor) สร้าง |
วิธีการสาธารณะ | |
---|---|
void | batchPrefetchStartupBuildProps () การเพิ่มประสิทธิภาพระดับไมโคร (ประมาณ 400 มิลลิวินาที) โดยการดึงอุปกรณ์ประกอบฉากทั้งหมดที่เราต้องการล่วงหน้า แทนที่จะเรียก 'adb getprop' สำหรับแต่ละอุปกรณ์ |
boolean | canSwitchToHeadlessSystemUser () ส่งคืนว่าจะอนุญาตให้สลับไปใช้ผู้ใช้ SYSTEM ที่ไม่มีหัวหรือไม่ |
boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) ตรวจสอบว่าฟีเจอร์ได้รับการสนับสนุนในปัจจุบันหรือไม่โดยพิจารณาจากระดับที่รองรับขั้นต่ำสุด |
boolean | checkConnectivity () ตรวจสอบว่าอุปกรณ์นั้นมีการเชื่อมต่อเครือข่าย |
boolean | clearErrorDialogs () พยายามปิดกล่องโต้ตอบข้อผิดพลาดที่แสดงบน UI ของอุปกรณ์ในปัจจุบัน |
void | clearLastConnectedWifiNetwork () ล้างเครือข่าย wifi ที่เชื่อมต่อล่าสุด |
void | clearLogcat () ลบข้อมูล logcat ที่สะสมไว้ |
boolean | connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) เชื่อมต่อกับเครือข่าย wifi |
boolean | connectToWifiNetwork (String wifiSsid, String wifiPsk) เชื่อมต่อกับเครือข่าย wifi |
boolean | connectToWifiNetwork ( wifiSsidToPsk) connectToWifiNetwork ( wifiSsidToPsk) เชื่อมต่อกับเครือข่าย wifif |
boolean | connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid) เชื่อมต่อกับเครือข่าย wifi |
boolean | connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid) ตัวแปรของ |
boolean | connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk) ตัวแปรของ |
int | createUser (String name, boolean guest, boolean ephemeral) สร้างผู้ใช้ด้วยชื่อที่กำหนดและแฟล็กที่ให้ไว้ |
int | createUser (String name, boolean guest, boolean ephemeral, boolean forTesting) สร้างผู้ใช้ด้วยชื่อที่กำหนดและแฟล็กที่ให้ไว้ |
int | createUser (String name) สร้างผู้ใช้ด้วยชื่อที่กำหนดและแฟล็กเริ่มต้น 0 |
int | createUserNoThrow (String name) สร้างผู้ใช้ด้วยชื่อที่กำหนดและแฟล็กเริ่มต้น 0 |
void | deleteFile (String deviceFilePath) วิธีการช่วยเหลือในการลบไฟล์หรือไดเร็กทอรีบนอุปกรณ์ |
void | deregisterDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver) ลบ |
boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) เมธอดตัวช่วยเพื่อตรวจสอบว่าอุปกรณ์ซอฟต์รีสตาร์ทหรือไม่โดยการเปรียบเทียบ system_server ปัจจุบันกับ system_server |
boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) วิธีการช่วยเหลือเพื่อตรวจสอบว่าอุปกรณ์รีสตาร์ทแบบนุ่มนวลตั้งแต่เวลา UTC นับตั้งแต่ยุคจากอุปกรณ์และ |
boolean | disableAdbRoot () ปิดรูท adb |
void | disableKeyguard () พยายามปิดการใช้งานคีย์การ์ด |
boolean | disableNetworkMonitor () ปิดใช้งานการตรวจสอบเครือข่ายบนอุปกรณ์ |
boolean | disconnectFromWifi () ตัดการเชื่อมต่อจากเครือข่าย wifi |
boolean | doesFileExist (String deviceFilePath, int userId) วิธีการช่วยเหลือเพื่อตรวจสอบว่าไฟล์ในอุปกรณ์มีอยู่สำหรับผู้ใช้ที่กำหนดหรือไม่ |
boolean | doesFileExist (String deviceFilePath) วิธีการช่วยเหลือในการตรวจสอบว่ามีไฟล์ในอุปกรณ์อยู่หรือไม่ |
File | dumpHeap (String process, String devicePath) พยายามดัมพ์ฮีปจาก system_server |
boolean | enableAdbRoot () เปิดรูท adb |
boolean | enableNetworkMonitor () เปิดใช้งานการตรวจสอบเครือข่ายบนอุปกรณ์ |
String | executeAdbCommand (long timeout, String... cmdArgs) วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง adb เป็นคำสั่งระบบที่มีการหมดเวลาที่ระบุ |
String | executeAdbCommand (long timeout, envMap, String... cmdArgs) executeAdbCommand (long timeout, envMap, String... cmdArgs) วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง adb เป็นคำสั่งระบบที่มีการหมดเวลาที่ระบุ |
String | executeAdbCommand (String... cmdArgs) วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง adb เป็นคำสั่งระบบ |
CommandResult | executeFastbootCommand (String... cmdArgs) วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง fastboot เป็นคำสั่งระบบโดยมีการหมดเวลาเริ่มต้นที่ 2 นาที |
CommandResult | executeFastbootCommand (long timeout, String... cmdArgs) วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง fastboot เป็นคำสั่งระบบ |
CommandResult | executeLongFastbootCommand (String... cmdArgs) เมธอด Helper ซึ่งดำเนินการคำสั่ง fastboot ที่รันเป็นเวลานานเป็นคำสั่งระบบ |
CommandResult | executeLongFastbootCommand ( envVarMap, String... cmdArgs) executeLongFastbootCommand ( envVarMap, String... cmdArgs) เมธอดตัวช่วยเหลือซึ่งดำเนินการคำสั่ง fastboot ที่รันเป็นเวลานานเป็นคำสั่งระบบพร้อมตัวแปรสภาพแวดล้อมของระบบ |
String | executeShellCommand (String command) เมธอด Helper ซึ่งดำเนินการคำสั่งเชลล์ adb และส่งคืนเอาต์พุตเป็น |
void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) ดำเนินการคำสั่งเชลล์ adb โดยมีพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง |
void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) ดำเนินการคำสั่งเชลล์ adb โดยมีพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง |
void | executeShellCommand (String command, IShellOutputReceiver receiver) ดำเนินการคำสั่งเชลล์ adb ที่กำหนด ลองใหม่หลายครั้งหากคำสั่งล้มเหลว |
CommandResult | executeShellV2Command (String cmd) เมธอดตัวช่วยเหลือซึ่งดำเนินการคำสั่งเชลล์ adb และส่งคืนผลลัพธ์เป็น |
CommandResult | executeShellV2Command (String cmd, OutputStream pipeToOutput) เมธอดตัวช่วยซึ่งดำเนินการคำสั่งเชลล์ adb และส่งคืนผลลัพธ์เป็น |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput) เมธอดตัวช่วยซึ่งดำเนินการคำสั่งเชลล์ adb และส่งคืนผลลัพธ์เป็น |
CommandResult | executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) ดำเนินการคำสั่งเชลล์ adb โดยมีพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง |
CommandResult | executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit) ดำเนินการคำสั่งเชลล์ adb โดยมีพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) ดำเนินการคำสั่งเชลล์ adb โดยมีพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) ดำเนินการคำสั่งเชลล์ adb โดยมีพารามิเตอร์เพิ่มเติมเพื่อควบคุมลักษณะการทำงานของคำสั่ง |
CommandResult | fastbootWipePartition (String partition) วิธีการช่วยเหลือซึ่งจะล้างพาร์ติชั่นสำหรับอุปกรณ์ |
getActiveApexes () ดึงข้อมูลเกี่ยวกับ APEX ที่เปิดใช้งานบนอุปกรณ์ | |
getAllSettings (String namespace) ส่งกลับคู่ค่าคีย์ของเนมสเปซที่ร้องขอ | |
DeviceAllocationState | getAllocationState () ส่งคืนสถานะการจัดสรรปัจจุบันของอุปกรณ์ |
String | getAndroidId (int userId) ค้นหาและส่งกลับ android-id ที่เกี่ยวข้องกับ userId หากไม่พบจะเป็นโมฆะ |
getAndroidIds () สร้างแผนที่ของรหัส Android ที่พบว่าตรงกับรหัสผู้ใช้ | |
int | getApiLevel () รับระดับ API ของอุปกรณ์ |
PackageInfo | getAppPackageInfo (String packageName) ดึงข้อมูลเกี่ยวกับแพ็คเกจที่ติดตั้งบนอุปกรณ์ |
getAppPackageInfos () ดึงข้อมูลแพ็คเกจที่ติดตั้งบนอุปกรณ์ | |
String | getBasebandVersion () วิธีสะดวกในการรับเวอร์ชันเบสแบนด์ (วิทยุ) ของอุปกรณ์นี้ |
Integer | getBattery () ส่งกลับระดับแบตเตอรี่ปัจจุบันของอุปกรณ์หรือค่า Null หากระดับแบตเตอรี่ไม่พร้อมใช้งาน |
boolean | getBooleanProperty (String name, boolean defaultValue) ส่งคืนค่าบูลีนของคุณสมบัติที่กำหนด |
getBootHistory () วิธีตัวช่วยรวบรวมแผนผังประวัติการบูตพร้อมเวลาบูตและเหตุผลในการบูต | |
getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) วิธีการช่วยเหลือรวบรวมแผนที่ประวัติการบูตพร้อมเวลาบูตและเหตุผลในการบูตตั้งแต่เวลาที่กำหนดนับตั้งแต่ยุคจากอุปกรณ์และหน่วยเวลาที่ระบุ | |
String | getBootloaderVersion () วิธีสะดวกในการรับเวอร์ชัน bootloader ของอุปกรณ์นี้ |
InputStreamSource | getBugreport () ดึงรายงานข้อบกพร่องจากอุปกรณ์ |
InputStreamSource | getBugreportz () ดึง bugreportz จากอุปกรณ์ |
String | getBuildAlias () ดึงข้อมูลนามแฝงของบิลด์ที่อุปกรณ์กำลังทำงานอยู่ |
String | getBuildFlavor () ดึงข้อมูลบิลด์รสชาติสำหรับอุปกรณ์ |
String | getBuildId () ดึงข้อมูลบิลด์ที่อุปกรณ์กำลังทำงานอยู่ |
String | getBuildSigningKeys () ส่งกลับประเภทคีย์ที่ใช้ในการเซ็นชื่ออิมเมจอุปกรณ์ โดยทั่วไปอุปกรณ์ Android อาจลงนามด้วยคีย์ทดสอบ (เช่นใน AOSP) หรือคีย์การเปิดตัว (ควบคุมโดยผู้ผลิตอุปกรณ์แต่ละราย) |
DeviceDescriptor | getCachedDeviceDescriptor () ส่งคืน |
DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) ส่งคืน |
String[] | getChildren (String path) ทางเลือกอื่นนอกเหนือจากการใช้ |
AbstractConnection | getConnection () การเชื่อมต่อปัจจุบันที่เกี่ยวข้องกับอุปกรณ์ |
DeviceFoldableState | getCurrentFoldableState () ส่งคืนสถานะการพับได้ปัจจุบันของอุปกรณ์หรือเป็นค่าว่างหากเกิดปัญหาบางอย่าง |
int | getCurrentUser () ส่งกลับรหัสของผู้ใช้ที่ทำงานอยู่ในปัจจุบัน |
String | getDeviceClass () รับคลาสอุปกรณ์ |
long | getDeviceDate () ส่งกลับวันที่ของอุปกรณ์เป็นมิลลิวินาทีนับตั้งแต่ยุค |
DeviceDescriptor | getDeviceDescriptor () ส่งคืน |
DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) ส่งคืน |
TestDeviceState | getDeviceState () รับสถานะของอุปกรณ์ |
long | getDeviceTimeOffset (Date date) ตัวช่วยในการรับค่าความแตกต่างของเวลาระหว่างอุปกรณ์กับ |
InputStreamSource | getEmulatorOutput () รับสตรีมของ emulator stdout และ stderr |
Process | getEmulatorProcess () ส่งคืน |
final File | getExecuteShellCommandLog () บันทึกที่มีบันทึก |
long | getExternalStoreFreeSpace () วิธีการช่วยเหลือเพื่อกำหนดจำนวนพื้นที่ว่างบนอุปกรณ์จัดเก็บข้อมูลภายนอก |
String | getFastbootPath () ส่งคืนเส้นทางของไบนารี fastboot ที่ใช้งานอยู่ |
String | getFastbootProductType () วิธีสะดวกในการรับประเภทผลิตภัณฑ์ของอุปกรณ์นี้เมื่ออยู่ในโหมด fastboot |
String | getFastbootProductVariant () วิธีสะดวกในการรับประเภทผลิตภัณฑ์ของอุปกรณ์นี้เมื่ออยู่ในโหมด fastboot |
String | getFastbootSerialNumber () ส่งกลับหมายเลขซีเรียลของโหมด fastboot |
String | getFastbootVariable (String variableName) รับค่าตัวแปร fastboot ที่กำหนดจากอุปกรณ์ |
String | getFastbootVersion () ส่งคืนสตริงเวอร์ชันของไบนารี fastboot ที่ใช้งานอยู่ |
IFileEntry | getFileEntry (String path) ดึงข้อมูลอ้างอิงไปยังไฟล์ระยะไกลบนอุปกรณ์ |
IFileEntry | getFileEntry (FileListingService.FileEntry entry) ผู้ช่วยอย่างไม่เป็นทางการในการรับ |
getFoldableStates () ส่งคืนรายการสถานะแบบพับได้บนอุปกรณ์ | |
IDevice | getIDevice () ส่งกลับการอ้างอิงไปยัง ddmlib |
getInstalledPackageNames () ดึงข้อมูลชื่อแพ็คเกจแอปพลิเคชันที่ปรากฏบนอุปกรณ์ | |
long | getIntProperty (String name, long defaultValue) ส่งคืนค่าจำนวนเต็มของคุณสมบัติที่กำหนดจากอุปกรณ์ |
String | getIpAddress () รับที่อยู่ IP ของอุปกรณ์ |
KeyguardControllerState | getKeyguardState () ส่งคืนอ็อบเจ็กต์เพื่อรับสถานะปัจจุบันของคีย์การ์ดหรือค่าว่างหากไม่รองรับ |
long | getLastExpectedRebootTimeMillis () ส่งคืนครั้งล่าสุดที่ Tradefed API ทริกเกอร์การรีบูตในหน่วยมิลลิวินาทีนับตั้งแต่ EPOCH ซึ่งส่งคืนโดย |
int | getLaunchApiLevel () รับระดับ API ที่เปิดตัวครั้งแรกของอุปกรณ์ |
InputStreamSource | getLogcat () ดึงกระแสข้อมูลสแน็ปช็อตของข้อมูล logcat |
InputStreamSource | getLogcat (int maxBytes) ดึงสตรีมสแนปชอตของ |
InputStreamSource | getLogcatDump () รับดัมพ์ของ logcat ปัจจุบันสำหรับอุปกรณ์ |
InputStreamSource | getLogcatSince (long date) ดึงสตรีมสแน็ปช็อตของข้อมูล Logcat ที่บันทึกไว้โดยเริ่มตั้งแต่วันที่ที่ให้ไว้ |
String | getMacAddress () ส่งกลับที่อยู่ MAC ของอุปกรณ์ จะเป็นโมฆะหากล้มเหลวในการสืบค้นจากอุปกรณ์ |
Integer | getMainUserId () ส่งกลับรหัสผู้ใช้หลัก |
getMainlineModuleInfo () รับข้อมูลเกี่ยวกับโมดูลเมนไลน์ที่ติดตั้งบนอุปกรณ์ | |
int | getMaxNumberOfRunningUsersSupported () รับจำนวนผู้ใช้ที่ทำงานพร้อมกันสูงสุดที่รองรับ |
int | getMaxNumberOfUsersSupported () รับจำนวนผู้ใช้ที่รองรับสูงสุด |
Process | getMicrodroidProcess () |
IDeviceStateMonitor | getMonitor () ส่งคืน |
String | getMountPoint (String mountName) ส่งกลับจุดเมานต์ |
ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) ส่งคืน |
getMountPointInfo () ส่งคืนเวอร์ชันที่แยกวิเคราะห์ของข้อมูลใน /proc/mounts บนอุปกรณ์ | |
TestDeviceOptions | getOptions () ดึงตัวเลือกการทดสอบสำหรับอุปกรณ์ |
long | getPartitionFreeSpace (String partition) วิธีการช่วยเหลือเพื่อกำหนดจำนวนพื้นที่ว่างบนพาร์ติชันอุปกรณ์ |
Integer | getPrimaryUserId () ส่งกลับรหัสผู้ใช้หลัก |
ProcessInfo | getProcessByName (String processName) เมธอด Helper รันคำสั่ง "pidof" และ "stat" และส่งคืนออบเจ็กต์ |
String | getProcessPid (String process) ส่งกลับค่า pid ของบริการหรือค่าว่างหากมีข้อผิดพลาดเกิดขึ้น |
String | getProductType () วิธีสะดวกในการรับผลิตภัณฑ์ประเภทอุปกรณ์นี้ |
String | getProductVariant () วิธีสะดวกในการรับตัวเลือกผลิตภัณฑ์ของอุปกรณ์นี้ |
String | getProperty (String name) ดึงค่าคุณสมบัติที่กำหนดจากอุปกรณ์ |
ITestDevice.RecoveryMode | getRecoveryMode () รับโหมดการกู้คืนปัจจุบันที่ใช้กับอุปกรณ์ |
InputStreamSource | getScreenshot (String format) จับภาพหน้าจอจากอุปกรณ์ |
InputStreamSource | getScreenshot (long displayId) จับภาพหน้าจอจากอุปกรณ์ที่ระบุรหัสที่แสดง |
InputStreamSource | getScreenshot (String format, boolean rescale) จับภาพหน้าจอจากอุปกรณ์ |
InputStreamSource | getScreenshot () จับภาพหน้าจอจากอุปกรณ์ |
String | getSerialNumber () วิธีสะดวกในการรับหมายเลขซีเรียลของอุปกรณ์นี้ |
String | getSetting (int userId, String namespace, String key) ส่งกลับค่าของการตั้งค่าที่ร้องขอ |
String | getSetting (String namespace, String key) ดู |
String | getSimOperator () ส่งคืนผู้ให้บริการซิมการ์ดหรือเป็นค่าว่างหากไม่มีหรืออุปกรณ์ไม่พร้อมใช้งาน |
String | getSimState () คืนสถานะซิมการ์ดหรือเป็นโมฆะหากไม่มีหรืออุปกรณ์ไม่พร้อมใช้งาน |
getTombstones () ดึงและส่งคืนรายการศิลาจารึกหลุมศพจากอุปกรณ์ | |
long | getTotalMemory () ส่งกลับขนาดหน่วยความจำฟิสิคัลทั้งหมดเป็นไบต์หรือ -1 ในกรณีที่เกิดข้อผิดพลาดภายใน |
getUninstallablePackageNames () ดึงข้อมูลชื่อแพ็คเกจแอปพลิเคชันที่สามารถถอนการติดตั้งได้ | |
boolean | getUseFastbootErase () รับว่าจะใช้การลบ fastboot หรือรูปแบบ fastboot เพื่อล้างพาร์ติชั่นบนอุปกรณ์ |
int | getUserFlags (int userId) ค้นหาและส่งคืนแฟล็กของผู้ใช้ที่กำหนด |
getUserInfos () รับแผนที่ของ useId ไปยัง | |
int | getUserSerialNumber (int userId) หากพบ ให้ส่งคืนหมายเลขซีเรียลที่เกี่ยวข้องกับรหัสผู้ใช้ -10000 ในกรณีอื่นๆ |
IManagedTestDevice.DeviceEventResponse | handleAllocationEvent (DeviceEvent event) ประมวลผล DeviceEvent ที่กำหนด ประมวลผล DeviceEvent ซึ่งอาจหรืออาจจะไม่เปลี่ยนอุปกรณ์นี้เป็นสถานะการจัดสรรใหม่ |
boolean | hasFeature (String feature) ตรวจสอบว่ามีคุณสมบัติพร้อมใช้งานบนอุปกรณ์หรือไม่ |
String | installPackage (File packageFile, boolean reinstall, String... extraArgs) ติดตั้งแพ็คเกจ Android บนอุปกรณ์ |
String | installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs) ติดตั้งแพ็คเกจ Android บนอุปกรณ์ |
String | installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs) ติดตั้งแพ็คเกจ Android บนอุปกรณ์สำหรับผู้ใช้ที่กำหนด |
String | installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) ติดตั้งแพ็คเกจ Android บนอุปกรณ์สำหรับผู้ใช้ที่กำหนด |
void | invalidatePropertyCache () |
boolean | isAdbRoot () |
boolean | isAdbTcp () |
boolean | isAppEnumerationSupported () ตรวจสอบว่าแพลตฟอร์มบนอุปกรณ์รองรับการแจงนับแอปหรือไม่ |
boolean | isBypassLowTargetSdkBlockSupported () ตรวจสอบว่าแพลตฟอร์มบนอุปกรณ์รองรับการข้ามบล็อก SDK เป้าหมายต่ำในการติดตั้งแอปหรือไม่ |
boolean | isDebugfsMounted () ตรวจสอบว่ามีการติดตั้ง debugfs หรือไม่ |
boolean | isDeviceEncrypted () ส่งคืนหากอุปกรณ์ถูกเข้ารหัส |
boolean | isDirectory (String path) ส่งคืน True หากเส้นทางบนอุปกรณ์เป็นไดเร็กทอรี มิเช่นนั้นจะเป็น false |
boolean | isEnableAdbRoot () |
boolean | isEncryptionSupported () ส่งคืนหากอุปกรณ์รองรับการเข้ารหัส |
boolean | isExecutable (String fullPath) ส่งคืน True หากเส้นทางของไฟล์บนอุปกรณ์เป็นไฟล์ปฏิบัติการ มิฉะนั้นจะเป็นเท็จ |
boolean | isFastbootEnabled () ส่งคืนหาก fastboot พร้อมใช้งานสำหรับอุปกรณ์ |
boolean | isHeadless () คืนค่าเป็นจริงหากอุปกรณ์ไม่มีหัว (ไม่มีหน้าจอ) หากเป็นเท็จมิฉะนั้น |
boolean | isHeadlessSystemUserMode () ส่งคืนว่าอุปกรณ์ใช้โหมดผู้ใช้ระบบ headless หรือไม่ |
boolean | isMainUserPermanentAdmin () คืนค่าว่าผู้ใช้หลักเป็นผู้ดูแลระบบถาวรหรือไม่ และไม่สามารถลบหรือดาวน์เกรดเป็นสถานะที่ไม่ใช่ผู้ดูแลระบบได้ |
boolean | isMultiUserSupported () กำหนดว่ารองรับผู้ใช้หลายรายหรือไม่ |
boolean | isPackageInstalled (String packageName, String userId) ค้นหาอุปกรณ์สำหรับชื่อแพ็คเกจที่กำหนดและรหัสผู้ใช้ที่กำหนดเพื่อตรวจสอบว่ามีการติดตั้งในปัจจุบันหรือไม่สำหรับผู้ใช้นั้น |
boolean | isPackageInstalled (String packageName) ค้นหาอุปกรณ์สำหรับชื่อแพ็คเกจที่กำหนดเพื่อตรวจสอบว่ามีการติดตั้งอยู่หรือไม่ |
boolean | isRuntimePermissionSupported () ตรวจสอบว่าแพลตฟอร์มบนอุปกรณ์รองรับการให้สิทธิ์รันไทม์หรือไม่ |
boolean | isStateBootloaderOrFastbootd () คืนค่าเป็นจริงหากอุปกรณ์อยู่ใน |
boolean | isUserRunning (int userId) ตรวจสอบว่าผู้ใช้ที่กำหนดกำลังทำงานอยู่หรือไม่ |
boolean | isUserSecondary (int userId) ส่งคืนว่าผู้ใช้ที่ระบุเป็นผู้ใช้รองตามแฟล็กหรือไม่ |
boolean | isUserVisible (int userId) ตรวจสอบว่าผู้ใช้ที่ระบุปรากฏให้เห็นหรือไม่ |
boolean | isUserVisibleOnDisplay (int userId, int displayId) ตรวจสอบว่าผู้ใช้ที่กำหนดปรากฏให้เห็นในจอแสดงผลที่กำหนดหรือไม่ |
boolean | isVisibleBackgroundUsersOnDefaultDisplaySupported () ส่งคืนว่าอุปกรณ์อนุญาตให้ผู้ใช้เริ่มมองเห็นได้ในพื้นหลังหรือไม่ใน |
boolean | isVisibleBackgroundUsersSupported () แสดงผลว่าอุปกรณ์อนุญาตให้ผู้ใช้เริ่มมองเห็นได้ในเบื้องหลังหรือไม่ |
boolean | isWifiEnabled () ทดสอบว่าเปิดใช้งาน wifi หรือไม่ |
listDisplayIds () รวบรวมรายการรหัสการแสดงผลที่มีอยู่บนอุปกรณ์ตามที่รายงานโดย "dumpsys SurfaceFlinger" | |
listDisplayIdsForStartingVisibleBackgroundUsers () รับรายการจอแสดงผลที่สามารถใช้เพื่อ | |
listUsers () รับรายชื่อผู้ใช้บนอุปกรณ์ | |
boolean | logAnrs ( ITestLogger logger) รวบรวมและบันทึก ANR จากอุปกรณ์ |
boolean | logBugreport (String dataName, ITestLogger listener) วิธีการช่วยเหลือในการจัดทำรายงานข้อผิดพลาดและบันทึกไปยังผู้รายงาน |
void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) บันทึกข้อความใน logcat ของอุปกรณ์ |
void | mountDebugfs () เมานต์ debugfs |
void | nonBlockingReboot () ออกคำสั่งให้รีบูทอุปกรณ์และส่งคืนเมื่อคำสั่งเสร็จสมบูรณ์ และเมื่อ adb ไม่สามารถมองเห็นอุปกรณ์ได้อีกต่อไป |
void | postAdbRootAction () แทนที่หากอุปกรณ์จำเป็นต้องดำเนินการบางอย่างหลังจากรูท adb และก่อนที่อุปกรณ์จะกลับมาออนไลน์ |
void | postAdbUnrootAction () แทนที่หากอุปกรณ์จำเป็นต้องดำเนินการบางอย่างหลังจากยกเลิกการรูท adb และก่อนที่อุปกรณ์จะกลับมาออนไลน์ |
void | postBootSetup () ปฏิบัติตามคำแนะนำเพื่อกำหนดค่าอุปกรณ์สำหรับการทดสอบหลังการบู๊ตทุกครั้ง |
void | postInvocationTearDown (Throwable exception) ขั้นตอนเพิ่มเติมสำหรับการล้างข้อมูลที่จำเป็นเฉพาะอุปกรณ์ที่จะดำเนินการหลังจากการเรียกใช้เสร็จสิ้น |
void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) ขั้นตอนเพิ่มเติมสำหรับการตั้งค่าที่จำเป็นเฉพาะอุปกรณ์ที่จะดำเนินการบนอุปกรณ์ก่อนขั้นตอนการเรียกใช้ |
boolean | pullDir (String deviceFilePath, File localDir) ดึงเนื้อหาไดเร็กทอรีจากอุปกรณ์ซ้ำๆ |
boolean | pullFile (String remoteFilePath, File localFile) ดึงไฟล์ออกจากอุปกรณ์ |
File | pullFile (String remoteFilePath, int userId) ดึงไฟล์ออกจากอุปกรณ์ เก็บไว้ใน |
File | pullFile (String remoteFilePath) ดึงไฟล์ออกจากอุปกรณ์ เก็บไว้ใน |
boolean | pullFile (String remoteFilePath, File localFile, int userId) ดึงไฟล์ออกจากอุปกรณ์ |
String | pullFileContents (String remoteFilePath) ดึงไฟล์ออกจากอุปกรณ์ และส่งคืนเนื้อหา |
File | pullFileFromExternal (String remoteFilePath) วิธีการอำนวยความสะดวกในการดึงไฟล์จากที่จัดเก็บข้อมูลภายนอกของอุปกรณ์ จัดเก็บไว้ใน |
boolean | pushDir (File localFileDir, String deviceFilePath, excludedDirectories) pushDir (File localFileDir, String deviceFilePath, excludedDirectories) พุชเนื้อหาไดเร็กทอรีไปยังอุปกรณ์ซ้ำ ๆ โดยไม่รวมไดเร็กทอรีบางตัวที่ถูกกรอง |
boolean | pushDir (File localFileDir, String deviceFilePath) พุชเนื้อหาไดเร็กทอรีไปยังอุปกรณ์ซ้ำ ๆ |
boolean | pushFile (File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded) ตัวแปรของ |
boolean | pushFile (File localFile, String remoteFilePath) พุชไฟล์ไปยังอุปกรณ์ |
boolean | pushString (String contents, String remoteFilePath) พุชไฟล์ที่สร้างจากสตริงไปยังอุปกรณ์ |
void | reboot (String reason) รีบูตอุปกรณ์เข้าสู่โหมด adb โดยระบุ |
void | reboot () รีบูตอุปกรณ์เข้าสู่โหมด adb |
void | rebootIntoBootloader () รีบูตอุปกรณ์เข้าสู่โหมด bootloader |
void | rebootIntoFastbootd () รีบูตอุปกรณ์เข้าสู่โหมด fastbootd |
void | rebootIntoRecovery () รีบูตอุปกรณ์เข้าสู่โหมดการกู้คืน adb |
void | rebootIntoSideload () รีบูตอุปกรณ์เข้าสู่โหมด adb sideload (โปรดทราบว่านี่เป็นโหมดพิเศษภายใต้การกู้คืน) บล็อกจนกว่าอุปกรณ์จะเข้าสู่โหมดไซด์โหลด |
void | rebootIntoSideload (boolean autoReboot) รีบูตอุปกรณ์เข้าสู่โหมด adb sideload (โปรดทราบว่านี่เป็นโหมดพิเศษภายใต้การกู้คืน) บล็อกจนกว่าอุปกรณ์จะเข้าสู่โหมดไซด์โหลด |
void | rebootUntilOnline () ตัวเลือกอื่นในการ |
void | rebootUntilOnline (String reason) ตัวเลือกอื่นในการ |
void | rebootUserspace () รีบูตเฉพาะส่วนพื้นที่ผู้ใช้ของอุปกรณ์ |
void | rebootUserspaceUntilOnline () ตัวเลือกอื่นในการ |
boolean | recoverDevice () พยายามกู้คืนการสื่อสารของอุปกรณ์ |
void | registerDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver) ลงทะเบียน |
void | remountSystemReadOnly () ทำให้พาร์ติชันระบบบนอุปกรณ์เป็นแบบอ่านอย่างเดียว |
void | remountSystemWritable () ทำให้พาร์ติชันระบบบนอุปกรณ์สามารถเขียนได้ |
void | remountVendorReadOnly () ทำให้พาร์ติชันผู้จำหน่ายบนอุปกรณ์เป็นแบบอ่านอย่างเดียว |
void | remountVendorWritable () ทำให้พาร์ติชันผู้จำหน่ายบนอุปกรณ์สามารถเขียนได้ |
boolean | removeAdmin (String componentName, int userId) ลบผู้ดูแลอุปกรณ์ที่กำหนดในผู้ใช้ที่กำหนด และคืนค่า |
void | removeOwners () ลบเจ้าของโปรไฟล์อุปกรณ์ที่มีอยู่ทั้งหมดออกด้วยความพยายามอย่างดีที่สุด |
boolean | removeUser (int userId) ลบผู้ใช้ที่กำหนดออกจากอุปกรณ์ |
void | resetContentProviderSetup () รีเซ็ตการตั้งค่าสถานะสำหรับการตั้งค่าผู้ให้บริการเนื้อหาเพื่อทริกเกอร์อีกครั้ง |
boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) วิธีอำนวยความสะดวกสำหรับการดำเนินการ |
boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) รันการทดสอบเครื่องมือและให้การกู้คืนอุปกรณ์ |
boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) เหมือนกับ |
boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) เหมือนกับ |
void | setConfiguration ( IConfiguration configuration) แทรก |
final void | setConnectionAvdInfo ( GceAvdInfo avdInfo) |
void | setDate (Date date) ตั้งวันที่บนอุปกรณ์ หมายเหตุ: การตั้งค่าวันที่บนอุปกรณ์ต้องใช้การรูท |
boolean | setDeviceOwner (String componentName, int userId) ตั้งค่าองค์ประกอบผู้ดูแลระบบอุปกรณ์เป็นเจ้าของอุปกรณ์ในผู้ใช้ที่กำหนด |
void | setDeviceState ( TestDeviceState deviceState) อัปเดตสถานะของอุปกรณ์ |
void | setEmulatorOutputStream ( SizeLimitedOutputStream output) สำหรับโปรแกรมจำลอง ให้ตั้งค่า |
void | setEmulatorProcess (Process p) ตั้งค่า |
void | setFastbootEnabled (boolean fastbootEnabled) ตั้งค่าตัวเลือก fastboot สำหรับอุปกรณ์ |
void | setFastbootPath (String fastbootPath) กำหนดเส้นทางไปยังไบนารี fastboot ที่ควรใช้ |
void | setIDevice (IDevice newDevice) อัปเดต IDevice ที่เกี่ยวข้องกับ ITestDevice นี้ |
void | setLogStartDelay (int delay) ตั้งเวลาเป็น ms เพื่อรอก่อนที่จะเริ่มการจับ logcat สำหรับอุปกรณ์ออนไลน์ |
void | setOptions ( TestDeviceOptions options) ตั้งค่า |
boolean | setProperty (String propKey, String propValue) ตั้งค่าคุณสมบัติที่กำหนดบนอุปกรณ์ |
void | setRecovery ( IDeviceRecovery recovery) ตั้งค่า |
void | setRecoveryMode ( ITestDevice.RecoveryMode mode) ตั้งค่าโหมดการกู้คืนปัจจุบันเพื่อใช้สำหรับอุปกรณ์ |
void | setSetting (String namespace, String key, String value) ดู |
void | setSetting (int userId, String namespace, String key, String value) เพิ่มค่าการตั้งค่าให้กับเนมสเปซของผู้ใช้ที่กำหนด |
void | setTestLogger ( ITestLogger testLogger) แทรกอินสแตนซ์ |
void | setUseFastbootErase (boolean useFastbootErase) ตั้งค่าว่าจะใช้การลบ fastboot หรือรูปแบบ fastboot เพื่อล้างพาร์ติชั่นบนอุปกรณ์ |
void | startLogcat () เริ่มจับเอาต์พุต logcat จากอุปกรณ์ในเบื้องหลัง |
boolean | startUser (int userId) เริ่มต้นผู้ใช้ที่กำหนดในเบื้องหลังหากหยุดทำงานอยู่ในปัจจุบัน |
boolean | startUser (int userId, boolean waitFlag) เริ่มต้นผู้ใช้ที่กำหนดในเบื้องหลังหากหยุดทำงานอยู่ในปัจจุบัน |
boolean | startVisibleBackgroundUser (int userId, int displayId, boolean waitFlag) เริ่มต้นผู้ใช้ที่กำหนดในพื้นหลัง ซึ่งมองเห็นได้ในจอแสดงผลที่กำหนด (เช่น อนุญาตให้ผู้ใช้เปิดกิจกรรมในจอแสดงผลนั้น) |
void | stopEmulatorOutput () ปิดและลบเอาต์พุตโปรแกรมจำลอง |
void | stopLogcat () หยุดการจับเอาต์พุต logcat จากอุปกรณ์ และละทิ้งข้อมูล logcat ที่บันทึกไว้ในปัจจุบัน |
boolean | stopUser (int userId) หยุดผู้ใช้ที่กำหนด |
boolean | stopUser (int userId, boolean waitFlag, boolean forceFlag) หยุดผู้ใช้ที่กำหนด |
String | switchToAdbTcp () สลับอุปกรณ์ไปที่โหมด adb-over-tcp |
boolean | switchToAdbUsb () สลับอุปกรณ์เป็น adb ผ่านโหมด usb |
boolean | switchUser (int userId) สลับไปใช้รหัสผู้ใช้อื่นโดยมีการหมดเวลาเริ่มต้น |
boolean | switchUser (int userId, long timeout) สลับไปใช้รหัสผู้ใช้อื่นโดยให้หมดเวลาตามกำหนดเวลา |
boolean | syncFiles (File localFileDir, String deviceFilePath) ซิงค์เนื้อหาของไดเร็กทอรีไฟล์ในเครื่องกับอุปกรณ์แบบค่อยเป็นค่อยไป |
Bugreport | takeBugreport () รับรายงานข้อบกพร่องและส่งคืนภายในวัตถุ |
String | uninstallPackage (String packageName) ถอนการติดตั้งแพ็คเกจ Android ออกจากอุปกรณ์ |
String | uninstallPackageForUser (String packageName, int userId) ถอนการติดตั้งแพ็คเกจ Android จากอุปกรณ์สำหรับผู้ใช้ที่กำหนด |
boolean | unlockDevice () ปลดล็อคอุปกรณ์หากอุปกรณ์อยู่ในสถานะเข้ารหัส |
void | unmountDebugfs () ถอนติดตั้ง debugfs |
boolean | waitForBootComplete (long timeOut) บล็อกจนกว่าจะตั้งค่าสถานะการบูตเสร็จสมบูรณ์ของอุปกรณ์ |
boolean | waitForDeviceAvailable () รอให้อุปกรณ์ตอบสนองและพร้อมสำหรับการทดสอบ |
boolean | waitForDeviceAvailable (long waitTime) รอให้อุปกรณ์ตอบสนองและพร้อมสำหรับการทดสอบ |
boolean | waitForDeviceAvailableInRecoverPath (long waitTime) รอให้อุปกรณ์ตอบสนองและพร้อมใช้งานโดยไม่คำนึงถึงเส้นทางการกู้คืน |
void | waitForDeviceBootloader () บล็อกจนกว่าอุปกรณ์จะมองเห็นได้ผ่าน fastboot |
boolean | waitForDeviceInRecovery (long waitTime) บล็อกสำหรับอุปกรณ์ให้อยู่ในสถานะ 'การกู้คืน adb' (โปรดทราบว่าสิ่งนี้แตกต่างจาก |
boolean | waitForDeviceInSideload (long waitTime) บล็อกอุปกรณ์ให้อยู่ในสถานะ 'adb sideload' |
boolean | waitForDeviceNotAvailable (long waitTime) บล็อกสำหรับอุปกรณ์ไม่พร้อมใช้งาน เช่น หายไปจาก adb |
void | waitForDeviceOnline () บล็อกจนกว่าอุปกรณ์จะมองเห็นได้ผ่าน adb |
void | waitForDeviceOnline (long waitTime) บล็อกจนกว่าอุปกรณ์จะมองเห็นได้ผ่าน adb |
boolean | waitForDeviceShell (long waitTime) รอให้อุปกรณ์ตอบสนองต่อคำสั่งเชลล์ adb พื้นฐาน |
วิธีการที่ได้รับการป้องกัน | |
---|---|
void | addExtraConnectionBuilderArgs ( DefaultConnection.ConnectionBuilder builder) |
String[] | buildAdbShellCommand (String command, boolean forceExitStatusDetection) สร้างคำสั่ง OS สำหรับเซสชันคำสั่ง adb เชลล์และ args ที่กำหนด |
void | checkApiLevelAgainst (String feature, int strictMinLevel) |
NativeDevice.RebootDeviceAction | createRebootDeviceAction ( NativeDevice.RebootMode rebootMode, String reason) สร้าง |
IRunUtil | createRunUtil () |
void | doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason) ทำการรีบูต adb |
void | ensureRuntimePermissionSupported () วิธีการช่วยเหลือในการส่งข้อยกเว้นหากไม่รองรับการอนุญาตรันไทม์ |
int | getApiLevelSafe () |
ITestLogger | getLogger () |
IRunUtil | getRunUtil () รับอินสแตนซ์ |
void | initializeConnection ( IBuildInfo info, MultiMap <String, String> attributes) |
String | internalGetProperty (String propName, String fastbootVar, String description) ดึงคุณสมบัติของอุปกรณ์จากแคช ddmlib ตามค่าเริ่มต้น และถอยกลับไปที่ `adb shell getprop` หรือ `fastboot getvar` ขึ้นอยู่กับว่าอุปกรณ์อยู่ใน Fastboot หรือไม่ |
boolean | isInRebootCallback () ส่งคืนว่าการรีบูตการโทรกลับกำลังดำเนินการอยู่หรือไม่ |
boolean | isNewer (File localFile, IFileEntry entry) คืน |
void | notifyRebootEnded () แจ้ง |
void | notifyRebootStarted () แจ้ง |
boolean | performDeviceAction (String actionDescription, NativeDevice.DeviceAction action, int retryAttempts) ดำเนินการบนอุปกรณ์นี้ |
void | postAdbReboot () การดำเนินการพิเศษที่เป็นไปได้ที่สามารถทำได้หลังจากรีบูต |
void | prePostBootSetup () อนุญาตให้อุปกรณ์แต่ละประเภท (AndroidNativeDevice, TestDevice) ลบล้างวิธีนี้สำหรับการตั้งค่าหลังการบูตที่เฉพาะเจาะจง |
boolean | pullFileInternal (String remoteFilePath, File localFile) |
void | setClock (Clock clock) ตั้งค่าอินสแตนซ์นาฬิกาที่จะใช้ |
void | setMicrodroidProcess (Process process) ทำเครื่องหมาย TestDevice เป็น microdroid และตั้งค่า CID |
void | setTestDeviceOptions ( deviceOptions) setTestDeviceOptions ( deviceOptions) |
CommandResult | simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) ดำเนินการคำสั่ง fastboot แบบง่ายพร้อมตัวแปรสภาพแวดล้อมและรายงานสถานะของคำสั่ง |
CommandResult | simpleFastbootCommand (long timeout, String[] fullCmd) ดำเนินการคำสั่ง fastboot แบบธรรมดาและรายงานสถานะของคำสั่ง |
boolean | waitForDeviceNotAvailable (String operationDesc, long time) รอเพื่อดูว่าอุปกรณ์ใช้งานไม่ได้ (หยุดการรายงานไปยัง adb) |
ค่าคงที่
INVALID_USER_ID
public static final int INVALID_USER_ID
ค่าที่ส่งคืนสำหรับรหัสผู้ใช้ที่ไม่ถูกต้อง/ไม่พบ: UserHandle กำหนดค่า -10000
ค่าคงที่: -10000 (0xffffd8f0)
MAX_HOST_DEVICE_TIME_OFFSET
protected static final long MAX_HOST_DEVICE_TIME_OFFSET
ค่าคงที่: 5,000 (0x0000000000001388)
MAX_RETRY_ATTEMPTS
protected static final int MAX_RETRY_ATTEMPTS
จำนวนเริ่มต้นของคำสั่งที่พยายามดำเนินการอีกครั้ง
ค่าคงที่: 2 (0x00000002)
เขตข้อมูล
DEBUGFS_PATH
public static final String DEBUGFS_PATH
SD_การ์ด
protected static final String SD_CARD
STORAGE_EMULATED
protected static final String STORAGE_EMULATED
ผู้รับเหมาก่อสร้างสาธารณะ
อุปกรณ์เนทีฟ
public NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
สร้าง TestDevice
พารามิเตอร์ | |
---|---|
device | IDevice : IDevice ที่เกี่ยวข้อง |
stateMonitor | IDeviceStateMonitor : กลไก IDeviceStateMonitor ที่จะใช้ |
allocationMonitor | IDeviceMonitor : IDeviceMonitor เพื่อแจ้งการเปลี่ยนแปลงสถานะการจัดสรร สามารถเป็นโมฆะได้ |
วิธีการสาธารณะ
ชุดPrefetchStartupBuildProps
public void batchPrefetchStartupBuildProps ()
การเพิ่มประสิทธิภาพระดับไมโคร (ประมาณ 400 มิลลิวินาที) โดยการดึงอุปกรณ์ประกอบฉากทั้งหมดที่เราต้องการล่วงหน้า แทนที่จะเรียก 'adb getprop' สำหรับแต่ละอุปกรณ์ กล่าวคือ การดึงข้อมูลคุณสมบัติทั้งหมดนั้นรวดเร็วพอๆ กับการดึงข้อมูลอย่างใดอย่างหนึ่ง สิ่งต่างๆ เช่น device.getApiLevel(), checkApiLevelAgainstNextRelease และ getBuildAlias ต่างก็เรียก `adb getprop` ภายใต้ประทุน เราดึงข้อมูลเหล่านั้นมาในการโทรครั้งเดียวและเรียก NativeDevice.setProperty แม้ว่าเราจะไม่ทำเช่นนี้ NativeDevice จะเรียกใช้ setProperty และแคชผลลัพธ์สำหรับการโทรในอนาคต เรากำลังทำมันก่อนหน้านี้เล็กน้อย หากอุปกรณ์อยู่ในการกู้คืนหรือมีข้อผิดพลาดอื่นๆ ในการดึงอุปกรณ์ประกอบฉาก เราก็จะเพิกเฉยต่อสิ่งเหล่านั้น
สามารถ SwitchToHeadlessSystemUser
public boolean canSwitchToHeadlessSystemUser ()
ส่งคืนว่าจะอนุญาตให้สลับไปใช้ผู้ใช้ SYSTEM ที่ไม่มีหัวหรือไม่
การส่งคืน | |
---|---|
boolean |
ขว้าง | |
---|---|
DeviceNotAvailableException |
checkApiLevelAgainstNextRelease
public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
ตรวจสอบว่าฟีเจอร์ได้รับการสนับสนุนในปัจจุบันหรือไม่โดยพิจารณาจากระดับที่รองรับขั้นต่ำสุด วิธีนี้จะคำนึงถึงฟีเจอร์ที่ยังไม่เผยแพร่ก่อนที่ระดับ API จะเพิ่มขึ้น
พารามิเตอร์ | |
---|---|
strictMinLevel | int : ระดับขั้นต่ำที่เป็นไปได้ที่เข้มงวดซึ่งสนับสนุนคุณลักษณะนี้ |
การส่งคืน | |
---|---|
boolean | เป็นจริงหากระดับได้รับการสนับสนุน เท็จเป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ตรวจสอบการเชื่อมต่อ
public boolean checkConnectivity ()
ตรวจสอบว่าอุปกรณ์นั้นมีการเชื่อมต่อเครือข่าย
การส่งคืน | |
---|---|
boolean | true หากอุปกรณ์มีการเชื่อมต่อเครือข่ายที่ใช้งานได้ false เกิน |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ล้างข้อผิดพลาด Dialogs
public boolean clearErrorDialogs ()
พยายามปิดกล่องโต้ตอบข้อผิดพลาดที่แสดงบน UI ของอุปกรณ์ในปัจจุบัน
การส่งคืน | |
---|---|
boolean | true หากไม่มีไดอะล็อกปรากฏหรือล้างไดอะล็อกสำเร็จ false เป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
clearLastConnectedWifiNetwork
public void clearLastConnectedWifiNetwork ()
ล้างเครือข่าย wifi ที่เชื่อมต่อล่าสุด ควรเรียกสิ่งนี้เมื่อเริ่มการร้องขอใหม่เพื่อหลีกเลี่ยงการเชื่อมต่อกับเครือข่าย wifi ที่ใช้ในการทดสอบครั้งก่อนหลังจากอุปกรณ์รีบูต
เคลียร์ Logcat
public void clearLogcat ()
ลบข้อมูล logcat ที่สะสมไว้
สิ่งนี้มีประโยชน์สำหรับกรณีที่คุณต้องการให้แน่ใจว่าITestDevice#getLogcat()
ส่งคืนเฉพาะข้อมูลบันทึกที่สร้างขึ้นหลังจากจุดหนึ่งเท่านั้น (เช่น หลังจากแฟลชบิวด์อุปกรณ์ใหม่ ฯลฯ) เชื่อมต่อ ToWifiNetwork
public boolean connectToWifiNetwork (wifiSsidToPsk, boolean scanSsid)
เชื่อมต่อกับเครือข่าย wifi
เปิด wifi และบล็อกจนกว่าจะทำการเชื่อมต่อได้สำเร็จกับหนึ่งในเครือข่าย wifi ที่ระบุในแผนที่ wifiSsidToPsk เมื่อทำการเชื่อมต่อแล้ว อินสแตนซ์จะพยายามคืนค่าการเชื่อมต่อหลังจากรีบูตทุกครั้งจนกว่าจะมีการเรียก ITestDevice#disconnectFromWifi()
หรือ ITestDevice#clearLastConnectedWifiNetwork()
พารามิเตอร์ | |
---|---|
wifiSsidToPsk | |
scanSsid | boolean : จะสแกนหา SSID ที่ซ่อนอยู่สำหรับเครือข่ายนี้หรือไม่ |
การส่งคืน | |
---|---|
boolean | true หากเชื่อมต่อกับเครือข่าย wifi สำเร็จ false เป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
เชื่อมต่อ ToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid, String wifiPsk)
เชื่อมต่อกับเครือข่าย wifi
เปิด wifi และบล็อกจนกว่าจะเชื่อมต่อกับเครือข่าย wifi ที่ระบุได้สำเร็จ เมื่อทำการเชื่อมต่อแล้ว อินสแตนซ์จะพยายามคืนค่าการเชื่อมต่อหลังจากรีบูตทุกครั้งจนกว่าจะมีการเรียกITestDevice#disconnectFromWifi()
หรือ ITestDevice#clearLastConnectedWifiNetwork()
พารามิเตอร์ | |
---|---|
wifiSsid | String : wifi ssid ที่จะเชื่อมต่อ |
wifiPsk | String : ข้อความรหัสผ่าน PSK หรือ null หากไม่ได้เข้ารหัส |
การส่งคืน | |
---|---|
boolean | true หากเชื่อมต่อกับเครือข่าย wifi สำเร็จ false เป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
เชื่อมต่อ ToWifiNetwork
public boolean connectToWifiNetwork (wifiSsidToPsk)
เชื่อมต่อกับเครือข่าย wifi
เปิด wifi และบล็อกจนกว่าจะมีการเชื่อมต่อสำเร็จกับเครือข่าย wifi ใดเครือข่ายหนึ่งที่ระบุในแผนที่ wifiSsidToPsk เมื่อทำการเชื่อมต่อแล้ว อินสแตนซ์จะพยายามคืนค่าการเชื่อมต่อหลังจากการรีบูตทุกครั้ง จนกว่า ITestDevice#disconnectFromWifi()
หรือ ITestDevice#clearLastConnectedWifiNetwork()
จะถูกเรียก f
พารามิเตอร์ | |
---|---|
wifiSsidToPsk |
การส่งคืน | |
---|---|
boolean | true หากเชื่อมต่อกับเครือข่าย wifi สำเร็จ false เป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
เชื่อมต่อ ToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid)
เชื่อมต่อกับเครือข่าย wifi
เปิด wifi และบล็อกจนกว่าจะเชื่อมต่อกับเครือข่าย wifi ที่ระบุได้สำเร็จ เมื่อทำการเชื่อมต่อแล้ว อินสแตนซ์จะพยายามคืนค่าการเชื่อมต่อหลังจากรีบูตทุกครั้งจนกว่าจะมีการเรียกITestDevice#disconnectFromWifi()
หรือ ITestDevice#clearLastConnectedWifiNetwork()
พารามิเตอร์ | |
---|---|
wifiSsid | String : wifi ssid ที่จะเชื่อมต่อ |
wifiPsk | String : ข้อความรหัสผ่าน PSK หรือ null หากไม่ได้เข้ารหัส |
scanSsid | boolean : จะสแกนหา SSID ที่ซ่อนอยู่สำหรับเครือข่ายนี้หรือไม่ |
การส่งคืน | |
---|---|
boolean | true หากเชื่อมต่อกับเครือข่าย wifi สำเร็จ false เป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
เชื่อมต่อ ToWifiNetwork ถ้าจำเป็น
public boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid)
ตัวแปรของ connectToWifiNetwork(String, String)
ที่เชื่อมต่อเฉพาะในกรณีที่อุปกรณ์ไม่มีการเชื่อมต่อเครือข่าย
พารามิเตอร์ | |
---|---|
scanSsid | boolean : จะสแกนหา SSID ที่ซ่อนอยู่สำหรับเครือข่ายนี้หรือไม่ |
การส่งคืน | |
---|---|
boolean | true หากเชื่อมต่อกับเครือข่าย wifi สำเร็จ false เป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
เชื่อมต่อ ToWifiNetwork ถ้าจำเป็น
public boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk)
ตัวแปรของ connectToWifiNetwork(String, String)
ที่เชื่อมต่อเฉพาะในกรณีที่อุปกรณ์ไม่มีการเชื่อมต่อเครือข่าย
การส่งคืน | |
---|---|
boolean | true หากเชื่อมต่อกับเครือข่าย wifi สำเร็จ false เป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
createUser
public int createUser (String name, boolean guest, boolean ephemeral)
สร้างผู้ใช้ด้วยชื่อที่กำหนดและแฟล็กที่ให้ไว้
พารามิเตอร์ | |
---|---|
name | String : ของผู้ใช้ที่จะสร้างบนอุปกรณ์ |
guest | boolean : เปิดใช้งานการตั้งค่าสถานะผู้ใช้ --guest ระหว่างการสร้าง |
ephemeral | boolean : เปิดใช้งานการตั้งค่าสถานะผู้ใช้ --ชั่วคราวระหว่างการสร้าง |
การส่งคืน | |
---|---|
int | id ของผู้ใช้ที่สร้างขึ้น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
createUser
public int createUser (String name, boolean guest, boolean ephemeral, boolean forTesting)
สร้างผู้ใช้ด้วยชื่อที่กำหนดและแฟล็กที่ให้ไว้
พารามิเตอร์ | |
---|---|
name | String : ของผู้ใช้ที่จะสร้างบนอุปกรณ์ |
guest | boolean : เปิดใช้งานการตั้งค่าสถานะผู้ใช้ --guest ระหว่างการสร้าง |
ephemeral | boolean : เปิดใช้งานการตั้งค่าสถานะผู้ใช้ --ชั่วคราวระหว่างการสร้าง |
forTesting | boolean : เปิดใช้งานแฟล็กทดสอบ --สำหรับการทดสอบระหว่างการสร้าง |
การส่งคืน | |
---|---|
int | id ของผู้ใช้ที่สร้างขึ้น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
createUser
public int createUser (String name)
สร้างผู้ใช้ด้วยชื่อที่กำหนดและแฟล็กเริ่มต้น 0
พารามิเตอร์ | |
---|---|
name | String : ของผู้ใช้ที่จะสร้างบนอุปกรณ์ |
การส่งคืน | |
---|---|
int | จำนวนเต็มสำหรับ ID ผู้ใช้ที่สร้างขึ้น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
createUserNoThrow
public int createUserNoThrow (String name)
สร้างผู้ใช้ด้วยชื่อที่กำหนดและแฟล็กเริ่มต้น 0
พารามิเตอร์ | |
---|---|
name | String : ของผู้ใช้ที่จะสร้างบนอุปกรณ์ |
การส่งคืน | |
---|---|
int | จำนวนเต็มสำหรับรหัสผู้ใช้ที่สร้างขึ้นหรือ -1 สำหรับข้อผิดพลาด |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ลบไฟล์
public void deleteFile (String deviceFilePath)
วิธีการช่วยเหลือในการลบไฟล์หรือไดเร็กทอรีบนอุปกรณ์
พารามิเตอร์ | |
---|---|
deviceFilePath | String : เส้นทางสัมบูรณ์ของไฟล์บนอุปกรณ์ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ยกเลิกการลงทะเบียนDeviceActionReceiver
public void deregisterDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)
ลบ IDeviceActionReceiver
ที่ลงทะเบียนไว้
พารามิเตอร์ | |
---|---|
deviceActionReceiver | IDeviceActionReceiver : IDeviceActionReceiver ซึ่งจะถูกลบออก |
อุปกรณ์SoftRestarted
public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
เมธอดตัวช่วยเพื่อตรวจสอบว่าอุปกรณ์ซอฟต์รีสตาร์ทหรือไม่โดยการเปรียบเทียบ system_server ปัจจุบันกับ system_server ProcessInfo
ก่อนหน้า ใช้ getProcessByName(String)
เพื่อรับ ProcessInfo
พารามิเตอร์ | |
---|---|
prevSystemServerProcess | ProcessInfo : กระบวนการ system_server ก่อนหน้า ProcessInfo |
การส่งคืน | |
---|---|
boolean | true หากอุปกรณ์รีสตาร์ทอย่างนุ่มนวล |
ขว้าง | |
---|---|
DeviceNotAvailableException |
อุปกรณ์SoftRestartedตั้งแต่
public boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
วิธีการช่วยเหลือเพื่อตรวจสอบว่าอุปกรณ์รีสตาร์ทแบบนุ่มนวลตั้งแต่เวลา UTC นับตั้งแต่ยุคจากอุปกรณ์และ ERROR(/TimeUnit)
Soft-Restart หมายถึง system_server ที่รีสตาร์ทนอกอุปกรณ์รีบูตอย่างหนัก (เช่น: ขอรีบูต) อุปกรณ์ปัจจุบัน utcEpochTime ในหน่วยมิลลิวินาทีสามารถรับได้โดยวิธี getDeviceDate()
พารามิเตอร์ | |
---|---|
utcEpochTime | long : เวลาของอุปกรณ์เป็นวินาทีนับตั้งแต่ยุค |
timeUnit | TimeUnit : หน่วยเวลา TimeUnit สำหรับ utcEpochTime ที่กำหนด |
การส่งคืน | |
---|---|
boolean | true หากอุปกรณ์รีสตาร์ทอย่างนุ่มนวล |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ปิดการใช้งาน AdbRoot
public boolean disableAdbRoot ()
ปิดรูท adb
การปิดใช้งาน adb root อาจทำให้อุปกรณ์ตัดการเชื่อมต่อจาก adb วิธีนี้จะบล็อกจนกว่าอุปกรณ์จะพร้อมใช้งานการส่งคืน | |
---|---|
boolean | true ถ้าประสบความสำเร็จ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ปิดการใช้งานKeyguard
public void disableKeyguard ()
พยายามปิดการใช้งานคีย์การ์ด
ขั้นแรกให้รอจนกว่าอินพุตที่จัดส่งจะพร้อม ซึ่งจะเกิดขึ้นเมื่ออุปกรณ์รายงาน BOOT_COMPLETE ซึ่งดูเหมือนจะไม่พร้อมกัน เนื่องจากการใช้งานเฟรมเวิร์กปัจจุบันมีสภาวะการแข่งขันเป็นครั้งคราว จากนั้นคำสั่งจะถูกส่งไปเพื่อยกเลิกการป้องกันคีย์การ์ด (ใช้ได้กับคีย์การ์ดที่ไม่ปลอดภัยเท่านั้น)
ขว้าง | |
---|---|
DeviceNotAvailableException |
ปิดการใช้งาน NetworkMonitor
public boolean disableNetworkMonitor ()
ปิดใช้งานการตรวจสอบเครือข่ายบนอุปกรณ์
การส่งคืน | |
---|---|
boolean | true หากปิดใช้งานการตรวจสอบสำเร็จ false ถ้ามันล้มเหลว |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ตัดการเชื่อมต่อจาก Wifi
public boolean disconnectFromWifi ()
ตัดการเชื่อมต่อจากเครือข่าย wifi
ลบเครือข่ายทั้งหมดออกจากรายการเครือข่ายที่รู้จักและปิดการใช้งาน wifiการส่งคืน | |
---|---|
boolean | true หากตัดการเชื่อมต่อจากเครือข่าย wifi สำเร็จ false หากการเชื่อมต่อล้มเหลว |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ไม่FileExist
public boolean doesFileExist (String deviceFilePath, int userId)
วิธีการช่วยเหลือเพื่อตรวจสอบว่าไฟล์ในอุปกรณ์มีอยู่สำหรับผู้ใช้ที่กำหนดหรือไม่
พารามิเตอร์ | |
---|---|
deviceFilePath | String : เส้นทางที่แน่นอนของไฟล์บนอุปกรณ์ที่จะตรวจสอบ |
userId | int : ID ผู้ใช้ที่ใช้ตรวจสอบการมีอยู่ของไฟล์ |
การส่งคืน | |
---|---|
boolean | true หากมีไฟล์อยู่ มิฉะนั้นจะ false |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ไม่FileExist
public boolean doesFileExist (String deviceFilePath)
วิธีการช่วยเหลือในการตรวจสอบว่ามีไฟล์ในอุปกรณ์อยู่หรือไม่
พารามิเตอร์ | |
---|---|
deviceFilePath | String : เส้นทางที่แน่นอนของไฟล์บนอุปกรณ์ที่จะตรวจสอบ |
การส่งคืน | |
---|---|
boolean | true หากมีไฟล์อยู่ มิฉะนั้นจะ false |
ขว้าง | |
---|---|
DeviceNotAvailableException |
dumpHeap
public File dumpHeap (String process, String devicePath)
พยายามดัมพ์ฮีปจาก system_server เป็นความรับผิดชอบของผู้โทรในการล้างไฟล์ที่ทิ้ง
พารามิเตอร์ | |
---|---|
process | String : ชื่อของกระบวนการอุปกรณ์ที่จะดัมพ์ฮีป |
devicePath | String : เส้นทางบนอุปกรณ์ที่จะวางดัมพ์ นี่จะต้องเป็นสถานที่ที่ได้รับอนุญาต |
การส่งคืน | |
---|---|
File | ERROR(/File) ที่มีรายงาน เป็นโมฆะหากมีบางอย่างล้มเหลว |
ขว้าง | |
---|---|
DeviceNotAvailableException |
เปิดใช้งาน AdbRoot
public boolean enableAdbRoot ()
เปิดรูท adb หากการตั้งค่า "เปิดใช้งานรูท" เป็น "เท็จ" ระบบจะบันทึกข้อความและส่งคืนโดยไม่เปิดใช้งานรูท
การเปิดใช้งาน adb root อาจทำให้อุปกรณ์ตัดการเชื่อมต่อจาก adb วิธีนี้จะบล็อกจนกว่าอุปกรณ์จะพร้อมใช้งานการส่งคืน | |
---|---|
boolean | true ถ้าประสบความสำเร็จ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
เปิดใช้งาน NetworkMonitor
public boolean enableNetworkMonitor ()
เปิดใช้งานการตรวจสอบเครือข่ายบนอุปกรณ์
การส่งคืน | |
---|---|
boolean | true หากเปิดใช้งานการตรวจสอบได้สำเร็จ false ถ้ามันล้มเหลว |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ดำเนินการ AdbCommand
public String executeAdbCommand (long timeout, String... cmdArgs)
วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง adb เป็นคำสั่งระบบที่มีการหมดเวลาที่ระบุ
ควรใช้ executeShellCommand(String)
แทนเมื่อเป็นไปได้ เนื่องจากวิธีการดังกล่าวให้การตรวจจับความล้มเหลวและประสิทธิภาพที่ดีขึ้น
พารามิเตอร์ | |
---|---|
timeout | long : เวลาเป็นมิลลิวินาทีก่อนที่อุปกรณ์จะถือว่าไม่ตอบสนอง 0L สำหรับการไม่หมดเวลา |
cmdArgs | String : คำสั่ง adb และอาร์กิวเมนต์ที่จะรัน |
การส่งคืน | |
---|---|
String | stdout จากคำสั่ง null หากคำสั่งล้มเหลวในการดำเนินการ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ดำเนินการ AdbCommand
public String executeAdbCommand (long timeout,envMap, String... cmdArgs)
วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง adb เป็นคำสั่งระบบที่มีการหมดเวลาที่ระบุ
ควรใช้ executeShellCommand(String)
แทนเมื่อเป็นไปได้ เนื่องจากวิธีการดังกล่าวให้การตรวจจับความล้มเหลวและประสิทธิภาพที่ดีขึ้น
พารามิเตอร์ | |
---|---|
timeout | long : เวลาเป็นมิลลิวินาทีก่อนที่อุปกรณ์จะถือว่าไม่ตอบสนอง 0L สำหรับการไม่หมดเวลา |
envMap | |
cmdArgs | String : คำสั่ง adb และอาร์กิวเมนต์ที่จะรัน |
การส่งคืน | |
---|---|
String | stdout จากคำสั่ง null หากคำสั่งล้มเหลวในการดำเนินการ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ดำเนินการ AdbCommand
public String executeAdbCommand (String... cmdArgs)
วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง adb เป็นคำสั่งระบบ
ควรใช้executeShellCommand(String)
แทนเมื่อเป็นไปได้ เนื่องจากวิธีการดังกล่าวให้การตรวจจับความล้มเหลวและประสิทธิภาพที่ดีขึ้นพารามิเตอร์ | |
---|---|
cmdArgs | String : คำสั่ง adb และอาร์กิวเมนต์ที่จะรัน |
การส่งคืน | |
---|---|
String | stdout จากคำสั่ง null หากคำสั่งล้มเหลวในการดำเนินการ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ดำเนินการ FastbootCommand
public CommandResult executeFastbootCommand (String... cmdArgs)
วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง fastboot เป็นคำสั่งระบบโดยมีการหมดเวลาเริ่มต้นที่ 2 นาที
คาดว่าจะใช้เมื่ออุปกรณ์อยู่ในโหมด fastboot อยู่แล้ว
พารามิเตอร์ | |
---|---|
cmdArgs | String : คำสั่ง fastboot และอาร์กิวเมนต์ที่จะรัน |
การส่งคืน | |
---|---|
CommandResult | CommandResult ที่มีเอาต์พุตของคำสั่ง |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ดำเนินการ FastbootCommand
public CommandResult executeFastbootCommand (long timeout, String... cmdArgs)
วิธีการช่วยเหลือซึ่งดำเนินการคำสั่ง fastboot เป็นคำสั่งระบบ
คาดว่าจะใช้เมื่ออุปกรณ์อยู่ในโหมด fastboot อยู่แล้วพารามิเตอร์ | |
---|---|
timeout | long : เวลาเป็นมิลลิวินาทีก่อนที่คำสั่งจะหมดอายุ |
cmdArgs | String : คำสั่ง fastboot และอาร์กิวเมนต์ที่จะรัน |
การส่งคืน | |
---|---|
CommandResult | CommandResult ที่มีเอาต์พุตของคำสั่ง |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ดำเนินการ LongFastbootCommand
public CommandResult executeLongFastbootCommand (String... cmdArgs)
วิธีการของผู้ช่วยซึ่งเรียกใช้คำสั่ง FastBoot ที่ใช้งานมานานเป็นคำสั่งระบบ
เหมือนกับexecuteFastbootCommand(String)
ยกเว้นใช้การหมดเวลานานขึ้นพารามิเตอร์ | |
---|---|
cmdArgs | String : คำสั่ง fastboot และอาร์กิวเมนต์ที่จะรัน |
การส่งคืน | |
---|---|
CommandResult | CommandResult ที่มีเอาต์พุตของคำสั่ง |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ExecuteLongFastBootCommand
public CommandResult executeLongFastbootCommand (envVarMap, String... cmdArgs)
วิธีการของผู้ช่วยซึ่งดำเนินการคำสั่ง FastBoot ที่ใช้งานมานานเป็นคำสั่งระบบที่มีตัวแปรสภาพแวดล้อมระบบ
เหมือนกับ executeFastbootCommand(String)
ยกเว้นใช้การหมดเวลานานขึ้น
พารามิเตอร์ | |
---|---|
envVarMap | |
cmdArgs | String : คำสั่ง fastboot และอาร์กิวเมนต์ที่จะรัน |
การส่งคืน | |
---|---|
CommandResult | CommandResult ที่มีเอาต์พุตของคำสั่ง |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ExecuteshellCommand
public String executeShellCommand (String command)
วิธีการของผู้ช่วยที่เรียกใช้คำสั่ง ADB Shell และส่งคืนเอาต์พุตเป็น String
พารามิเตอร์ | |
---|---|
command | String : คำสั่ง adb shell ที่จะเรียกใช้ |
การส่งคืน | |
---|---|
String | เอาต์พุตเชลล์ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ExecuteshellCommand
public 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 |
ExecuteshellCommand
public 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 |
ExecuteshellCommand
public 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 |
Executeshellv2Command
public CommandResult executeShellV2Command (String cmd)
วิธีการของผู้ช่วยที่เรียกใช้คำสั่ง ADB Shell และส่งคืนผลลัพธ์เป็น CommandResult
บรรจุอย่างถูกต้องด้วยเอาต์พุตสถานะคำสั่ง stdout และ stderr
พารามิเตอร์ | |
---|---|
cmd | String : คำสั่งที่ควรเรียกใช้ |
การส่งคืน | |
---|---|
CommandResult | ผลลัพธ์ใน CommandResult |
ขว้าง | |
---|---|
DeviceNotAvailableException |
Executeshellv2Command
public CommandResult executeShellV2Command (String cmd, OutputStream pipeToOutput)
วิธีการของผู้ช่วยที่เรียกใช้คำสั่ง ADB Shell และส่งคืนผลลัพธ์เป็น CommandResult
บรรจุอย่างถูกต้องด้วยเอาต์พุตสถานะคำสั่งและ stderr Stdout ถูกนำไปยังสตรีมที่ระบุ
พารามิเตอร์ | |
---|---|
cmd | String : คำสั่งที่ควรเรียกใช้ |
pipeToOutput | OutputStream : ERROR(/OutputStream) โดยที่เอาต์พุต STD จะถูกเปลี่ยนเส้นทางหรือ NULL |
การส่งคืน | |
---|---|
CommandResult | ผลลัพธ์ใน CommandResult |
ขว้าง | |
---|---|
DeviceNotAvailableException |
Executeshellv2Command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput)
วิธีการของผู้ช่วยซึ่งเรียกใช้คำสั่ง ADB Shell และส่งคืนผลลัพธ์เป็น CommandResult
บรรจุอย่างถูกต้องด้วยเอาต์พุตสถานะคำสั่ง stdout และ stderr
พารามิเตอร์ | |
---|---|
cmd | String : คำสั่งที่ควรเรียกใช้ |
pipeAsInput | File : ERROR(/File) ที่จะส่งเป็นอินพุตไปยังคำสั่งหรือ null |
การส่งคืน | |
---|---|
CommandResult | ผลลัพธ์ใน CommandResult |
ขว้าง | |
---|---|
DeviceNotAvailableException |
Executeshellv2Command
public CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
ดำเนินการคำสั่ง ADB Shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมพฤติกรรมคำสั่ง
พารามิเตอร์ | |
---|---|
cmd | String : คำสั่ง adb shell ที่จะเรียกใช้ |
maxTimeoutForCommand | long : การหมดเวลาสูงสุดสำหรับคำสั่งให้เสร็จสมบูรณ์; หน่วยตามที่ระบุไว้ใน timeUnit |
timeUnit | TimeUnit : หน่วยสำหรับ maxTimeToOutputShellResponse |
retryAttempts | int : จำนวนสูงสุดของเวลาในการลองใหม่คำสั่งถ้ามันล้มเหลวเนื่องจากข้อยกเว้น DevicenotresponsiveException จะถูกโยนลงหากดำเนินการ retryAttempts ไม่ประสบความสำเร็จ |
การส่งคืน | |
---|---|
CommandResult |
ขว้าง | |
---|---|
DeviceNotAvailableException |
Executeshellv2Command
public CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit)
ดำเนินการคำสั่ง ADB Shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมพฤติกรรมคำสั่ง
พารามิเตอร์ | |
---|---|
cmd | String : คำสั่ง adb shell ที่จะเรียกใช้ |
maxTimeoutForCommand | long : การหมดเวลาสูงสุดสำหรับคำสั่งให้เสร็จสมบูรณ์; หน่วยตามที่ระบุไว้ใน timeUnit |
timeUnit | TimeUnit : หน่วยสำหรับ maxTimeToOutputShellResponse |
การส่งคืน | |
---|---|
CommandResult |
ขว้าง | |
---|---|
DeviceNotAvailableException |
Executeshellv2Command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
ดำเนินการคำสั่ง ADB Shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมพฤติกรรมคำสั่ง
พารามิเตอร์ | |
---|---|
cmd | String : คำสั่ง adb shell ที่จะเรียกใช้ |
pipeAsInput | File : ERROR(/File) ที่จะส่งเป็นอินพุตไปยังคำสั่งหรือ null |
pipeToOutput | OutputStream : ERROR(/OutputStream) โดยที่เอาต์พุต STD จะถูกเปลี่ยนเส้นทางหรือ NULL |
maxTimeoutForCommand | long : การหมดเวลาสูงสุดสำหรับคำสั่งให้เสร็จสมบูรณ์; หน่วยตามที่ระบุไว้ใน timeUnit |
timeUnit | TimeUnit : หน่วยสำหรับ maxTimeToOutputShellResponse |
retryAttempts | int : จำนวนสูงสุดของเวลาในการลองใหม่คำสั่งถ้ามันล้มเหลวเนื่องจากข้อยกเว้น DevicenotresponsiveException จะถูกโยนลงหากดำเนินการ retryAttempts ไม่ประสบความสำเร็จ |
การส่งคืน | |
---|---|
CommandResult |
ขว้าง | |
---|---|
DeviceNotAvailableException |
Executeshellv2Command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
ดำเนินการคำสั่ง ADB Shell พร้อมพารามิเตอร์เพิ่มเติมเพื่อควบคุมพฤติกรรมคำสั่ง
พารามิเตอร์ | |
---|---|
cmd | String : คำสั่ง adb shell ที่จะเรียกใช้ |
pipeAsInput | File : ERROR(/File) ที่จะส่งเป็นอินพุตไปยังคำสั่งหรือ null |
pipeToOutput | OutputStream : ERROR(/OutputStream) โดยที่เอาต์พุต STD จะถูกเปลี่ยนเส้นทางหรือ NULL |
pipeToError | OutputStream : ERROR(/OutputStream) โดยที่ข้อผิดพลาด STD จะถูกเปลี่ยนเส้นทางหรือ NULL |
maxTimeoutForCommand | long : การหมดเวลาสูงสุดสำหรับคำสั่งให้เสร็จสมบูรณ์; หน่วยตามที่ระบุไว้ใน timeUnit |
timeUnit | TimeUnit : หน่วยสำหรับ maxTimeToOutputShellResponse |
retryAttempts | int : จำนวนสูงสุดของเวลาในการลองใหม่คำสั่งถ้ามันล้มเหลวเนื่องจากข้อยกเว้น DevicenotresponsiveException จะถูกโยนลงหากดำเนินการ retryAttempts ไม่ประสบความสำเร็จ |
การส่งคืน | |
---|---|
CommandResult |
ขว้าง | |
---|---|
DeviceNotAvailableException |
Fastbootwipepartition
public CommandResult fastbootWipePartition (String partition)
วิธีผู้ช่วยที่เช็ดพาร์ติชันสำหรับอุปกรณ์
หากgetUseFastbootErase()
เป็น true
การลบ fastboot จะถูกใช้เพื่อเช็ดพาร์ติชัน อุปกรณ์จะต้องสร้างระบบไฟล์ในครั้งต่อไปที่อุปกรณ์บูท มิฉะนั้นจะใช้รูปแบบ fastboot ซึ่งจะสร้างระบบไฟล์ใหม่บนอุปกรณ์ คาดว่าจะใช้เมื่ออุปกรณ์อยู่ในโหมด Fastboot แล้วพารามิเตอร์ | |
---|---|
partition | String : พาร์ติชันเพื่อเช็ด |
การส่งคืน | |
---|---|
CommandResult | CommandResult ที่มีเอาต์พุตของคำสั่ง |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getActiveApexes
publicgetActiveApexes ()
ดึงข้อมูลเกี่ยวกับ Apexes ที่เปิดใช้งานบนอุปกรณ์
การส่งคืน | |
---|---|
ERROR(/Set) ของ ApexInfo เปิดใช้งานในอุปกรณ์ปัจจุบัน |
ขว้าง | |
---|---|
DeviceNotAvailableException |
GetAllSettings
publicgetAllSettings (String namespace)
ส่งคืนคู่คีย์ของเนมสเปซที่ร้องขอ
พารามิเตอร์ | |
---|---|
namespace | String : ต้องเป็นหนึ่งใน {"System", "Secure", "Global"} |
การส่งคืน | |
---|---|
แผนที่ของคู่ค่าคีย์ NULL ถ้าไม่รองรับเนมสเปซ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getAllocationState
public DeviceAllocationState getAllocationState ()
ส่งคืนสถานะการจัดสรรปัจจุบันของอุปกรณ์
การส่งคืน | |
---|---|
DeviceAllocationState |
getandroidid
public String getAndroidId (int userId)
ค้นหาและส่งคืน Android-ID ที่เกี่ยวข้องกับ userID, null ถ้าไม่พบ
พารามิเตอร์ | |
---|---|
userId | int |
การส่งคืน | |
---|---|
String |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getandroidids
publicgetAndroidIds ()
สร้างแผนที่ของ ID Android ที่พบรหัสผู้ใช้ที่ตรงกัน ไม่มีประกันว่ารหัสผู้ใช้แต่ละคนจะพบ ID Android ที่เกี่ยวข้องในฟังก์ชั่นนี้ดังนั้นรหัสผู้ใช้บางคนอาจตรงกับ NULL
การส่งคืน | |
---|---|
แผนที่ของ ID Android พบรหัสผู้ใช้ที่ตรงกัน |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getApilevel
public int getApiLevel ()
รับระดับ API ของอุปกรณ์ ค่าเริ่มต้นเป็น UNKNOWN_API_LEVEL
การส่งคืน | |
---|---|
int | จำนวนเต็มที่ระบุระดับ API ของอุปกรณ์ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
ดึงข้อมูลเกี่ยวกับแพ็คเกจที่ติดตั้งบนอุปกรณ์
พารามิเตอร์ | |
---|---|
packageName | String |
การส่งคืน | |
---|---|
PackageInfo | PackageInfo หรือ null หากไม่สามารถเรียกคืนข้อมูลได้ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getAppPackageInfos
publicgetAppPackageInfos ()
ดึงข้อมูลของแพ็คเกจที่ติดตั้งบนอุปกรณ์
การส่งคืน | |
---|---|
ERROR(/List) ของ PackageInfo S ที่ติดตั้งบนอุปกรณ์ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getBasebandversion
public String getBasebandVersion ()
วิธีการสะดวกสบายในการรับอุปกรณ์ Baseband (วิทยุ) ของอุปกรณ์นี้ การรับเวอร์ชันวิทยุเป็นอุปกรณ์เฉพาะดังนั้นอาจไม่ส่งคืนข้อมูลที่ถูกต้องสำหรับอุปกรณ์ทั้งหมด วิธีนี้ขึ้นอยู่กับ GSM.Version.baseband Propery เพื่อส่งคืนข้อมูลเวอร์ชันที่ถูกต้อง สิ่งนี้ไม่ถูกต้องสำหรับอุปกรณ์ CDMA บางตัวและเวอร์ชันที่ส่งคืนที่นี่อาจไม่ตรงกับเวอร์ชันที่รายงานจาก Fastboot และอาจไม่ส่งคืนเวอร์ชันสำหรับวิทยุ CDMA tl; dr วิธีนี้จะรายงานรุ่นที่ถูกต้องเท่านั้นหากคุณสมบัติ GSM.Version.baseband นั้นเหมือนกับเวอร์ชันที่ส่งคืนโดย fastboot getvar version-baseband
การส่งคืน | |
---|---|
String | String เบสแบนด์หรือ null หากไม่สามารถกำหนดได้ (อุปกรณ์ไม่มีวิทยุหรือสตริงเวอร์ชันไม่สามารถอ่านได้) |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getBattery
public Integer getBattery ()
ส่งคืนระดับแบตเตอรี่ปัจจุบันของอุปกรณ์หรือ NULL หากระดับแบตเตอรี่ไม่พร้อมใช้งาน
การส่งคืน | |
---|---|
Integer |
getBooleanProperty
public 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 |
getBoothistory
publicgetBootHistory ()
วิธีการของผู้ช่วยรวบรวมแผนที่ประวัติการบูตด้วยเวลาบูตและเหตุผลในการบูต
การส่งคืน | |
---|---|
แผนที่เวลาบูต (เวลา UTC เป็นวินาทีตั้งแต่ Epoch) และเหตุผลในการบูต |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getBoothistorysince
publicgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
วิธีการของผู้ช่วยรวบรวมแผนที่ประวัติการบูตด้วยเวลาบูตและเหตุผลในการบูตตั้งแต่เวลาที่กำหนดนับตั้งแต่ยุคจากอุปกรณ์และหน่วยเวลาที่ระบุ อุปกรณ์ปัจจุบัน utcepochtime ในมิลลิวินาทีสามารถรับได้โดยวิธี getDeviceDate()
พารามิเตอร์ | |
---|---|
utcEpochTime | long : เวลาอุปกรณ์ตั้งแต่ยุค |
timeUnit | TimeUnit : Time Unit TimeUnit |
การส่งคืน | |
---|---|
แผนที่เวลาบูต (เวลา UTC เป็นวินาทีตั้งแต่ Epoch) และเหตุผลในการบูต |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getBootloaderversion
public String getBootloaderVersion ()
วิธีการสะดวกสบายในการรับรุ่น bootloader ของอุปกรณ์นี้
จะพยายามดึงเวอร์ชัน bootloader จากสถานะปัจจุบันของอุปกรณ์ (เช่นหากอุปกรณ์อยู่ในโหมด Fastboot มันจะพยายามดึงเวอร์ชันจาก Fastboot)การส่งคืน | |
---|---|
String | String bootloader หรือ null หากไม่พบ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getBugreport
public InputStreamSource getBugreport ()
ดึงข้อมูลสำรองจากอุปกรณ์
การใช้งานนี้รับประกันได้ว่าจะยังคงทำงานบนอุปกรณ์ที่ไม่มี SDCARD (หรือที่ SDCARD ยังไม่ได้ติดตั้ง)
การส่งคืน | |
---|---|
InputStreamSource | InputStreamSource ซึ่งจะสร้างเนื้อหา BUGREPORT ตามความต้องการ ในกรณีที่เกิดความล้มเหลว InputStreamSource จะสร้าง ERROR(/InputStream) |
getBugreportz
public InputStreamSource getBugreportz ()
ดึง bupgreportz จากอุปกรณ์ BUGREPORT รูปแบบ ZIP ประกอบด้วย BUGREPORT หลักและไฟล์บันทึกอื่น ๆ ที่มีประโยชน์สำหรับการดีบัก
รองรับเฉพาะ 'ADB Version'> 1.0.36
การส่งคืน | |
---|---|
InputStreamSource | InputStreamSource ของไฟล์ zip ที่มี bugreportz, ส่งคืน null ในกรณีที่ล้มเหลว |
getBuildalias
public String getBuildAlias ()
เรียกคืนนามแฝงของบิลด์ที่อุปกรณ์กำลังทำงานอยู่
การสร้างนามแฝงมักจะเป็นสตริงที่อ่านได้มากกว่าการสร้าง ID (โดยทั่วไปจะเป็นตัวเลขสำหรับการสร้าง Nexus) ตัวอย่างเช่น Final Android 4.2 Release มีการสร้างนามแฝง JDQ39 และสร้าง ID 573038
การส่งคืน | |
---|---|
String | นามแฝงสร้างหรือถอยกลับไปสร้าง ID หากไม่สามารถเรียกคืนได้ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getBuildFlavor
public String getBuildFlavor ()
ดึงรสชาติการสร้างสำหรับอุปกรณ์
การส่งคืน | |
---|---|
String | การสร้างรสชาติหรือว่างถ้าไม่สามารถเรียกคืนได้ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getBuildid
public String getBuildId ()
ดึงการสร้างอุปกรณ์กำลังทำงานอยู่
การส่งคืน | |
---|---|
String | Build ID หรือ IBuildInfo#UNKNOWN_BUILD_ID หากไม่สามารถเรียกคืนได้ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getBuildSigningKeys
public String getBuildSigningKeys ()
ส่งคืนประเภทคีย์ที่ใช้ลงนามในภาพอุปกรณ์
โดยทั่วไปแล้วอุปกรณ์ Android อาจลงนามด้วยการทดสอบคีย์ (เช่นใน AOSP) หรือการปล่อยคีย์ (ควบคุมโดยผู้ผลิตอุปกรณ์รายบุคคล)
การส่งคืน | |
---|---|
String | คีย์การลงนามหากพบ null เป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
GetCachedDeviceDescriptor
public DeviceDescriptor getCachedDeviceDescriptor ()
ส่งคืน DeviceDescriptor
ที่แคชหากอุปกรณ์ถูกจัดสรรมิฉะนั้นจะส่งคืน DeviceDescriptor
ปัจจุบัน
การส่งคืน | |
---|---|
DeviceDescriptor |
GetCachedDeviceDescriptor
public DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
ส่งคืน DeviceDescriptor
ที่แคชหากอุปกรณ์ถูกจัดสรรมิฉะนั้นจะส่งคืน DeviceDescriptor
ปัจจุบัน
พารามิเตอร์ | |
---|---|
shortDescriptor | boolean : ไม่ว่าจะ จำกัด ตัวบ่งชี้ให้เป็นข้อมูลขั้นต่ำที่เปลือยเปล่าหรือไม่ |
การส่งคืน | |
---|---|
DeviceDescriptor |
getchildren
public String[] getChildren (String path)
ทางเลือกในการใช้ IFileEntry
ที่บางครั้งจะไม่ทำงานเนื่องจากการอนุญาต
พารามิเตอร์ | |
---|---|
path | String : เป็นเส้นทางบนอุปกรณ์ที่จะทำการค้นหา |
การส่งคืน | |
---|---|
String[] | อาร์เรย์ของสตริงที่มีไฟล์ทั้งหมดในพา ธ บนอุปกรณ์ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getConnection
public AbstractConnection getConnection ()
การเชื่อมต่อปัจจุบันที่เกี่ยวข้องกับอุปกรณ์
การส่งคืน | |
---|---|
AbstractConnection |
getCurrentFoldablestate
public DeviceFoldableState getCurrentFoldableState ()
ส่งคืนสถานะที่พับเก็บได้ปัจจุบันของอุปกรณ์หรือเป็นโมฆะหากเกิดปัญหาบางอย่าง
การส่งคืน | |
---|---|
DeviceFoldableState |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getCurrentUser
public int getCurrentUser ()
ส่งคืน ID ของผู้ใช้ที่กำลังรันปัจจุบัน ในกรณีที่เกิดข้อผิดพลาดให้ส่งคืน -10000
การส่งคืน | |
---|---|
int |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getDevicedate
public long getDeviceDate ()
ส่งคืนวันที่ของอุปกรณ์ในมิลลิวินาทีตั้งแต่ยุค
การส่งคืน | |
---|---|
long | วันที่ของอุปกรณ์ในรูปแบบยุค |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor ()
ส่งคืน DeviceDescriptor
จากข้อมูลอุปกรณ์เพื่อรับข้อมูลโดยไม่ผ่านวัตถุอุปกรณ์จริง
การส่งคืน | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
ส่งคืน DeviceDescriptor
จากข้อมูลอุปกรณ์เพื่อรับข้อมูลโดยไม่ผ่านวัตถุอุปกรณ์จริง
พารามิเตอร์ | |
---|---|
shortDescriptor | boolean : ไม่ว่าจะ จำกัด ตัวบ่งชี้ให้เป็นข้อมูลขั้นต่ำที่เปลือยเปล่าหรือไม่ |
การส่งคืน | |
---|---|
DeviceDescriptor |
getDevicestate
public TestDeviceState getDeviceState ()
รับสถานะของอุปกรณ์
การส่งคืน | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public long getDeviceTimeOffset (Date date)
ผู้ช่วยที่จะได้รับความแตกต่างของเวลาระหว่างอุปกรณ์และ ERROR(/Date)
ใช้ยุคสมัยภายใน
พารามิเตอร์ | |
---|---|
date | Date |
การส่งคืน | |
---|---|
long | ความแตกต่างในมิลลิวินาที |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public InputStreamSource getEmulatorOutput ()
รับกระแสของ emulator stdout และ stderr
การส่งคืน | |
---|---|
InputStreamSource | เอาต์พุต Emulator |
getemulatorprocess
public Process getEmulatorProcess ()
ส่งคืน Process
ที่สอดคล้องกับอีมูเลเตอร์นี้
การส่งคืน | |
---|---|
Process | Process หรือ null |
getExecuteshellCommandLog
public final File getExecuteShellCommandLog ()
บันทึกที่มีบันทึก executeShellCommand(String)
ทั้งหมด
การส่งคืน | |
---|---|
File |
getExternalStoreFreespace
public long getExternalStoreFreeSpace ()
วิธีผู้ช่วยในการกำหนดปริมาณพื้นที่ว่างในที่เก็บข้อมูลภายนอกอุปกรณ์
การส่งคืน | |
---|---|
long | ปริมาณพื้นที่ว่างใน KB |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getFastBootPath
public String getFastbootPath ()
ส่งคืนเส้นทางของการใช้ไบนารี fastboot ยังคงต้องการ isFastbootEnabled()
เป็นจริงเพื่อให้เปิดใช้งานฟังก์ชั่น fastboot
การส่งคืน | |
---|---|
String |
GetFastBootProductType
public String getFastbootProductType ()
วิธีการสะดวกสบายในการรับประเภทผลิตภัณฑ์ของอุปกรณ์นี้เมื่ออยู่ในโหมด Fastboot
ควรใช้วิธีนี้หากอุปกรณ์ควรอยู่ใน Fastboot มันเป็นตัวแปรที่ปลอดภัยกว่าวิธีการทั่วไปgetProductType()
ในกรณีนี้เนื่องจาก ITESTDEVICE จะรู้ว่าจะกู้คืนอุปกรณ์เข้าสู่ FastBoot หากอุปกรณ์อยู่ในสถานะที่ไม่ถูกต้องหรือไม่ตอบสนองการส่งคืน | |
---|---|
String | ชื่อประเภทผลิตภัณฑ์ String หรือ null หากไม่สามารถกำหนดได้ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
GetFastBootProductVariant
public String getFastbootProductVariant ()
วิธีการสะดวกสบายในการรับประเภทผลิตภัณฑ์ของอุปกรณ์นี้เมื่ออยู่ในโหมด Fastboot
ควรใช้วิธีนี้หากอุปกรณ์ควรอยู่ใน Fastboot มันเป็นตัวแปรที่ปลอดภัยกว่าวิธีการทั่วไปgetProductType()
ในกรณีนี้เนื่องจาก ITESTDEVICE จะรู้ว่าจะกู้คืนอุปกรณ์เข้าสู่ FastBoot หากอุปกรณ์อยู่ในสถานะที่ไม่ถูกต้องหรือไม่ตอบสนองการส่งคืน | |
---|---|
String | ชื่อประเภทผลิตภัณฑ์ String หรือ null หากไม่สามารถกำหนดได้ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getFastBootserialNumber
public String getFastbootSerialNumber ()
ส่งคืนหมายเลขซีเรียลโหมด fastboot
การส่งคืน | |
---|---|
String |
GetFastBootVariable
public String getFastbootVariable (String variableName)
ดึงค่าตัวแปร fastboot ที่กำหนดจากอุปกรณ์
พารามิเตอร์ | |
---|---|
variableName | String : ชื่อตัวแปร |
การส่งคืน | |
---|---|
String | ค่าคุณสมบัติหรือ null หากไม่มีอยู่จริง |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getFastBootversion
public String getFastbootVersion ()
ส่งคืนสตริงเวอร์ชันของไบนารี fastboot ที่ใช้ หรือเป็นโมฆะถ้ามีอะไรผิดพลาด
การส่งคืน | |
---|---|
String |
getFileentry
public IFileEntry getFileEntry (String path)
ดึงข้อมูลอ้างอิงไปยังไฟล์ระยะไกลบนอุปกรณ์
พารามิเตอร์ | |
---|---|
path | String : พา ธ ไฟล์เพื่อเรียกคืน สามารถเป็นเส้นทางหรือเส้นทางที่แน่นอนเมื่อเทียบกับ '/' (รองรับทั้งสอง "/ระบบ" และ "ระบบ" ไวยากรณ์) |
การส่งคืน | |
---|---|
IFileEntry | ไม่พบ IFileEntry หรือ null ถ้าไฟล์ที่กำหนด path ที่กำหนด |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getFileentry
public IFileEntry getFileEntry (FileListingService.FileEntry entry)
ผู้ช่วยอย่างไม่เป็นทางการที่จะได้รับ FileEntry
จากเส้นทางที่ไม่ใช่รูท FIXME: Refactor ระบบ FileEntry เพื่อให้สามารถใช้งานได้จากเส้นทางใด ๆ (แม้แต่ไม่ใช่รูท)
พารามิเตอร์ | |
---|---|
entry | FileListingService.FileEntry : FileEntry ไม่จำเป็นต้องรูทตามที่ DDMLIB ต้องการ |
การส่งคืน | |
---|---|
IFileEntry | FileEntryWrapper แสดงถึงไฟล์ |
ขว้าง | |
---|---|
| com.android.tradefed.device.devicenotavailableexception |
DeviceNotAvailableException |
getFoldablestates
publicgetFoldableStates ()
ส่งคืนรายการสถานะที่พับเก็บได้บนอุปกรณ์ สามารถรับได้ด้วย "cmd device_state print-state"
การส่งคืน | |
---|---|
ขว้าง | |
---|---|
DeviceNotAvailableException |
getIdevice
public IDevice getIDevice ()
ส่งคืนการอ้างอิงไปยัง ddmlib IDevice
ที่เกี่ยวข้อง
IDevice
ใหม่อาจได้รับการจัดสรรโดย DDMS ทุกครั้งที่อุปกรณ์ตัดการเชื่อมต่อและเชื่อมต่อใหม่จาก ADB ดังนั้นผู้โทรจึงไม่ควรอ้างอิงถึง IDevice
เพราะการอ้างอิงนั้นอาจกลายเป็นเก่าการส่งคืน | |
---|---|
IDevice | IDevice |
GetInstalledPackagenames
publicgetInstalledPackageNames ()
ดึงชื่อแพคเกจแอปพลิเคชันที่มีอยู่ในอุปกรณ์
การส่งคืน | |
---|---|
ERROR(/Set) ของชื่อแพ็คเกจ String ที่ติดตั้งอยู่ในอุปกรณ์ปัจจุบัน |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getIntProperty
public long getIntProperty (String name, long defaultValue)
ส่งคืนค่าจำนวนเต็มของคุณสมบัติที่กำหนดจากอุปกรณ์
พารามิเตอร์ | |
---|---|
name | String : ชื่อคุณสมบัติ |
defaultValue | long : ค่าเริ่มต้นที่จะส่งคืนหากคุณสมบัติว่างเปล่าหรือไม่มีอยู่ |
การส่งคืน | |
---|---|
long | ค่าคุณสมบัติหรือ defaultValue หากคุณสมบัติว่างเปล่าไม่มีอยู่หรือไม่มีค่าจำนวนเต็ม |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getIpaddress
public String getIpAddress ()
รับที่อยู่ IP ของอุปกรณ์
การส่งคืน | |
---|---|
String | ที่อยู่ IP ของอุปกรณ์หรือ null หากอุปกรณ์ไม่มีที่อยู่ IP |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getKeyGuardState
public KeyguardControllerState getKeyguardState ()
ส่งคืนวัตถุเพื่อรับสถานะปัจจุบันของ keyguard หรือ null หากไม่รองรับ
การส่งคืน | |
---|---|
KeyguardControllerState | KeyguardControllerState ที่มีภาพรวมของสถานะของ keyguard และส่งคืน null หากไม่รองรับการสืบค้น keyguard |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getLastexpectedrebootimeMillis
public long getLastExpectedRebootTimeMillis ()
ส่งคืน APIs ที่ได้รับการแลกเปลี่ยนครั้งสุดท้ายที่ก่อให้เกิดการรีบูตในมิลลิวินาทีนับตั้งแต่ยุคที่ส่งคืนโดย System.currentTimeMillis()
การส่งคืน | |
---|---|
long |
getLaunchapilevel
public int getLaunchApiLevel ()
รับระดับ API ที่เปิดตัวครั้งแรกของอุปกรณ์ ค่าเริ่มต้นเป็น UNKNOWN_API_LEVEL
การส่งคืน | |
---|---|
int | จำนวนเต็มที่ระบุระดับ API ที่เปิดตัวครั้งแรกของอุปกรณ์ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getLogcat
public InputStreamSource getLogcat ()
คว้าสตรีมสแน็ปช็อตของข้อมูล logcat
ใช้งานได้สองโหมด:
TestDeviceOptions.getMaxLogcatDataSize()
ไบต์ของเนื้อหาปัจจุบันของการจับภาพพื้นหลังการส่งคืน | |
---|---|
InputStreamSource |
getLogcat
public InputStreamSource getLogcat (int maxBytes)
คว้าสตรีมสแน็ปช็อตของ maxBytes
สุดท้ายของข้อมูล logcat ที่จับได้
มีประโยชน์สำหรับกรณีเมื่อคุณต้องการจับภาพสแน็ปช็อตบ่อยครั้งของข้อมูล logcat ที่จับได้โดยไม่เกิดการลงโทษพื้นที่ดิสก์ขนาดใหญ่ที่อาจเกิดขึ้นจากการรับสแน็ปช็อต getLogcat()
ทั้งหมด
พารามิเตอร์ | |
---|---|
maxBytes | int : จำนวนข้อมูลสูงสุดที่จะส่งคืน ควรเป็นจำนวนเงินที่เหมาะสมในหน่วยความจำ |
การส่งคืน | |
---|---|
InputStreamSource |
getlogcatdump
public InputStreamSource getLogcatDump ()
รับการถ่ายโอนข้อมูลล็อกแคทปัจจุบันสำหรับอุปกรณ์ ซึ่งแตกต่างจาก getLogcat()
วิธีนี้จะส่งคืนการถ่ายโอนข้อมูลคงที่ของ logcat เสมอ
มีข้อเสียที่จะไม่มีการส่งคืนหากอุปกรณ์ไม่สามารถเข้าถึงได้
การส่งคืน | |
---|---|
InputStreamSource | InputStreamSource ของข้อมูล logcat สตรีมที่ว่างเปล่าจะถูกส่งคืนหากไม่สามารถจับภาพข้อมูล logcat ได้ |
getLogcatsince
public InputStreamSource getLogcatSince (long date)
คว้าสตรีมสแน็ปช็อตของข้อมูล logcat ที่จับได้เริ่มต้นวันที่ที่ให้ไว้ เวลาบนอุปกรณ์ควรใช้ getDeviceDate()
พารามิเตอร์ | |
---|---|
date | long : ในมิลลิวินาทีนับตั้งแต่รูปแบบยุคของเวลาที่จะเริ่มสแน็ปช็อตจนถึงปัจจุบัน (สามารถรับได้โดยใช้ 'วันที่ +%s') |
การส่งคืน | |
---|---|
InputStreamSource |
getMacaddress
public String getMacAddress ()
ส่งคืนที่อยู่ MAC ของอุปกรณ์เป็นโมฆะหากไม่สามารถสอบถามจากอุปกรณ์ได้
การส่งคืน | |
---|---|
String |
getMainuserid
public Integer getMainUserId ()
ส่งคืนรหัสผู้ใช้หลัก
การส่งคืน | |
---|---|
Integer | ผู้ใช้ของผู้ใช้หลักหากมีหนึ่งและเป็นโมฆะหากไม่มีผู้ใช้หลัก |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getMainLineModuleInfo
publicgetMainlineModuleInfo ()
รับข้อมูลเกี่ยวกับโมดูลฉีดที่ติดตั้งบนอุปกรณ์
การส่งคืน | |
---|---|
ERROR(/Set) ของโมดูลการฉีด String ที่ติดตั้งอยู่ในอุปกรณ์ปัจจุบัน |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getMaxNumberOfrunningUserssupported
public int getMaxNumberOfRunningUsersSupported ()
รับจำนวนสูงสุดของผู้ใช้ที่รองรับพร้อมกัน ค่าเริ่มต้นเป็น 0
การส่งคืน | |
---|---|
int | จำนวนเต็มที่ระบุจำนวนผู้ใช้ที่กำลังทำงานพร้อมกัน |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getMaxNumberofuserssupported
public int getMaxNumberOfUsersSupported ()
รับจำนวนผู้ใช้ที่รองรับสูงสุด ค่าเริ่มต้นเป็น 0
การส่งคืน | |
---|---|
int | จำนวนเต็มที่ระบุจำนวนผู้ใช้ที่รองรับ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getMicrodroidProcess
public Process getMicrodroidProcess ()
การส่งคืน | |
---|---|
Process | ส่งคืนกระบวนการของ microdroid VM หาก TestDevice ไม่ใช่ microdroid ให้ส่งคืนค่า null |
getMonitor
public IDeviceStateMonitor getMonitor ()
ส่งคืน IDeviceStateMonitor
ที่เกี่ยวข้องกับอุปกรณ์
การส่งคืน | |
---|---|
IDeviceStateMonitor |
Getmountpoint
public String getMountPoint (String mountName)
ส่งคืนจุดเมานต์
สอบถามอุปกรณ์โดยตรงหากข้อมูลแคชในIDevice
ไม่พร้อมใช้งาน TODO: ย้ายพฤติกรรมนี้ไปยัง IDevice#getMountPoint(String)
พารามิเตอร์ | |
---|---|
mountName | String : ชื่อของจุดเมานต์ |
การส่งคืน | |
---|---|
String | จุดเมานต์หรือ null |
getMountPointInfo
public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
ส่งคืน MountPointInfo
ที่สอดคล้องกับเส้นทาง MountPoint ที่ระบุหรือ null
หากเส้นทางนั้นไม่มีอะไรติดตั้งหรือไม่ปรากฏใน /proc /mounts เป็น Mountpoint
พารามิเตอร์ | |
---|---|
mountpoint | String |
การส่งคืน | |
---|---|
ITestDevice.MountPointInfo | ERROR(/List) ของ MountPointInfo ที่มีข้อมูลใน "/proc/mounts" |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getMountPointInfo
publicgetMountPointInfo ()
ส่งคืนข้อมูลที่แยกวิเคราะห์ข้อมูลใน /proc /mount บนอุปกรณ์
การส่งคืน | |
---|---|
ERROR(/List) ของ MountPointInfo ที่มีข้อมูลใน "/proc/mounts" |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getOptions
public TestDeviceOptions getOptions ()
ดึงตัวเลือกการทดสอบสำหรับอุปกรณ์
การส่งคืน | |
---|---|
TestDeviceOptions | TestDeviceOptions ที่เกี่ยวข้องกับอุปกรณ์ภายใต้การทดสอบ |
getPartitionFreespace
public long getPartitionFreeSpace (String partition)
วิธีผู้ช่วยในการกำหนดปริมาณพื้นที่ว่างในพาร์ติชันอุปกรณ์
พารามิเตอร์ | |
---|---|
partition | String |
การส่งคืน | |
---|---|
long | ปริมาณพื้นที่ว่างใน KB |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getPrimaryUserId
public Integer getPrimaryUserId ()
ส่งคืนรหัสผู้ใช้หลัก
การส่งคืน | |
---|---|
Integer | ผู้ใช้ของผู้ใช้หลักหากมีหนึ่งและเป็นโมฆะหากไม่มีผู้ใช้หลัก |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getProcessByName
public ProcessInfo getProcessByName (String processName)
วิธีการของผู้ช่วยเรียกใช้คำสั่ง "pidof" และ "stat" และส่งคืนวัตถุ ProcessInfo
ด้วย PID และเวลาเริ่มต้นกระบวนการของกระบวนการที่กำหนด
พารามิเตอร์ | |
---|---|
processName | String : สตริงชื่อ Proces |
การส่งคืน | |
---|---|
ProcessInfo | processInfo ของ processName ที่กำหนด |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getProcessPid
public String getProcessPid (String process)
ส่งคืน PID ของบริการหรือเป็นโมฆะหากมีอะไรผิดพลาด
พารามิเตอร์ | |
---|---|
process | String : สตริงชื่อ Proces |
การส่งคืน | |
---|---|
String |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getProductType
public String getProductType ()
วิธีการสะดวกสบายในการรับประเภทผลิตภัณฑ์ของอุปกรณ์นี้
วิธีนี้จะทำงานได้หากอุปกรณ์อยู่ในโหมด ADB หรือ Fastbootการส่งคืน | |
---|---|
String | ชื่อประเภทผลิตภัณฑ์ String จะไม่เป็นโมฆะ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getProductVariant
public String getProductVariant ()
วิธีการสะดวกสบายเพื่อรับตัวแปรผลิตภัณฑ์ของอุปกรณ์นี้
วิธีนี้จะทำงานได้หากอุปกรณ์อยู่ในโหมด ADB หรือ Fastbootการส่งคืน | |
---|---|
String | ชื่อตัวแปรผลิตภัณฑ์ String หรือ null หากไม่สามารถกำหนดได้ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
GetProperty
public String getProperty (String name)
ดึงค่าคุณสมบัติที่กำหนดจากอุปกรณ์
พารามิเตอร์ | |
---|---|
name | String : ชื่อคุณสมบัติ |
การส่งคืน | |
---|---|
String | ค่าคุณสมบัติหรือ null หากไม่มีอยู่จริง |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getRecoveryMode
public ITestDevice.RecoveryMode getRecoveryMode ()
รับโหมดการกู้คืนปัจจุบันที่ใช้สำหรับอุปกรณ์
การส่งคืน | |
---|---|
ITestDevice.RecoveryMode | โหมดการกู้คืนปัจจุบันที่ใช้สำหรับอุปกรณ์ |
getScreenshot
public InputStreamSource getScreenshot (String format)
คว้าภาพหน้าจอจากอุปกรณ์ แนะนำให้ใช้ GetScreenshot (รูปแบบ) แทนด้วยการเข้ารหัส JPEG สำหรับขนาดที่เล็กกว่า
พารามิเตอร์ | |
---|---|
format | String : PNG ที่รองรับ, jpeg |
การส่งคืน | |
---|---|
InputStreamSource | InputStreamSource ของภาพหน้าจอในรูปแบบหรือเป็น null หากภาพหน้าจอไม่สำเร็จ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (long displayId)
คว้าภาพหน้าจอจากอุปกรณ์ที่ให้ ID การแสดงผล รูปแบบคือ PNG
TODO: ขยายการใช้งานด้านบนเพื่อสนับสนุน 'รูปแบบ' และ 'Rescale'
พารามิเตอร์ | |
---|---|
displayId | long : ID การแสดงผลของหน้าจอเพื่อรับภาพหน้าจอจาก |
การส่งคืน | |
---|---|
InputStreamSource | InputStreamSource ของภาพหน้าจอในรูปแบบหรือเป็น null หากภาพหน้าจอไม่สำเร็จ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (String format, boolean rescale)
คว้าภาพหน้าจอจากอุปกรณ์ แนะนำให้ใช้ getScreenshot(String)
แทนด้วยการเข้ารหัส JPEG สำหรับขนาดที่เล็กกว่า
พารามิเตอร์ | |
---|---|
format | String : PNG ที่รองรับ, jpeg |
rescale | boolean : หากภาพหน้าจอควรได้รับการลดขนาดเพื่อลดขนาดของภาพที่เกิดขึ้น |
การส่งคืน | |
---|---|
InputStreamSource | InputStreamSource ของภาพหน้าจอในรูปแบบหรือเป็น null หากภาพหน้าจอไม่สำเร็จ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot ()
คว้าภาพหน้าจอจากอุปกรณ์
การส่งคืน | |
---|---|
InputStreamSource | InputStreamSource ของภาพหน้าจอในรูปแบบ PNG หรือ null หากภาพหน้าจอไม่สำเร็จ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getSerialNumber
public String getSerialNumber ()
วิธีการสะดวกสบายในการรับหมายเลขซีเรียลของอุปกรณ์นี้
การส่งคืน | |
---|---|
String | หมายเลขซีเรียล String |
getSetting
public String getSetting (int userId, String namespace, String key)
ส่งคืนค่าของการตั้งค่าที่ร้องขอ เนมสเปซต้องเป็นหนึ่งใน: {"ระบบ", "ปลอดภัย", "ทั่วโลก"}
พารามิเตอร์ | |
---|---|
userId | int |
namespace | String |
key | String |
การส่งคืน | |
---|---|
String | ค่าที่เกี่ยวข้องกับเนมสเปซ: คีย์ของผู้ใช้ null ถ้าไม่พบ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getSetting
public String getSetting (String namespace, String key)
ดู getSetting(int, String, String)
และดำเนินการกับผู้ใช้ระบบ
พารามิเตอร์ | |
---|---|
namespace | String |
key | String |
การส่งคืน | |
---|---|
String |
ขว้าง | |
---|---|
DeviceNotAvailableException |
GetSimoperator
public String getSimOperator ()
ส่งคืนผู้ให้บริการซิมการ์ดหรือ NULL หากไม่พร้อมใช้งานหรือหากอุปกรณ์ไม่พร้อมใช้งาน
การส่งคืน | |
---|---|
String |
GetSimstate
public String getSimState ()
ส่งคืนสถานะซิมการ์ดหรือ NULL หากไม่มีหรืออุปกรณ์ไม่พร้อมใช้งาน
การส่งคืน | |
---|---|
String |
Gettombstones
publicgetTombstones ()
ดึงและส่งคืนรายการหลุมฝังศพจากอุปกรณ์ ต้องการรูท
วิธีการที่ดีที่สุดดังนั้นหากหลุมฝังศพหนึ่งไม่สามารถดึงได้ไม่ว่าด้วยเหตุผลใดก็ตามมันจะหายไปจากรายการ มีเพียง DeviceNotAvailableException
เท่านั้นที่จะยุติวิธีการก่อน
การส่งคืน | |
---|---|
รายการไฟล์ Tombstone ว่างเปล่าถ้าไม่มีหลุมฝังศพ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getTotalMemory
public long getTotalMemory ()
ส่งคืนขนาดหน่วยความจำทางกายภาพทั้งหมดในไบต์หรือ -1 ในกรณีที่เกิดข้อผิดพลาดภายใน
การส่งคืน | |
---|---|
long |
Getuninstallablepackagenames
publicgetUninstallablePackageNames ()
ดึงชื่อแพ็คเกจแอปพลิเคชันที่สามารถถอนการติดตั้งได้ ปัจจุบันถูกกำหนดให้เป็นแพ็คเกจที่ไม่ใช่ระบบและแพ็คเกจระบบที่อัปเดต
การส่งคืน | |
---|---|
ERROR(/Set) ของชื่อแพ็คเกจ String ที่ไม่สามารถติดตั้งได้ที่ติดตั้งในปัจจุบันบนอุปกรณ์ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getUseFastBooterase
public boolean getUseFastbootErase ()
รับว่าจะใช้รูปแบบการลบ fastboot หรือ fastboot เพื่อเช็ดพาร์ติชันบนอุปกรณ์
การส่งคืน | |
---|---|
boolean | true ถ้าการลบ fastboot จะถูกใช้หรือ false หากรูปแบบ fastboot จะถูกใช้ |
getuserflags
public int getUserFlags (int userId)
ค้นหาและส่งคืนธงของผู้ใช้ที่กำหนด ธงถูกกำหนดในคลาส "Android.content.pm.userinfo" ในโครงการโอเพ่นซอร์ส Android
พารามิเตอร์ | |
---|---|
userId | int |
การส่งคืน | |
---|---|
int | ธงที่เกี่ยวข้องกับผู้ใช้ที่ให้ไว้หากพบ -10000 ในกรณีอื่น ๆ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getUserInfos
publicgetUserInfos ()
รับแผนที่ของ USEID ไปยัง UserInfo
บนอุปกรณ์ จะโยน DeviceRuntimeException
หากเอาต์พุตจากอุปกรณ์ไม่ได้คาดหวัง
การส่งคืน | |
---|---|
รายการวัตถุ UserInfo |
ขว้าง | |
---|---|
DeviceNotAvailableException |
getUserIalNumber
public int getUserSerialNumber (int userId)
ส่งคืนหมายเลขซีเรียลที่เกี่ยวข้องกับ USERID หากพบ -10000 ในกรณีอื่น ๆ
พารามิเตอร์ | |
---|---|
userId | int |
การส่งคืน | |
---|---|
int |
ขว้าง | |
---|---|
DeviceNotAvailableException |
HandleAllocationEvent
public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)
ประมวลผลอุปกรณ์ที่กำหนด อาจเปลี่ยนอุปกรณ์เปลี่ยนไปสู่สถานะใหม่ จะแจ้งให้ทราบถึง IDeviceMonitor
ของการเปลี่ยนสถานะใด ๆ
ประมวลผล DeviceVent ซึ่งอาจเปลี่ยนอุปกรณ์นี้หรือไม่อาจเปลี่ยนไปเป็นสถานะการจัดสรรใหม่
พารามิเตอร์ | |
---|---|
event | DeviceEvent |
การส่งคืน | |
---|---|
IManagedTestDevice.DeviceEventResponse |
ความมีคุณลักษณะ
public boolean hasFeature (String feature)
ตรวจสอบว่าคุณสมบัติมีอยู่บนอุปกรณ์หรือไม่
พารามิเตอร์ | |
---|---|
feature | String : รูปแบบใดที่ควรเป็น "คุณสมบัติ: |
การส่งคืน | |
---|---|
boolean | จริงถ้าพบคุณลักษณะเท็จเป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
การติดตั้ง
public String installPackage (File packageFile, boolean reinstall, String... extraArgs)
ติดตั้งแพ็คเกจ Android บนอุปกรณ์
พารามิเตอร์ | |
---|---|
packageFile | File : ไฟล์ apk ที่จะติดตั้ง |
reinstall | boolean : true ถ้าควรทำการติดตั้งใหม่ |
extraArgs | String : อาร์กิวเมนต์เสริมเสริมที่จะผ่าน ดู 'ADB Shell PM -H' สำหรับตัวเลือกที่มีอยู่ |
การส่งคืน | |
---|---|
String | String ที่มีรหัสข้อผิดพลาดหรือ null หากประสบความสำเร็จ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
การติดตั้ง
public String installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs)
ติดตั้งแพ็คเกจ Android บนอุปกรณ์
หมายเหตุ: เฉพาะกรณีการใช้งานที่ต้องมีการควบคุมอย่างชัดเจนในการอนุญาตให้ใช้งานรันไทม์ในเวลาติดตั้งควรเรียกใช้ฟังก์ชันนี้
พารามิเตอร์ | |
---|---|
packageFile | File : ไฟล์ apk ที่จะติดตั้ง |
reinstall | boolean : true ถ้าควรทำการติดตั้งใหม่ |
grantPermissions | boolean : หากควรได้รับสิทธิ์รันไทม์ทั้งหมดในเวลาติดตั้ง |
extraArgs | String : อาร์กิวเมนต์เสริมเสริมที่จะผ่าน ดู 'ADB Shell PM -H' สำหรับตัวเลือกที่มีอยู่ |
การส่งคืน | |
---|---|
String | String ที่มีรหัสข้อผิดพลาดหรือ null หากประสบความสำเร็จ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
InstallPackageForUser
public String installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs)
ติดตั้งแพ็คเกจ Android บนอุปกรณ์สำหรับผู้ใช้ที่กำหนด
พารามิเตอร์ | |
---|---|
packageFile | File : ไฟล์ apk ที่จะติดตั้ง |
reinstall | boolean : true ถ้าควรทำการติดตั้งใหม่ |
userId | int : ID ผู้ใช้จำนวนเต็มที่จะติดตั้ง |
extraArgs | String : อาร์กิวเมนต์เสริมเสริมที่จะผ่าน ดู 'ADB Shell PM -H' สำหรับตัวเลือกที่มีอยู่ |
การส่งคืน | |
---|---|
String | String ที่มีรหัสข้อผิดพลาดหรือ null หากประสบความสำเร็จ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
InstallPackageForUser
public String installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)
ติดตั้งแพ็คเกจ Android บนอุปกรณ์สำหรับผู้ใช้ที่กำหนด
หมายเหตุ: เฉพาะกรณีการใช้งานที่ต้องมีการควบคุมอย่างชัดเจนในการอนุญาตให้ใช้งานรันไทม์ในเวลาติดตั้งควรเรียกใช้ฟังก์ชันนี้
พารามิเตอร์ | |
---|---|
packageFile | File : ไฟล์ apk ที่จะติดตั้ง |
reinstall | boolean : true ถ้าควรทำการติดตั้งใหม่ |
grantPermissions | boolean : หากควรได้รับสิทธิ์รันไทม์ทั้งหมดในเวลาติดตั้ง |
userId | int : ID ผู้ใช้จำนวนเต็มที่จะติดตั้ง |
extraArgs | String : อาร์กิวเมนต์เสริมเสริมที่จะผ่าน ดู 'ADB Shell PM -H' สำหรับตัวเลือกที่มีอยู่ |
การส่งคืน | |
---|---|
String | String ที่มีรหัสข้อผิดพลาดหรือ null หากประสบความสำเร็จ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
INVALIDENTPROPERTYCACHE
public void invalidatePropertyCache ()
ISADBTCP
public boolean isAdbTcp ()
การส่งคืน | |
---|---|
boolean |
Isappenumerationsupported
public boolean isAppEnumerationSupported ()
ตรวจสอบว่าแพลตฟอร์มบนอุปกรณ์รองรับการแจกแจงแอพหรือไม่
การส่งคืน | |
---|---|
boolean | จริงหากรองรับการแจงนับแอปเท็จเป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isbypasslowtargetsdkblocksupported
public boolean isBypassLowTargetSdkBlockSupported ()
ตรวจสอบว่าแพลตฟอร์มบนอุปกรณ์รองรับการข้ามบล็อก SDK เป้าหมายต่ำในการติดตั้งแอพ
การส่งคืน | |
---|---|
boolean | จริงหากรองรับบล็อก SDK เป้าหมายต่ำได้เป็นเท็จมิฉะนั้น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isdebugfsmounted
public boolean isDebugfsMounted ()
ตรวจสอบว่ามีการติดตั้ง debugfs หรือไม่
การส่งคืน | |
---|---|
boolean | true ถ้ามีการติดตั้ง debugfs |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isdeviceencrypted
public boolean isDeviceEncrypted ()
ส่งคืนหากอุปกรณ์ถูกเข้ารหัส
การส่งคืน | |
---|---|
boolean | true ถ้าอุปกรณ์ถูกเข้ารหัส |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isdirectory
public boolean isDirectory (String path)
ส่งคืนจริงถ้าเส้นทางบนอุปกรณ์เป็นไดเรกทอรีเท็จเป็นอย่างอื่น
พารามิเตอร์ | |
---|---|
path | String |
การส่งคืน | |
---|---|
boolean |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isenableadbroot
public boolean isEnableAdbRoot ()
การส่งคืน | |
---|---|
boolean | true ถ้าควรเปิดใช้งานรูท ADB บนอุปกรณ์ |
isencryptionsupported
public boolean isEncryptionSupported ()
ส่งคืนหากรองรับการเข้ารหัสบนอุปกรณ์
การส่งคืน | |
---|---|
boolean | true ถ้าอุปกรณ์รองรับการเข้ารหัส |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isexecutable
public boolean isExecutable (String fullPath)
ส่งคืนจริงถ้าพา ธ ไฟล์บนอุปกรณ์เป็นไฟล์ที่เรียกใช้งานได้เท็จเป็นอย่างอื่น
พารามิเตอร์ | |
---|---|
fullPath | String |
การส่งคืน | |
---|---|
boolean |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isfastbootenabled
public boolean isFastbootEnabled ()
กลับมาหาก Fastboot พร้อมใช้งานสำหรับอุปกรณ์
การส่งคืน | |
---|---|
boolean |
ไม่มีหัว
public boolean isHeadless ()
ส่งคืนจริงถ้าอุปกรณ์ไม่มีหัว (ไม่มีหน้าจอ) เท็จเป็นอย่างอื่น
การส่งคืน | |
---|---|
boolean |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isheadlesssystemusermode
public boolean isHeadlessSystemUserMode ()
ส่งคืนไม่ว่าอุปกรณ์จะใช้โหมดผู้ใช้ System System หรือไม่
การส่งคืน | |
---|---|
boolean |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ismainuserpermanentadmin
public boolean isMainUserPermanentAdmin ()
ส่งคืนไม่ว่าผู้ใช้หลักจะเป็นผู้ดูแลระบบถาวรและไม่สามารถลบหรือลดระดับเป็นสถานะที่ไม่ใช่ผู้บริหารได้
การส่งคืน | |
---|---|
boolean |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ismultiusersupported
public boolean isMultiUserSupported ()
กำหนดว่าผู้ใช้หลายคนได้รับการสนับสนุนหรือไม่
การส่งคืน | |
---|---|
boolean | จริงหากรองรับผู้ใช้หลายคนเป็นเท็จเป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ispackageInstalg
public boolean isPackageInstalled (String packageName, String userId)
สอบถามอุปกรณ์สำหรับชื่อแพ็คเกจที่กำหนดและรหัสผู้ใช้ที่ให้ไว้เพื่อตรวจสอบว่ามีการติดตั้งในปัจจุบันหรือไม่สำหรับผู้ใช้นั้น
พารามิเตอร์ | |
---|---|
packageName | String : แพ็คเกจเรากำลังตรวจสอบว่าติดตั้งหรือไม่ |
userId | String : รหัสผู้ใช้เรากำลังตรวจสอบแพ็คเกจที่ติดตั้งไว้สำหรับ หากเป็นศูนย์จะใช้ศูนย์ผู้ใช้หลัก |
การส่งคืน | |
---|---|
boolean | จริงถ้ารายงานแพคเกจตามที่ติดตั้ง เท็จเป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ispackageInstalg
public boolean isPackageInstalled (String packageName)
สอบถามอุปกรณ์สำหรับชื่อแพ็คเกจที่กำหนดเพื่อตรวจสอบว่ามีการติดตั้งในปัจจุบันหรือไม่
พารามิเตอร์ | |
---|---|
packageName | String |
การส่งคืน | |
---|---|
boolean | จริงถ้ารายงานแพคเกจตามที่ติดตั้ง เท็จเป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isruntimePermissionsupported
public boolean isRuntimePermissionSupported ()
ตรวจสอบว่าแพลตฟอร์มบนอุปกรณ์รองรับการอนุญาตรันไทม์หรือไม่
การส่งคืน | |
---|---|
boolean | จริงหากได้รับการอนุญาตให้ใช้งานรันไทม์เท็จเป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
iSstateBootloaderorFastBootd
public boolean isStateBootloaderOrFastbootd ()
ส่งคืนจริงถ้าอุปกรณ์อยู่ใน TestDeviceState#FASTBOOT
หรือ TestDeviceState.FASTBOOTD
การส่งคืน | |
---|---|
boolean |
isuserrunning
public boolean isUserRunning (int userId)
ตรวจสอบว่าผู้ใช้ที่กำหนดกำลังทำงานอยู่หรือไม่
พารามิเตอร์ | |
---|---|
userId | int |
การส่งคืน | |
---|---|
boolean | จริงถ้าผู้ใช้ทำงานเท็จในทุกกรณี |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isusersecondary
public boolean isUserSecondary (int userId)
ส่งคืนว่าผู้ใช้ที่ระบุเป็นผู้ใช้รองตามธงหรือไม่
พารามิเตอร์ | |
---|---|
userId | int |
การส่งคืน | |
---|---|
boolean | จริงถ้าผู้ใช้เป็นทุติยภูมิเท็จเป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ไม่สามารถมองเห็นได้
public boolean isUserVisible (int userId)
ตรวจสอบว่าผู้ใช้ที่กำหนดสามารถมองเห็นได้หรือไม่
ผู้ใช้ "มองเห็นได้" เป็นผู้ใช้ที่มีปฏิสัมพันธ์กับผู้ใช้ "มนุษย์" และด้วยเหตุนี้จึงสามารถเปิดตัวกิจกรรมการเปิดตัว (โดยทั่วไปจะอยู่ในจอแสดงผลเริ่มต้น)
พารามิเตอร์ | |
---|---|
userId | int |
การส่งคืน | |
---|---|
boolean |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isuservisibleondisplay
public boolean isUserVisibleOnDisplay (int userId, int displayId)
ตรวจสอบว่าผู้ใช้ที่กำหนดสามารถมองเห็นได้ในจอแสดงผลที่กำหนดหรือไม่
ผู้ใช้ "มองเห็น" เป็นผู้ใช้ที่มีปฏิสัมพันธ์กับผู้ใช้ "มนุษย์" และด้วยเหตุนี้จึงสามารถเปิดตัวกิจกรรมการเปิดตัวในจอแสดงผลนั้น
พารามิเตอร์ | |
---|---|
userId | int |
displayId | int |
การส่งคืน | |
---|---|
boolean |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isvisiblebackgroundusersondefaultdisplaysupported
public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported ()
ส่งคืนไม่ว่าอุปกรณ์จะอนุญาตให้ผู้ใช้สามารถเริ่มต้นได้ในพื้นหลังใน ERROR(/java.android.view.Display#DEFAULT_DISPLAY)
ถ้าเป็นเช่นนั้นคุณสามารถเรียก startVisibleBackgroundUser(int, int, boolean)
, ผ่านจอแสดงผลที่ส่งคืนโดย listDisplayIdsForStartingVisibleBackgroundUsers()
(ซึ่งควรรวมถึง ERROR(/java.android.view.Display#DEFAULT_DISPLAY)
การส่งคืน | |
---|---|
boolean |
ขว้าง | |
---|---|
DeviceNotAvailableException |
isvisiblebackgrounduserssupported
public boolean isVisibleBackgroundUsersSupported ()
ส่งคืนว่าอุปกรณ์อนุญาตให้ผู้ใช้เริ่มมองเห็นได้ในพื้นหลังหรือไม่
ถ้าเป็นเช่นนั้นคุณสามารถเรียก startVisibleBackgroundUser(int, int, boolean)
, ผ่านจอแสดงผลที่ส่งคืนโดย listDisplayIdsForStartingVisibleBackgroundUsers()
การส่งคืน | |
---|---|
boolean |
ขว้าง | |
---|---|
DeviceNotAvailableException |
iswifienabled
public boolean isWifiEnabled ()
ทดสอบหากเปิดใช้งาน wifi
ตรวจสอบว่ามีการเปิดใช้งาน WiFi บนอุปกรณ์หรือไม่ มีประโยชน์สำหรับการยืนยันสถานะ WiFi ก่อนการทดสอบที่ไม่ควรทำงานกับ WiFi เช่นการทดสอบข้อมูลมือถือการส่งคืน | |
---|---|
boolean | true ถ้าเปิดใช้งาน wifi false หากปิดใช้งาน |
ขว้าง | |
---|---|
DeviceNotAvailableException |
ListDisplayids
publiclistDisplayIds ()
รวบรวมรายการ ID แสดงผลที่มีอยู่บนอุปกรณ์ตามที่รายงานโดย "Dumpsys SurfaceFlinger"
การส่งคืน | |
---|---|
รายการจอแสดงผล ค่าเริ่มต้นจะส่งคืนจอแสดงผลเริ่มต้น 0 |
ขว้าง | |
---|---|
DeviceNotAvailableException |
listdisplayidsforstartingvisiblebackgroundusers
publiclistDisplayIdsForStartingVisibleBackgroundUsers ()
รับรายการจอแสดงผลที่สามารถใช้เพื่อ start a user visible in the background
การส่งคืน | |
---|---|
ขว้าง | |
---|---|
DeviceNotAvailableException |
ผู้ฟัง
publiclistUsers ()
รับรายชื่อผู้ใช้บนอุปกรณ์ จะโยน DeviceRuntimeException
หากเอาต์พุตจากอุปกรณ์ไม่ได้คาดหวัง
การส่งคืน | |
---|---|
รายการรหัสผู้ใช้ |
ขว้าง | |
---|---|
DeviceNotAvailableException |
โลแกน
public boolean logAnrs (ITestLogger logger)
รวบรวมและบันทึก anrs จากอุปกรณ์
พารามิเตอร์ | |
---|---|
logger | ITestLogger : ITestLogger เพื่อบันทึก ANRS |
การส่งคืน | |
---|---|
boolean | จริงถ้าการบันทึกสำเร็จเป็นเท็จเป็นอย่างอื่น |
ขว้าง | |
---|---|
DeviceNotAvailableException |
logbugreport
public boolean logBugreport (String dataName, ITestLogger listener)
วิธีการของผู้ช่วยในการใช้ BupgrePort และเข้าสู่ระบบไปยังผู้สื่อข่าว
พารามิเตอร์ | |
---|---|
dataName | String : ชื่อภายใต้การรายงาน bupgreport |
listener | ITestLogger : ITestLogger เพื่อบันทึก BUGREPORT |
การส่งคืน | |
---|---|
boolean | จริงถ้าการบันทึกสำเร็จเป็นเท็จเป็นอย่างอื่น |
Logondevice
public void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)
บันทึกข้อความใน logcat ของอุปกรณ์ นี่คือการโทรที่ปลอดภัยที่จะไม่โยนแม้ว่าการบันทึกจะล้มเหลว
พารามิเตอร์ | |
---|---|
tag | String : แท็กที่เราเข้าสู่ระบบข้อความของเราใน logcat |
level | Log.LogLevel : ระดับการดีบักของข้อความใน logcat |
format | String : รูปแบบข้อความ |
args | Object : args ที่จะถูกแทนที่ผ่าน string.format () |
nonblockingreboot
public void nonBlockingReboot ()
ออกคำสั่งเพื่อรีบูตอุปกรณ์และส่งคืนคำสั่งเสร็จสมบูรณ์และเมื่ออุปกรณ์ไม่สามารถมองเห็นได้อีกต่อไปของ ADB
ขว้าง | |
---|---|
DeviceNotAvailableException |
Postadbrootaction
public void postAdbRootAction ()
แทนที่หากอุปกรณ์ต้องการการกระทำเฉพาะบางอย่างที่จะดำเนินการหลังจากรูท ADB และก่อนที่อุปกรณ์จะกลับมาออนไลน์ การใช้งานเริ่มต้นไม่รวมถึงการดำเนินการใด ๆ ไม่รับประกันว่ารูท ADB จะเปิดใช้งานในขั้นตอนนี้
ขว้าง | |
---|---|
| com.android.tradefed.device.devicenotavailableexception |
DeviceNotAvailableException |
Postadbunrootaction
public void postAdbUnrootAction ()
แทนที่หากอุปกรณ์ต้องการการกระทำเฉพาะบางอย่างที่จะดำเนินการหลังจาก adb unroot และก่อนที่อุปกรณ์จะกลับมาออนไลน์ การใช้งานเริ่มต้นไม่รวมถึงการกระทำเพิ่มเติมใด ๆ ADB Root ไม่รับประกันว่าจะปิดใช้งานในขั้นตอนนี้
ขว้าง | |
---|---|
| com.android.tradefed.device.devicenotavailableexception |
DeviceNotAvailableException |
postbootsetup
public void postBootSetup ()
ทำตามคำแนะนำในการกำหนดค่าอุปกรณ์สำหรับการทดสอบหลังจากการบูตทุกครั้ง
ควรถูกเรียกหลังจากอุปกรณ์บูท/พร้อมใช้งานเต็มรูปแบบ ในสถานการณ์ปกติวิธีนี้ไม่จำเป็นต้องเรียกอย่างชัดเจนเนื่องจากการใช้งานควรทำตามขั้นตอนเหล่านี้โดยอัตโนมัติเมื่อทำการรีบูต ในกรณีที่อาจต้องเรียกว่าเมื่ออุปกรณ์รีบูตเนื่องจากเหตุการณ์อื่น ๆ (เช่นเมื่อคำสั่ง Update Fastboot เสร็จสมบูรณ์)ขว้าง | |
---|---|
DeviceNotAvailableException |
PostinvocationTearDown
public void postInvocationTearDown (Throwable exception)
ขั้นตอนพิเศษสำหรับการทำความสะอาดที่จำเป็นสำหรับอุปกรณ์เฉพาะที่จะดำเนินการหลังจากการร้องขอเสร็จสิ้น
พารามิเตอร์ | |
---|---|
exception | Throwable : ถ้ามีข้อยกเว้นขั้นสุดท้ายที่เกิดขึ้นจากความล้มเหลวในการเรียกร้อง |
preinvocationetup
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 |
ขว้าง | |
---|---|
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public 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. |
ขว้าง | |
---|---|
DeviceNotAvailableException |
pullFile
public 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. |
ขว้าง | |
---|---|
DeviceNotAvailableException |
pullFile
public 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) |
ขว้าง | |
---|---|
DeviceNotAvailableException |
pullFile
public 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) |
ขว้าง | |
---|---|
DeviceNotAvailableException |
pullFile
public 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 |
pullFileContents
public 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) |
ขว้าง | |
---|---|
DeviceNotAvailableException |
pullFileFromExternal
public 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) |
ขว้าง | |
---|---|
DeviceNotAvailableException |
pushDir
public boolean pushDir (File localFileDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
พารามิเตอร์ | |
---|---|
localFileDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
การส่งคืน | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
pushDir
public boolean pushDir (File localFileDir, String deviceFilePath)
Recursively push directory contents to device.
พารามิเตอร์ | |
---|---|
localFileDir | 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 |
pushFile
public boolean pushFile (File localFile, String remoteFilePath, 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 |
remoteFilePath | 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 |
pushFile
public boolean pushFile (File localFile, String remoteFilePath)
Push a file to device. By default using a content provider.
พารามิเตอร์ | |
---|---|
localFile | File : the local file to push |
remoteFilePath | String : the remote destination absolute file path |
การส่งคืน | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
pushString
public boolean pushString (String contents, String remoteFilePath)
Push file created from a string to device
พารามิเตอร์ | |
---|---|
contents | String : the contents of the file to push |
remoteFilePath | String : the remote destination absolute file path |
การส่งคืน | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
รีบูต
public 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. |
ขว้าง | |
---|---|
DeviceNotAvailableException |
รีบูต
public void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.Throws | |
---|---|
DeviceNotAvailableException |
rebootIntoBootloader
public void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.Throws | |
---|---|
DeviceNotAvailableException |
rebootIntoFastbootd
public void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
Throws | |
---|---|
DeviceNotAvailableException |
rebootIntoRecovery
public void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recoveryThrows | |
---|---|
DeviceNotAvailableException |
rebootIntoSideload
public 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 |
rebootIntoSideload
public 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 |
ขว้าง | |
---|---|
DeviceNotAvailableException |
rebootUntilOnline
public void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
Throws | |
---|---|
DeviceNotAvailableException |
rebootUntilOnline
public 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 |
rebootUserspace
public void rebootUserspace ()
Reboots only userspace part of device.
Blocks until device becomes available.
คำเตือน. Userspace reboot is currently under active development, use it on your own risk.
Throws | |
---|---|
DeviceNotAvailableException |
rebootUserspaceUntilOnline
public void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
Throws | |
---|---|
DeviceNotAvailableException |
recoverDevice
public boolean recoverDevice ()
Attempts to recover device communication.
การส่งคืน | |
---|---|
boolean | True if recovery attempted and successful, returns False if recovery was skipped |
Throws | |
---|---|
DeviceNotAvailableException | if device is no longer available |
registerDeviceActionReceiver
public void registerDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)
Registers a IDeviceActionReceiver
for this device.
All registered IDeviceActionReceiver
s will be notified before a device action starts and after the device action ends.
พารามิเตอร์ | |
---|---|
deviceActionReceiver | IDeviceActionReceiver : A IDeviceActionReceiver which will be registered. |
remountSystemReadOnly
public void remountSystemReadOnly ()
Make the system partition on the device read-only. May reboot the device.
Throws | |
---|---|
DeviceNotAvailableException |
remountSystemWritable
public void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
Throws | |
---|---|
DeviceNotAvailableException |
remountVendorReadOnly
public void remountVendorReadOnly ()
Make the vendor partition on the device read-only. May reboot the device.
Throws | |
---|---|
DeviceNotAvailableException |
remountVendorWritable
public void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
ขว้าง | |
---|---|
DeviceNotAvailableException |
removeAdmin
public boolean removeAdmin (String componentName, int userId)
Remove given device admin in given user and return true
if it is successful, false
otherwise.
พารามิเตอร์ | |
---|---|
componentName | String : of device admin to be removed. |
userId | int : of user that the device admin lives in. |
การส่งคืน | |
---|---|
boolean | True if it is successful, false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
removeOwners
public void removeOwners ()
Remove all existing device profile owners with the best effort.
Throws | |
---|---|
DeviceNotAvailableException |
removeUser
public boolean removeUser (int userId)
Remove a given user from the device.
พารามิเตอร์ | |
---|---|
userId | int : of the user to remove |
การส่งคืน | |
---|---|
boolean | true if we were successful in removing the user, false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
resetContentProviderSetup
public void resetContentProviderSetup ()
Reset the flag for content provider setup in order to trigger it again.
runInstrumentationTests
public 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 |
runInstrumentationTests
public 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 |
การส่งคืน | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
Throws | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public 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 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 |
setConfiguration
public void setConfiguration (IConfiguration configuration)
Injects the IConfiguration
in use.
พารามิเตอร์ | |
---|---|
configuration | IConfiguration |
setConnectionAvdInfo
public final void setConnectionAvdInfo (GceAvdInfo avdInfo)
พารามิเตอร์ | |
---|---|
avdInfo | GceAvdInfo |
setDate
public 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 | |
---|---|
DeviceNotAvailableException |
setDeviceOwner
public boolean setDeviceOwner (String componentName, int userId)
Set a device admin component as device owner in given user.
พารามิเตอร์ | |
---|---|
componentName | String : of device admin to be device owner. |
userId | int : of the user that the device owner lives in. |
การส่งคืน | |
---|---|
boolean | True if it is successful, false otherwise. |
ขว้าง | |
---|---|
DeviceNotAvailableException |
setDeviceState
public void setDeviceState (TestDeviceState deviceState)
Update the device's state.
พารามิเตอร์ | |
---|---|
deviceState | TestDeviceState : the TestDeviceState |
setEmulatorOutputStream
public void setEmulatorOutputStream (SizeLimitedOutputStream output)
For emulator set SizeLimitedOutputStream
to log output
พารามิเตอร์ | |
---|---|
output | SizeLimitedOutputStream : to log the output |
setEmulatorProcess
public void setEmulatorProcess (Process p)
Sets the Process
, when this device is an emulator.
พารามิเตอร์ | |
---|---|
p | Process |
setFastbootEnabled
public void setFastbootEnabled (boolean fastbootEnabled)
Set the fastboot option for the device. Should be set when device is first allocated.
พารามิเตอร์ | |
---|---|
fastbootEnabled | boolean : whether fastboot is available for the device or not |
setFastbootPath
public void setFastbootPath (String fastbootPath)
Sets the path to the fastboot binary that should be used. Still requires isFastbootEnabled()
to be true, to have fastboot functions enabled.
พารามิเตอร์ | |
---|---|
fastbootPath | String |
setIDevice
public void setIDevice (IDevice newDevice)
Update the IDevice associated with this ITestDevice.
The new IDevice must refer the same physical device as the current reference. This method will be called if DDMS has allocated a new IDeviceพารามิเตอร์ | |
---|---|
newDevice | IDevice : the IDevice |
setLogStartDelay
public void setLogStartDelay (int delay)
Sets the time in ms to wait before starting logcat capture for a online device.
พารามิเตอร์ | |
---|---|
delay | int : the delay in ms |
setOptions
public void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
พารามิเตอร์ | |
---|---|
options | TestDeviceOptions |
setProperty
public 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 | |
---|---|
DeviceNotAvailableException |
setRecovery
public 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 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. |
setSetting
public void setSetting (String namespace, String key, String value)
See setSetting(int, String, String, String)
and performed on system user.
พารามิเตอร์ | |
---|---|
namespace | String |
key | String |
value | String |
Throws | |
---|---|
DeviceNotAvailableException |
setSetting
public void setSetting (int userId, String namespace, String key, String value)
Add a setting value to the namespace of a given user. Some settings will only be available after a reboot. namespace must be one of: {"system", "secure", "global"}
พารามิเตอร์ | |
---|---|
userId | int |
namespace | String |
key | String |
value | String |
Throws | |
---|---|
DeviceNotAvailableException |
setTestLogger
public void setTestLogger (ITestLogger testLogger)
Injects the ITestLogger
instance
พารามิเตอร์ | |
---|---|
testLogger | ITestLogger |
setUseFastbootErase
public 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 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. startUser
public boolean startUser (int userId)
Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP.
พารามิเตอร์ | |
---|---|
userId | int : of the user to start in the background |
การส่งคืน | |
---|---|
boolean | true if the user was successfully started in the background. |
Throws | |
---|---|
DeviceNotAvailableException |
startUser
public boolean startUser (int userId, boolean waitFlag)
Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP. Possible to provide extra flag to wait for the operation to have effect.
พารามิเตอร์ | |
---|---|
userId | int : of the user to start in the background |
waitFlag | boolean : will make the command wait until user is started and unlocked. |
การส่งคืน | |
---|---|
boolean | true if the user was successfully started in the background. |
Throws | |
---|---|
DeviceNotAvailableException |
startVisibleBackgroundUser
public boolean startVisibleBackgroundUser (int userId, int displayId, boolean waitFlag)
Starts a given user in the background, visible in the given display (ie, allowing the user to launch activities in that display).
NOTE: this command doesn't check if the user exists, display is available, device supports such feature
, etc.
พารามิเตอร์ | |
---|---|
userId | int : of the user to start in the background |
displayId | int : display to start user visible on |
waitFlag | boolean : will make the command wait until user is started and unlocked. |
การส่งคืน | |
---|---|
boolean | true if the user was successfully started visible in the background. |
Throws | |
---|---|
DeviceNotAvailableException |
stopEmulatorOutput
public void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public 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.stopUser
public boolean stopUser (int userId)
Stops a given user. If the user is already stopped, this method is a NOOP. Cannot stop current and system user.
พารามิเตอร์ | |
---|---|
userId | int : of the user to stop. |
การส่งคืน | |
---|---|
boolean | true if the user was successfully stopped. |
Throws | |
---|---|
DeviceNotAvailableException |
stopUser
public boolean stopUser (int userId, boolean waitFlag, boolean forceFlag)
Stop a given user. Possible to provide extra flags to wait for the operation to have effect, and force terminate the user. Cannot stop current and system user.
พารามิเตอร์ | |
---|---|
userId | int : of the user to stop. |
waitFlag | boolean : will make the command wait until user is stopped. |
forceFlag | boolean : will force stop the user. |
การส่งคืน | |
---|---|
boolean | true if the user was successfully stopped. |
Throws | |
---|---|
DeviceNotAvailableException |
switchToAdbTcp
public String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
การส่งคืน | |
---|---|
String | the tcp serial number or null if device could not be switched |
Throws | |
---|---|
DeviceNotAvailableException |
switchToAdbUsb
public boolean switchToAdbUsb ()
Switch device to adb over usb mode.
การส่งคืน | |
---|---|
boolean | true if switch was successful, false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
เปลี่ยนผู้ใช้
public boolean switchUser (int userId)
Switch to another userId with a default timeout. switchUser(int, long)
.
พารามิเตอร์ | |
---|---|
userId | int |
การส่งคืน | |
---|---|
boolean | True if the new userId matches the userId provider. False otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
เปลี่ยนผู้ใช้
public boolean switchUser (int userId, long timeout)
Switch to another userId with the provided timeout as deadline. Attempt to disable keyguard after user change is successful.
พารามิเตอร์ | |
---|---|
userId | int |
timeout | long : to wait before returning false for switch-user failed. |
การส่งคืน | |
---|---|
boolean | True if the new userId matches the userId provider. False otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
syncFiles
public 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 |
takeBugreport
public Bugreport takeBugreport ()
Take a bugreport and returns it inside a Bugreport
object to handle it. Return null in case of issue. File referenced in the Bugreport object need to be cleaned via Bugreport.close()
.
การส่งคืน | |
---|---|
Bugreport |
uninstallPackage
public String uninstallPackage (String packageName)
Uninstall an Android package from device.
พารามิเตอร์ | |
---|---|
packageName | String : the Android package to uninstall |
การส่งคืน | |
---|---|
String | a String with an error code, or null if success. |
Throws | |
---|---|
DeviceNotAvailableException |
uninstallPackageForUser
public String uninstallPackageForUser (String packageName, int userId)
Uninstall an Android package from device for a given user.
พารามิเตอร์ | |
---|---|
packageName | String : the Android package to uninstall |
userId | int : the integer user id to uninstall for. |
การส่งคืน | |
---|---|
String | a String with an error code, or null if success. |
Throws | |
---|---|
DeviceNotAvailableException |
unlockDevice
public boolean unlockDevice ()
Unlocks the device if the device is in an encrypted state.
This method may restart the framework but will not callpostBootSetup()
. 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 |
waitForBootComplete
public 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 | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailable
public 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 |
waitForDeviceAvailable
public 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 |
waitForDeviceAvailableInRecoverPath
public 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 |
waitForDeviceBootloader
public void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
Throws | |
---|---|
DeviceNotAvailableException |
waitForDeviceInRecovery
public boolean waitForDeviceInRecovery (long waitTime)
Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery
).
Parameters | |
---|---|
waitTime | long : the time in ms to wait |
การส่งคืน | |
---|---|
boolean | true if device boots into recovery before time expires. false otherwise |
waitForDeviceInSideload
public boolean waitForDeviceInSideload (long waitTime)
Blocks for the device to be in the 'adb sideload' state
Parameters | |
---|---|
waitTime | long : the time in ms to wait |
การส่งคืน | |
---|---|
boolean | true if device boots into sideload before time expires. false otherwise |
waitForDeviceNotAvailable
public boolean waitForDeviceNotAvailable (long waitTime)
Blocks for the device to be not available ie missing from adb
Parameters | |
---|---|
waitTime | long : the time in ms to wait |
การส่งคืน | |
---|---|
boolean | true if device becomes not available before time expires. false otherwise |
waitForDeviceOnline
public void waitForDeviceOnline ()
Blocks until device is visible via adb. Uses default timeout
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.ขว้าง | |
---|---|
DeviceNotAvailableException |
waitForDeviceOnline
public void waitForDeviceOnline (long waitTime)
Blocks until device is visible via adb.
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.Parameters | |
---|---|
waitTime | long : the time in ms to wait |
Throws | |
---|---|
DeviceNotAvailableException |
waitForDeviceShell
public boolean waitForDeviceShell (long waitTime)
Waits for device to be responsive to a basic adb shell command.
Parameters | |
---|---|
waitTime | long : the time in ms to wait |
การส่งคืน | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |
Protected methods
addExtraConnectionBuilderArgs
protected void addExtraConnectionBuilderArgs (DefaultConnection.ConnectionBuilder builder)
Parameters | |
---|---|
builder | DefaultConnection.ConnectionBuilder |
buildAdbShellCommand
protected String[] buildAdbShellCommand (String command, boolean forceExitStatusDetection)
Builds the OS command for the given adb shell command session and args
Parameters | |
---|---|
command | String |
forceExitStatusDetection | boolean |
การส่งคืน | |
---|---|
String[] |
checkApiLevelAgainst
protected void checkApiLevelAgainst (String feature, int strictMinLevel)
Parameters | |
---|---|
feature | String |
strictMinLevel | int |
createRebootDeviceAction
protected NativeDevice.RebootDeviceAction createRebootDeviceAction (NativeDevice.RebootMode rebootMode, String reason)
Create a RebootDeviceAction
to be used when performing a reboot action.
Parameters | |
---|---|
rebootMode | NativeDevice.RebootMode : a mode of this reboot. |
reason | String : for this reboot. |
การส่งคืน | |
---|---|
NativeDevice.RebootDeviceAction | the created RebootDeviceAction . |
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode, String reason)
Perform a adb reboot.
Parameters | |
---|---|
rebootMode | NativeDevice.RebootMode : a mode of this reboot. |
reason | String : for this reboot. |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
ensureRuntimePermissionSupported
protected void ensureRuntimePermissionSupported ()
helper method to throw exception if runtime permission isn't supported
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getApiLevelSafe
protected int getApiLevelSafe ()
การส่งคืน | |
---|---|
int |
initializeConnection
protected void initializeConnection (IBuildInfo info, MultiMap<String, String> attributes)
Parameters | |
---|---|
info | IBuildInfo |
attributes | MultiMap |
Throws | |
---|---|
DeviceNotAvailableException | |
TargetSetupError |
internalGetProperty
protected String internalGetProperty (String propName, String fastbootVar, String description)
Fetch a device property, from the ddmlib cache by default, and falling back to either `adb shell getprop` or `fastboot getvar` depending on whether the device is in Fastboot or not.
Parameters | |
---|---|
propName | String : The name of the device property as returned by `adb shell getprop` |
fastbootVar | String : The name of the equivalent fastboot variable to query. if null , fastboot query will not be attempted |
description | String : A simple description of the variable. First letter should be capitalized. |
การส่งคืน | |
---|---|
String | A string, possibly null or empty, containing the value of the given property |
Throws | |
---|---|
DeviceNotAvailableException |
isInRebootCallback
protected boolean isInRebootCallback ()
Returns whether reboot callbacks is currently being executed or not. All public api's for reboot should be disabled if true.
การส่งคืน | |
---|---|
boolean |
isNewer
protected boolean isNewer (File localFile, IFileEntry entry)
Return true
if local file is newer than remote file. IFileEntry
being accurate to the minute, in case of equal times, the file will be considered newer.
Parameters | |
---|---|
localFile | File |
entry | IFileEntry |
การส่งคืน | |
---|---|
boolean |
notifyRebootEnded
protected void notifyRebootEnded ()
Notifies all IDeviceActionReceiver
about reboot end event.
ขว้าง | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
notifyRebootStarted
protected void notifyRebootStarted ()
Notifies all IDeviceActionReceiver
about reboot start event.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
performDeviceAction
protected boolean performDeviceAction (String actionDescription, NativeDevice.DeviceAction action, int retryAttempts)
Performs an action on this device. Attempts to recover device and optionally retry command if action fails.
Parameters | |
---|---|
actionDescription | String : a short description of action to be performed. Used for logging purposes only. |
action | NativeDevice.DeviceAction : the action to be performed |
retryAttempts | int : the retry attempts to make for action if it fails but recovery succeeds |
การส่งคืน | |
---|---|
boolean | true if action was performed successfully |
Throws | |
---|---|
DeviceNotAvailableException | if recovery attempt fails or max attempts done without success |
postAdbReboot
protected void postAdbReboot ()
Possible extra actions that can be taken after a reboot.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
prePostBootSetup
protected void prePostBootSetup ()
Allows each device type (AndroidNativeDevice, TestDevice) to override this method for specific post boot setup.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
pullFileInternal
protected boolean pullFileInternal (String remoteFilePath, File localFile)
พารามิเตอร์ | |
---|---|
remoteFilePath | String |
localFile | File |
การส่งคืน | |
---|---|
boolean |
Throws | |
---|---|
DeviceNotAvailableException |
setClock
protected void setClock (Clock clock)
Set the Clock instance to use.
Parameters | |
---|---|
clock | Clock |
setMicrodroidProcess
protected void setMicrodroidProcess (Process process)
Marks the TestDevice as microdroid and sets its CID.
Parameters | |
---|---|
process | Process : Process of the Microdroid VM. |
setTestDeviceOptions
protected void setTestDeviceOptions (deviceOptions)
Parameters | |
---|---|
deviceOptions |
simpleFastbootCommand
protected CommandResult simpleFastbootCommand (long timeout,envVarMap, String[] fullCmd)
Executes a simple fastboot command with environment variables and report the status of the command.
Parameters | |
---|---|
timeout | long |
envVarMap | |
fullCmd | String |
การส่งคืน | |
---|---|
CommandResult |
simpleFastbootCommand
protected CommandResult simpleFastbootCommand (long timeout, String[] fullCmd)
Executes a simple fastboot command and report the status of the command.
Parameters | |
---|---|
timeout | long |
fullCmd | String |
การส่งคืน | |
---|---|
CommandResult |
waitForDeviceNotAvailable
protected boolean waitForDeviceNotAvailable (String operationDesc, long time)
Wait to see the device going unavailable (stop reporting to adb).
Parameters | |
---|---|
operationDesc | String : The name of the operation that is waiting for unavailable. |
time | long : The time to wait for unavailable to occur. |
การส่งคืน | |
---|---|
boolean | True if device did become unavailable. |
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2023-12-04 UTC