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 đủ
Bản tóm tắt
Lĩnh vực |
---|
public static final String | DISMISS_KEYGUARD_CMD Các lệnh có thể được sử dụng để loại bỏ keyguard. |
Nhà thầu xây dựng công cộng |
---|
TestDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor) |
Phương pháp công cộng |
---|
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) |
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ỏ keyguard.
Nhà thầu xây dựng công cộng
Thiết bị kiểm tra
public TestDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)
Phương pháp công cộng
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 | |
tạoUserNoThrow
public int createUserNoThrow (String name)
Ném |
---|
DeviceNotAvailableException | |
vô hiệu hóaKeyguard
public void disableKeyguard ()
Ném |
---|
DeviceNotAvailableException | |
khôngFileExist
public boolean doesFileExist (String deviceFilePath)
Thông số |
---|
deviceFilePath | String |
Ném |
---|
DeviceNotAvailableException | |
đổ đống
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 | |
lấy ID Android
public String getAndroidId (int userId)
Ném |
---|
DeviceNotAvailableException | |
lấy ID Android
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 | |
get CurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
Trả lại |
---|
DeviceFoldableState | |
Ném |
---|
DeviceNotAvailableException | |
getCurrentUser
public int getCurrentUser ()
Ném |
---|
DeviceNotAvailableException | |
getFoldableStates
public getFoldableStates ()
Ném |
---|
DeviceNotAvailableException | |
getInstalledPackageNames
public getInstalledPackageNames ()
Ném |
---|
DeviceNotAvailableException | |
getKeyguardState
public KeyguardControllerState getKeyguardState ()
Trả lại |
---|
KeyguardControllerState | |
Ném |
---|
DeviceNotAvailableException | |
getMainlineModuleInfo
public getMainlineModuleInfo ()
Ném |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfRunningUsersSupported ()
Ném |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfUsersSupported ()
Ném |
---|
DeviceNotAvailableException | |
getPrimaryUserId
public Integer getPrimaryUserId ()
Ném |
---|
DeviceNotAvailableException | |
lấy Ảnh chụp màn hình
public InputStreamSource getScreenshot ()
Trả lại |
---|
InputStreamSource | |
Ném |
---|
DeviceNotAvailableException | |
lấy Ảnh chụp màn hình
public InputStreamSource getScreenshot (String format,
boolean rescale)
Thông số |
---|
format | String |
rescale | boolean |
Trả lại |
---|
InputStreamSource | |
Ném |
---|
DeviceNotAvailableException | |
lấy Ảnh chụp màn hình
public InputStreamSource getScreenshot (String format)
Trả lại |
---|
InputStreamSource | |
Ném |
---|
DeviceNotAvailableException | |
lấy Ảnh chụp màn hình
public InputStreamSource getScreenshot (long displayId)
Trả lại |
---|
InputStreamSource | |
Ném |
---|
DeviceNotAvailableException | |
cài đặt
public String getSetting (String namespace,
String key)
Thông số |
---|
namespace | String |
key | String |
Ném |
---|
DeviceNotAvailableException | |
cài đặt
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 | |
lấy thông tin người dùng
public getUserInfos ()
Ném |
---|
DeviceNotAvailableException | |
getUserSerialNumber
public int getUserSerialNumber (int userId)
Ném |
---|
DeviceNotAvailableException | |
có tính năng
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 | |
cài đặtPackageForUser
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 | |
cài đặtPackageForUser
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 | |
cài đặtGói
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
Thông số |
---|
packageFiles | |
reinstall | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
cài đặtGói
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Thông số |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
cài đặtGóiForUser
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 | |
cài đặtGóiForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
Thông số |
---|
packageFiles | |
reinstall | boolean |
userId | int |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
cài đặtRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Thông số |
---|
remoteApkPaths | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
cài đặtRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
String... extraArgs)
Thông số |
---|
remoteApkPaths | |
reinstall | boolean |
extraArgs | String |
Ném |
---|
DeviceNotAvailableException | |
isAppEnumerationĐược hỗ trợ
public boolean isAppEnumerationSupported ()
Ném |
---|
DeviceNotAvailableException | |
isMultiUserĐược hỗ trợ
public boolean isMultiUserSupported ()
Ném |
---|
DeviceNotAvailableException | |
isPackageĐã cài đặt
public boolean isPackageInstalled (String packageName)
Thông số |
---|
packageName | String |
Ném |
---|
DeviceNotAvailableException | |
isPackageĐã cài đặt
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 | |
danh sáchId hiển thị
public listDisplayIds ()
Ném |
---|
DeviceNotAvailableException | |
danh sáchNgười dùng
public listUsers ()
Ném |
---|
DeviceNotAvailableException | |
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Thông số |
---|
exception | Throwable |
xóaQuản trị viên
public boolean removeAdmin (String componentName,
int userId)
Thông số |
---|
componentName | String |
userId | int |
Ném |
---|
DeviceNotAvailableException | |
xóaChủ sở hữu
public void removeOwners ()
Ném |
---|
DeviceNotAvailableException | |
xóaNgười dùng
public boolean removeUser (int userId)
Ném |
---|
DeviceNotAvailableException | |
setChủ sở hữu thiết bị
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 | |
người dùng bắt đầu
public boolean startUser (int userId)
Ném |
---|
DeviceNotAvailableException | |
người dùng bắt đầu
public boolean startUser (int userId,
boolean waitFlag)
Thông số |
---|
userId | int |
waitFlag | boolean |
Ném |
---|
DeviceNotAvailableException | |
dừng lạiNgười dùng
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
Thông số |
---|
userId | int |
waitFlag | boolean |
forceFlag | boolean |
Ném |
---|
DeviceNotAvailableException | |
dừng lạiNgười dùng
public boolean stopUser (int userId)
Ném |
---|
DeviceNotAvailableException | |
người dùng chuyển đổi
public boolean switchUser (int userId)
Ném |
---|
DeviceNotAvailableException | |
người dùng chuyển đổi
public boolean switchUser (int userId,
long timeout)
Thông số |
---|
userId | int |
timeout | long |
Ném |
---|
DeviceNotAvailableException | |
gỡ cài đặtGói
public String uninstallPackage (String packageName)
Thông số |
---|
packageName | String |
Ném |
---|
DeviceNotAvailableException | |
gỡ cài đặtPackageForUser
public String uninstallPackageForUser (String packageName,
int userId)
Thông số |
---|
packageName | String |
userId | int |
Ném |
---|
DeviceNotAvailableException | |
Phương pháp được bảo vệ
doAdbKhởi động lại
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 ()
Tiếp xúc để 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 thức này để thiết lập sau khi khởi động cụ thể.
Ném |
---|
DeviceNotAvailableException | |