Thiết bị kiểm tra
public class TestDevice
extends NativeDevice
Các lớp con trực tiếp đã biết |
Các lớp con gián tiếp đã biết |
Triển khai ITestDevice
cho thiết bị Android đầy đủ
Tóm lược
Lĩnh vực |
---|
public static final String | DISMISS_KEYGUARD_CMD Các lệnh có thể được sử dụng để loại bỏ khóa phím. |
Phương pháp công khai |
---|
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 () |
int | getCurrentUser () |
| getInstalledPackageNames () |
KeyguardControllerState | getKeyguardState () |
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) |
Lĩnh vực
DISMISS_KEYGUARD_CMD
public static final String DISMISS_KEYGUARD_CMD
Các lệnh có thể được sử dụng để loại bỏ khóa phím.
Công cụ xây dựng
Thiết bị kiểm tra
public TestDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)
Phương pháp công khai
clearErrorDialogs
public boolean clearErrorDialogs ()
Ném |
---|
DeviceNotAvailableException | |
tạo người dùng
public int createUser (String name)
Ném |
---|
DeviceNotAvailableException | |
tạo người dùng
public int createUser (String name,
boolean guest,
boolean ephemeral)
Thông số |
---|
name | String |
guest | boolean |
ephemeral | boolean |
Ném |
---|
DeviceNotAvailableException | |
createUserNoThrow
public int createUserNoThrow (String name)
Ném |
---|
DeviceNotAvailableException | |
disableKeyguard
public void disableKeyguard ()
Ném |
---|
DeviceNotAvailableException | |
doesFileExist
public boolean doesFileExist (String deviceFilePath)
Thông số |
---|
deviceFilePath | String |
Ném |
---|
DeviceNotAvailableException | |
dumpHeap
public File dumpHeap (String process,
String devicePath)
Thông số |
---|
process | String |
devicePath | String |
Ném |
---|
DeviceNotAvailableException | |
getActiveApexes
public getActiveApexes ()
Ném |
---|
DeviceNotAvailableException | |
getAllSettings
public getAllSettings (String namespace)
Thông số |
---|
namespace | String |
Ném |
---|
DeviceNotAvailableException | |
getAndroidId
public String getAndroidId (int userId)
Ném |
---|
DeviceNotAvailableException | |
getAndroidIds
public getAndroidIds ()
Ném |
---|
DeviceNotAvailableException | |
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
Thông số |
---|
packageName | String |
Ném |
---|
DeviceNotAvailableException | |
getAppPackageInfos
public getAppPackageInfos ()
Ném |
---|
DeviceNotAvailableException | |
getCurrentUser
public int getCurrentUser ()
Ném |
---|
DeviceNotAvailableException | |
getInstalledPackageNames
public getInstalledPackageNames ()
Ném |
---|
DeviceNotAvailableException | |
getKeyguardState
public KeyguardControllerState getKeyguardState ()
Lợi nhuận |
---|
KeyguardControllerState | |
Ném |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfRunningUsersSupported ()
Ném |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfUsersSupported ()
Ném |
---|
DeviceNotAvailableException | |
getPrimaryUserId
public Integer getPrimaryUserId ()
Ném |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot ()
Lợi nhuận |
---|
InputStreamSource | |
Ném |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot (String format,
boolean rescale)
Thông số |
---|
format | String |
rescale | boolean |
Lợi nhuận |
---|
InputStreamSource | |
Ném |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot (String format)
Lợi nhuận |
---|
InputStreamSource | |
Ném |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot (long displayId)
Lợi nhuận |
---|
InputStreamSource | |
Ném |
---|
DeviceNotAvailableException | |
getSetting
public String getSetting (String namespace,
String key)
Thông số |
---|
namespace | String |
key | String |
Ném |
---|
DeviceNotAvailableException | |
getSetting
public String getSetting (int userId,
String namespace,
String key)
Thông số |
---|
userId | int |
namespace | String |
key | String |
Ném |
---|
DeviceNotAvailableException | |
getUninstallablePackageNames
public getUninstallablePackageNames ()
Ném |
---|
DeviceNotAvailableException | |
getUserFlags
public int getUserFlags (int userId)
Ném |
---|
DeviceNotAvailableException | |
getUserInfos
public getUserInfos ()
Ném |
---|
DeviceNotAvailableException | |
getUserSerialNumber
public int getUserSerialNumber (int userId)
Ném |
---|
DeviceNotAvailableException | |
hasFeature
public boolean hasFeature (String feature)
Ném |
---|
DeviceNotAvailableException | |
cài đặt gói
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
Thông số |
---|
packageFile | File |
reinstall | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
cài đặt gói
public String installPackage (File packageFile,
File certFile,
boolean reinstall,
String... extraArgs)
Thông số |
---|
packageFile | File |
certFile | File |
reinstall | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
cài đặt gói
public String installPackage (File packageFile,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Thông số |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
Thông số |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
Thông số |
---|
packageFile | File |
reinstall | boolean |
userId | int |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
Thông số |
---|
packageFiles | |
reinstall | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Thông số |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
installPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
Thông số |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
installPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
Thông số |
---|
packageFiles | |
reinstall | boolean |
userId | int |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Thông số |
---|
remoteApkPaths | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
String... extraArgs)
Thông số |
---|
remoteApkPaths | |
reinstall | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
Ném |
---|
DeviceNotAvailableException | |
isMultiUserSupported
public boolean isMultiUserSupported ()
Ném |
---|
DeviceNotAvailableException | |
isPackageInstalled
public boolean isPackageInstalled (String packageName)
Thông số |
---|
packageName | String |
Ném |
---|
DeviceNotAvailableException | |
isPackageInstalled
public boolean isPackageInstalled (String packageName,
String userId)
Thông số |
---|
packageName | String |
userId | String |
Ném |
---|
DeviceNotAvailableException | |
isUserRunning
public boolean isUserRunning (int userId)
Ném |
---|
DeviceNotAvailableException | |
isUserSecondary
public boolean isUserSecondary (int userId)
Ném |
---|
DeviceNotAvailableException | |
listDisplayIds
public listDisplayIds ()
Ném |
---|
DeviceNotAvailableException | |
listUsers
public listUsers ()
Ném |
---|
DeviceNotAvailableException | |
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Thông số |
---|
exception | Throwable |
removeAdmin
public boolean removeAdmin (String componentName,
int userId)
Thông số |
---|
componentName | String |
userId | int |
Ném |
---|
DeviceNotAvailableException | |
removeOwners
public void removeOwners ()
Ném |
---|
DeviceNotAvailableException | |
removeUser
public boolean removeUser (int userId)
Ném |
---|
DeviceNotAvailableException | |
setDeviceOwner
public boolean setDeviceOwner (String componentName,
int userId)
Thông số |
---|
componentName | String |
userId | int |
Ném |
---|
DeviceNotAvailableException | |
setSetting
public void setSetting (String namespace,
String key,
String value)
Thông số |
---|
namespace | String |
key | String |
value | String |
Ném |
---|
DeviceNotAvailableException | |
setSetting
public void setSetting (int userId,
String namespace,
String key,
String value)
Thông số |
---|
userId | int |
namespace | String |
key | String |
value | String |
Ném |
---|
DeviceNotAvailableException | |
startUser
public boolean startUser (int userId)
Ném |
---|
DeviceNotAvailableException | |
startUser
public boolean startUser (int userId,
boolean waitFlag)
Thông số |
---|
userId | int |
waitFlag | boolean |
Ném |
---|
DeviceNotAvailableException | |
stopUser
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
Thông số |
---|
userId | int |
waitFlag | boolean |
forceFlag | boolean |
Ném |
---|
DeviceNotAvailableException | |
stopUser
public boolean stopUser (int userId)
Ném |
---|
DeviceNotAvailableException | |
switchUser
public boolean switchUser (int userId)
Ném |
---|
DeviceNotAvailableException | |
switchUser
public boolean switchUser (int userId,
long timeout)
Thông số |
---|
userId | int |
timeout | long |
Ném |
---|
DeviceNotAvailableException | |
gỡ cài đặt
public String uninstallPackage (String packageName)
Thông số |
---|
packageName | String |
Ném |
---|
DeviceNotAvailableException | |
Các phương pháp được bảo vệ
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode,
String reason)
Thực hiện khởi động lại adb.
Thông số |
---|
rebootMode | NativeDevice.RebootMode : một chế độ khởi động lại này. |
reason | String : cho lần khởi động lại này. |
Ném |
---|
DeviceNotAvailableException | |
getCheckNewUserSleep
protected long getCheckNewUserSleep ()
Phơi để thử nghiệm.
getHostCurrentTime
protected long getHostCurrentTime ()
Tiếp xúc để thử nghiệm
prePostBootSetup
protected void prePostBootSetup ()
Cho phép từng loại thiết bị (AndroidNativeDevice, TestDevice) ghi đè phương pháp này để thiết lập khởi động bài cụ thể.
Ném |
---|
DeviceNotAvailableException | |