อุปกรณ์ทดสอบ
public class TestDevice
extends NativeDevice
การใช้งาน ITestDevice
สำหรับอุปกรณ์ Android แบบเต็มสแต็ก
สรุป
วิธีการสาธารณะ |
---|
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)
วิธีการสาธารณะ
clearErrorDialogs
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 | |
getAllSettings
public getAllSettings (String namespace)
พารามิเตอร์ |
---|
namespace | String |
ขว้าง |
---|
DeviceNotAvailableException | |
getAndroidId
public String getAndroidId (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
getAndroidIds
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 | |
getPrimaryUserId
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 | |
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
พารามิเตอร์ |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
พารามิเตอร์ |
---|
packageFile | File |
reinstall | boolean |
userId | int |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
พารามิเตอร์ |
---|
packageFiles | |
reinstall | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
พารามิเตอร์ |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
installPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
พารามิเตอร์ |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
installPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
พารามิเตอร์ |
---|
packageFiles | |
reinstall | boolean |
userId | int |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
พารามิเตอร์ |
---|
remoteApkPaths | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
String... extraArgs)
พารามิเตอร์ |
---|
remoteApkPaths | |
reinstall | boolean |
extraArgs | String |
ขว้าง |
---|
DeviceNotAvailableException | |
isAppEnumerationได้รับการสนับสนุน
public boolean isAppEnumerationSupported ()
ขว้าง |
---|
DeviceNotAvailableException | |
isMultiUserSupported
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 | |
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
พารามิเตอร์ |
---|
exception | Throwable |
ลบผู้ดูแลระบบ
public boolean removeAdmin (String componentName,
int userId)
พารามิเตอร์ |
---|
componentName | String |
userId | int |
ขว้าง |
---|
DeviceNotAvailableException | |
ลบเจ้าของ
public void removeOwners ()
ขว้าง |
---|
DeviceNotAvailableException | |
ลบUser
public boolean removeUser (int userId)
ขว้าง |
---|
DeviceNotAvailableException | |
setDeviceOwner
public boolean setDeviceOwner (String componentName,
int userId)
พารามิเตอร์ |
---|
componentName | String |
userId | int |
ขว้าง |
---|
DeviceNotAvailableException | |
setSetting
public void setSetting (String namespace,
String key,
String value)
พารามิเตอร์ |
---|
namespace | String |
key | String |
value | String |
ขว้าง |
---|
DeviceNotAvailableException | |
setSetting
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 | |