อุปกรณ์ทดสอบ
public class TestDevice
extends NativeDevice
การใช้งาน ITestDevice
สำหรับอุปกรณ์ Android แบบสแต็กเต็มรูปแบบ
สรุป
ผู้รับเหมาก่อสร้างสาธารณะ |
---|
TestDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor) |
วิธีการสาธารณะ |
---|
boolean | clearErrorDialogs () |
int | createUser (String name) |
int | createUser (String name, boolean guest, boolean ephemeral) |
int | createUserNoThrow (String name) |
void | disableKeyguard () |
boolean | doesFileExist (String deviceFilePath) |
File | dumpHeap (String process, String devicePath) |
| getActiveApexes () |
| getAllSettings (String namespace) |
String | getAndroidId (int userId) |
| getAndroidIds () |
PackageInfo | getAppPackageInfo (String packageName) |
| getAppPackageInfos () |
DeviceFoldableState | getCurrentFoldableState () |
int | getCurrentUser () |
| getFoldableStates () |
| getInstalledPackageNames () |
KeyguardControllerState | getKeyguardState () |
| getMainlineModuleInfo () |
int | getMaxNumberOfRunningUsersSupported () |
int | getMaxNumberOfUsersSupported () |
Integer | getPrimaryUserId () |
InputStreamSource | getScreenshot () |
InputStreamSource | getScreenshot (String format, boolean rescale) |
InputStreamSource | getScreenshot (String format) |
InputStreamSource | getScreenshot (long displayId) |
String | getSetting (String namespace, String key) |
String | getSetting (int userId, String namespace, String key) |
| getUninstallablePackageNames () |
int | getUserFlags (int userId) |
| getUserInfos () |
int | getUserSerialNumber (int userId) |
boolean | hasFeature (String feature) |
String | installPackage (File packageFile, boolean reinstall, String... extraArgs) |
String | installPackage (File packageFile, File certFile, boolean reinstall, String... extraArgs) |
String | installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs) |
String | installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) |
String | installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs) |
String | installPackages ( packageFiles, boolean reinstall, String... extraArgs) installPackages ( packageFiles, boolean reinstall, String... extraArgs) |
String | installPackages ( packageFiles, boolean reinstall, boolean grantPermissions, String... extraArgs) installPackages ( packageFiles, boolean reinstall, boolean grantPermissions, String... extraArgs) |
String | installPackagesForUser ( packageFiles, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) installPackagesForUser ( packageFiles, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) |
String | installPackagesForUser ( packageFiles, boolean reinstall, int userId, String... extraArgs) installPackagesForUser ( packageFiles, boolean reinstall, int userId, String... extraArgs) |
String | installRemotePackages ( remoteApkPaths, boolean reinstall, boolean grantPermissions, String... extraArgs) installRemotePackages ( remoteApkPaths, boolean reinstall, boolean grantPermissions, String... extraArgs) |
String | installRemotePackages ( remoteApkPaths, boolean reinstall, String... extraArgs) installRemotePackages ( remoteApkPaths, boolean reinstall, String... extraArgs) |
boolean | isAppEnumerationSupported () |
boolean | isMultiUserSupported () |
boolean | isPackageInstalled (String packageName) |
boolean | isPackageInstalled (String packageName, String userId) |
boolean | isUserRunning (int userId) |
boolean | isUserSecondary (int userId) |
| listDisplayIds () |
| listUsers () |
void | postInvocationTearDown (Throwable exception) |
boolean | removeAdmin (String componentName, int userId) |
void | removeOwners () |
boolean | removeUser (int userId) |
boolean | setDeviceOwner (String componentName, int userId) |
void | setSetting (String namespace, String key, String value) |
void | setSetting (int userId, String namespace, String key, String value) |
boolean | startUser (int userId) |
boolean | startUser (int userId, boolean waitFlag) |
boolean | stopUser (int userId, boolean waitFlag, boolean forceFlag) |
boolean | stopUser (int userId) |
boolean | switchUser (int userId) |
boolean | switchUser (int userId, long timeout) |
String | uninstallPackage (String packageName) |
String | uninstallPackageForUser (String packageName, int userId) |
เขตข้อมูล
DISMISS_KEYGUARD_CMD
public static final String DISMISS_KEYGUARD_CMD
คำสั่งที่สามารถใช้เพื่อยกเลิกคีย์การ์ดได้
ผู้รับเหมาก่อสร้างสาธารณะ
อุปกรณ์ทดสอบ
public TestDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)
วิธีการสาธารณะ
ล้างข้อผิดพลาด Dialogs
public boolean clearErrorDialogs ()
ขว้าง |
---|
DeviceNotAvailableException | |
createUser
public int createUser (String name)
ขว้าง |
---|
DeviceNotAvailableException | |
createUser
public int createUser (String name,
boolean guest,
boolean ephemeral)
พารามิเตอร์ |
---|
name | String |
guest | boolean |
ephemeral | boolean |
ขว้าง |
---|
DeviceNotAvailableException | |
createUserNoThrow
public int createUserNoThrow (String name)
ขว้าง |
---|
DeviceNotAvailableException | |
ปิดการใช้งานKeyguard
public void disableKeyguard ()
ขว้าง |
---|
DeviceNotAvailableException | |
ไม่FileExist
public boolean doesFileExist (String deviceFilePath)
พารามิเตอร์ |
---|
deviceFilePath | String |
ขว้าง |
---|
DeviceNotAvailableException | |
dumpHeap
public File dumpHeap (String process,
String devicePath)
พารามิเตอร์ |
---|
process | String |
devicePath | String |
ขว้าง |
---|
DeviceNotAvailableException | |
getActiveApexes
public getActiveApexes ()
ขว้าง |
---|
DeviceNotAvailableException | |
รับการตั้งค่าทั้งหมด
public getAllSettings (String namespace)
พารามิเตอร์ |
---|
namespace | String |
ขว้าง |
---|
DeviceNotAvailableException | |
รับ AndroidId
public String getAndroidId (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
รับรหัส Android
public getAndroidIds ()
ขว้าง |
---|
DeviceNotAvailableException | |
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
พารามิเตอร์ |
---|
packageName | String |
ขว้าง |
---|
DeviceNotAvailableException | |
getAppPackageInfos
public getAppPackageInfos ()
ขว้าง |
---|
DeviceNotAvailableException | |
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
การส่งคืน |
---|
DeviceFoldableState | |
ขว้าง |
---|
DeviceNotAvailableException | |
getCurrentUser
public int getCurrentUser ()
ขว้าง |
---|
DeviceNotAvailableException | |
getFoldableStates
public getFoldableStates ()
ขว้าง |
---|
DeviceNotAvailableException | |
getInstalledPackageNames
public getInstalledPackageNames ()
ขว้าง |
---|
DeviceNotAvailableException | |
getKeyguardState
public KeyguardControllerState getKeyguardState ()
การส่งคืน |
---|
KeyguardControllerState | |
ขว้าง |
---|
DeviceNotAvailableException | |
getMainlineModuleInfo
public getMainlineModuleInfo ()
ขว้าง |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfRunningUsersSupported ()
ขว้าง |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfUsersSupported ()
ขว้าง |
---|
DeviceNotAvailableException | |
รับ PrimaryUserId
public Integer getPrimaryUserId ()
ขว้าง |
---|
DeviceNotAvailableException | |
รับภาพหน้าจอ
public InputStreamSource getScreenshot ()
การส่งคืน |
---|
InputStreamSource | |
ขว้าง |
---|
DeviceNotAvailableException | |
รับภาพหน้าจอ
public InputStreamSource getScreenshot (String format,
boolean rescale)
พารามิเตอร์ |
---|
format | String |
rescale | boolean |
การส่งคืน |
---|
InputStreamSource | |
ขว้าง |
---|
DeviceNotAvailableException | |
รับภาพหน้าจอ
public InputStreamSource getScreenshot (String format)
พารามิเตอร์ |
---|
format | String |
การส่งคืน |
---|
InputStreamSource | |
ขว้าง |
---|
DeviceNotAvailableException | |
รับภาพหน้าจอ
public InputStreamSource getScreenshot (long displayId)
พารามิเตอร์ |
---|
displayId | long |
การส่งคืน |
---|
InputStreamSource | |
ขว้าง |
---|
DeviceNotAvailableException | |
รับการตั้งค่า
public String getSetting (String namespace,
String key)
พารามิเตอร์ |
---|
namespace | String |
key | String |
ขว้าง |
---|
DeviceNotAvailableException | |
รับการตั้งค่า
public String getSetting (int userId,
String namespace,
String key)
พารามิเตอร์ |
---|
userId | int |
namespace | String |
key | String |
ขว้าง |
---|
DeviceNotAvailableException | |
getUninstallablePackageNames
public getUninstallablePackageNames ()
ขว้าง |
---|
DeviceNotAvailableException | |
getUserFlags
public int getUserFlags (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
getUserInfos
public getUserInfos ()
ขว้าง |
---|
DeviceNotAvailableException | |
getUserSerialNumber
public int getUserSerialNumber (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
มีคุณลักษณะ
public boolean hasFeature (String feature)
พารามิเตอร์ |
---|
feature | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้งแพ็คเกจ
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
พารามิเตอร์ |
---|
packageFile | File |
reinstall | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้งแพ็คเกจ
public String installPackage (File packageFile,
File certFile,
boolean reinstall,
String... extraArgs)
พารามิเตอร์ |
---|
packageFile | File |
certFile | File |
reinstall | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้งแพ็คเกจ
public String installPackage (File packageFile,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
พารามิเตอร์ |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้ง PackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
พารามิเตอร์ |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้ง PackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
พารามิเตอร์ |
---|
packageFile | File |
reinstall | boolean |
userId | int |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้งแพ็คเกจ
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
พารามิเตอร์ |
---|
packageFiles | |
reinstall | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้งแพ็คเกจ
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
พารามิเตอร์ |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้งPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
พารามิเตอร์ |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้งPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
พารามิเตอร์ |
---|
packageFiles | |
reinstall | boolean |
userId | int |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้ง RemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
พารามิเตอร์ |
---|
remoteApkPaths | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ติดตั้ง RemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
String... extraArgs)
พารามิเตอร์ |
---|
remoteApkPaths | |
reinstall | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
รองรับ isAppEnumeration แล้ว
public boolean isAppEnumerationSupported ()
ขว้าง |
---|
DeviceNotAvailableException | |
รองรับผู้ใช้หลายราย
public boolean isMultiUserSupported ()
ขว้าง |
---|
DeviceNotAvailableException | |
isPackageInstalled แล้ว
public boolean isPackageInstalled (String packageName)
พารามิเตอร์ |
---|
packageName | String |
ขว้าง |
---|
DeviceNotAvailableException | |
isPackageInstalled แล้ว
public boolean isPackageInstalled (String packageName,
String userId)
พารามิเตอร์ |
---|
packageName | String |
userId | String |
ขว้าง |
---|
DeviceNotAvailableException | |
isUserRunning
public boolean isUserRunning (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
isUserSecondary
public boolean isUserSecondary (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
listDisplayIds
public listDisplayIds ()
ขว้าง |
---|
DeviceNotAvailableException | |
รายชื่อผู้ใช้
public listUsers ()
ขว้าง |
---|
DeviceNotAvailableException | |
โพสต์คำร้องขอTearDown
public void postInvocationTearDown (Throwable exception)
พารามิเตอร์ |
---|
exception | Throwable |
ลบผู้ดูแลระบบ
public boolean removeAdmin (String componentName,
int userId)
พารามิเตอร์ |
---|
componentName | String |
userId | int |
ขว้าง |
---|
DeviceNotAvailableException | |
ลบเจ้าของ
public void removeOwners ()
ขว้าง |
---|
DeviceNotAvailableException | |
ลบผู้ใช้
public boolean removeUser (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
setDeviceOwner
public boolean setDeviceOwner (String componentName,
int userId)
พารามิเตอร์ |
---|
componentName | String |
userId | int |
ขว้าง |
---|
DeviceNotAvailableException | |
ตั้งค่าการตั้งค่า
public void setSetting (String namespace,
String key,
String value)
พารามิเตอร์ |
---|
namespace | String |
key | String |
value | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ตั้งค่าการตั้งค่า
public void setSetting (int userId,
String namespace,
String key,
String value)
พารามิเตอร์ |
---|
userId | int |
namespace | String |
key | String |
value | String |
ขว้าง |
---|
DeviceNotAvailableException | |
startUser
public boolean startUser (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
startUser
public boolean startUser (int userId,
boolean waitFlag)
พารามิเตอร์ |
---|
userId | int |
waitFlag | boolean |
ขว้าง |
---|
DeviceNotAvailableException | |
ผู้ใช้หยุด
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
พารามิเตอร์ |
---|
userId | int |
waitFlag | boolean |
forceFlag | boolean |
ขว้าง |
---|
DeviceNotAvailableException | |
ผู้ใช้หยุด
public boolean stopUser (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
เปลี่ยนผู้ใช้
public boolean switchUser (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
เปลี่ยนผู้ใช้
public boolean switchUser (int userId,
long timeout)
พารามิเตอร์ |
---|
userId | int |
timeout | long |
ขว้าง |
---|
DeviceNotAvailableException | |
ถอนการติดตั้ง Package
public String uninstallPackage (String packageName)
พารามิเตอร์ |
---|
packageName | String |
ขว้าง |
---|
DeviceNotAvailableException | |
ถอนการติดตั้ง PackageForUser
public String uninstallPackageForUser (String packageName,
int userId)
พารามิเตอร์ |
---|
packageName | String |
userId | int |
ขว้าง |
---|
DeviceNotAvailableException | |
วิธีการที่ได้รับการป้องกัน
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode,
String reason)
ทำการรีบูต adb
พารามิเตอร์ |
---|
rebootMode | NativeDevice.RebootMode : โหมดของการรีบูตนี้ |
reason | String : สำหรับการรีบูตครั้งนี้ |
ขว้าง |
---|
DeviceNotAvailableException | |
getCheckNewUserSleep
protected long getCheckNewUserSleep ()
เปิดเผยสำหรับการทดสอบ
getHostCurrentTime
protected long getHostCurrentTime ()
เปิดเผยสำหรับการทดสอบ
prePostBootSetup
protected void prePostBootSetup ()
อนุญาตให้อุปกรณ์แต่ละประเภท (AndroidNativeDevice, TestDevice) ลบล้างวิธีนี้สำหรับการตั้งค่าหลังการบูตที่เฉพาะเจาะจง
ขว้าง |
---|
DeviceNotAvailableException | |