Тестовое устройство
public class TestDevice
extends NativeDevice
Известные прямые подклассы |
Известные косвенные подклассы |
Реализация ITestDevice
для полнофункционального устройства Android.
Краткое содержание
Поля |
---|
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
Команды, которые можно использовать для отключения защиты клавиатуры.
Общественные конструкторы
Тестовое устройство
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 | |
отключитьKeyguard
public void disableKeyguard ()
Броски |
---|
DeviceNotAvailableException | |
делаетFileExist
public boolean doesFileExist (String deviceFilePath)
Параметры |
---|
deviceFilePath | String |
Броски |
---|
DeviceNotAvailableException | |
дампКуча
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 | |
получитьAndroidIds
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 | |
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 | |
имеет особенность
public boolean hasFeature (String feature)
Броски |
---|
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 | |
установитьПакеты
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 | |
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 | |
установить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 | |
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 | |
списокдисплейидс
public listDisplayIds ()
Броски |
---|
DeviceNotAvailableException | |
списокПользователи
public listUsers ()
Броски |
---|
DeviceNotAvailableException | |
постПризывСнос
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 | |
удалить пакет
public String uninstallPackage (String packageName)
Параметры |
---|
packageName | String |
Броски |
---|
DeviceNotAvailableException | |
деинсталлироватьПакажефорюсер
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 | |