TestDevice
public class TestDevice
extends NativeDevice
Известные прямые подклассы ManagedRemoteDevice | Устройство, работающее внутри виртуальной машины, которым мы управляем удаленно через экземпляр Tradefed внутри виртуальной машины. | NestedRemoteDevice | Представление устройства, работающего внутри удаленной виртуальной машины Cuttlefish. | RemoteAndroidDevice | Реализация ITestDevice для полного стека андроид устройства , подключенного через ADB соединение. |
|
Известные косвенные подклассы |
Реализация ITestDevice
для полного стека андроид устройства
Резюме
Поля |
---|
public static final String | DISMISS_KEYGUARD_CMD Команды, которые можно использовать для снятия блокировки клавиатуры. |
Общественные конструкторы |
---|
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
Команды, которые можно использовать для снятия блокировки клавиатуры.
Общественные конструкторы
TestDevice
public TestDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)
Публичные методы
clearErrorDialogs
public boolean clearErrorDialogs ()
Броски |
---|
DeviceNotAvailableException | |
Создать пользователя
public int createUser (String name)
Броски |
---|
DeviceNotAvailableException | |
Создать пользователя
public int createUser (String name,
boolean guest,
boolean ephemeral)
Параметры |
---|
name | String |
guest | boolean |
ephemeral | boolean |
Броски |
---|
DeviceNotAvailableException | |
createUserNoThrow
public int createUserNoThrow (String name)
Броски |
---|
DeviceNotAvailableException | |
disableKeyguard
public void disableKeyguard ()
Броски |
---|
DeviceNotAvailableException | |
doesFileExist
public boolean doesFileExist (String deviceFilePath)
Параметры |
---|
deviceFilePath | String |
Броски |
---|
DeviceNotAvailableException | |
свалка
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 | |
getScreenshot
public InputStreamSource getScreenshot ()
Возврат |
---|
InputStreamSource | |
Броски |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot (String format,
boolean rescale)
Параметры |
---|
format | String |
rescale | boolean |
Возврат |
---|
InputStreamSource | |
Броски |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot (String format)
Возврат |
---|
InputStreamSource | |
Броски |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot (long displayId)
Возврат |
---|
InputStreamSource | |
Броски |
---|
DeviceNotAvailableException | |
getSetting
public String getSetting (String namespace,
String key)
Параметры |
---|
namespace | String |
key | String |
Броски |
---|
DeviceNotAvailableException | |
getSetting
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 | |
hasFeature
public boolean hasFeature (String feature)
Броски |
---|
DeviceNotAvailableException | |
installPackage
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
Параметры |
---|
packageFile | File |
reinstall | boolean |
extraArgs | String |
Броски |
---|
DeviceNotAvailableException | |
installPackage
public String installPackage (File packageFile,
File certFile,
boolean reinstall,
String... extraArgs)
Параметры |
---|
packageFile | File |
certFile | File |
reinstall | boolean |
extraArgs | String |
Броски |
---|
DeviceNotAvailableException | |
installPackage
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 | |
isAppEnumerationSupported
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 | |
listUsers
public listUsers ()
Броски |
---|
DeviceNotAvailableException | |
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Параметры |
---|
exception | Throwable |
removeAdmin
public boolean removeAdmin (String componentName,
int userId)
Параметры |
---|
componentName | String |
userId | int |
Броски |
---|
DeviceNotAvailableException | |
removeOwners
public void removeOwners ()
Броски |
---|
DeviceNotAvailableException | |
removeUser
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 | |
stopUser
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
Параметры |
---|
userId | int |
waitFlag | boolean |
forceFlag | boolean |
Броски |
---|
DeviceNotAvailableException | |
stopUser
public boolean stopUser (int userId)
Броски |
---|
DeviceNotAvailableException | |
поменять пользователя
public boolean switchUser (int userId)
Броски |
---|
DeviceNotAvailableException | |
поменять пользователя
public boolean switchUser (int userId,
long timeout)
Параметры |
---|
userId | int |
timeout | long |
Броски |
---|
DeviceNotAvailableException | |
uninstallPackage
public String uninstallPackage (String packageName)
Параметры |
---|
packageName | String |
Броски |
---|
DeviceNotAvailableException | |
uninstallPackageForUser
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 | |