Dispositivo de teste
public class TestDevice
extends NativeDevice
Subclasses diretas conhecidas |
Subclasses indiretas conhecidas |
Implementação de um ITestDevice
para um dispositivo Android full stack
Resumo
Campos |
---|
public static final String | DISMISS_KEYGUARD_CMD Comandos que podem ser usados para dispensar a proteção do teclado. |
Métodos públicos |
---|
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) |
Campos
DISMISS_KEYGUARD_CMD
public static final String DISMISS_KEYGUARD_CMD
Comandos que podem ser usados para dispensar a proteção do teclado.
Construtores públicos
Dispositivo de teste
public TestDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)
Métodos públicos
clearErrorDialogs
public boolean clearErrorDialogs ()
Lança |
---|
DeviceNotAvailableException | |
criarUsuário
public int createUser (String name)
Lança |
---|
DeviceNotAvailableException | |
criarUsuário
public int createUser (String name,
boolean guest,
boolean ephemeral)
Parâmetros |
---|
name | String |
guest | boolean |
ephemeral | boolean |
Lança |
---|
DeviceNotAvailableException | |
createUserNoThrow
public int createUserNoThrow (String name)
Lança |
---|
DeviceNotAvailableException | |
desabilitarKeyguard
public void disableKeyguard ()
Lança |
---|
DeviceNotAvailableException | |
fazFileExist
public boolean doesFileExist (String deviceFilePath)
Parâmetros |
---|
deviceFilePath | String |
Lança |
---|
DeviceNotAvailableException | |
dumpHeap
public File dumpHeap (String process,
String devicePath)
Parâmetros |
---|
process | String |
devicePath | String |
Lança |
---|
DeviceNotAvailableException | |
getActiveApexes
public getActiveApexes ()
Lança |
---|
DeviceNotAvailableException | |
getAllSettings
public getAllSettings (String namespace)
Parâmetros |
---|
namespace | String |
Lança |
---|
DeviceNotAvailableException | |
obterAndroidId
public String getAndroidId (int userId)
Lança |
---|
DeviceNotAvailableException | |
obterAndroidIds
public getAndroidIds ()
Lança |
---|
DeviceNotAvailableException | |
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
Parâmetros |
---|
packageName | String |
Lança |
---|
DeviceNotAvailableException | |
getAppPackageInfos
public getAppPackageInfos ()
Lança |
---|
DeviceNotAvailableException | |
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
Devoluções |
---|
DeviceFoldableState | |
Lança |
---|
DeviceNotAvailableException | |
getCurrentUser
public int getCurrentUser ()
Lança |
---|
DeviceNotAvailableException | |
getFoldableStates
public getFoldableStates ()
Lança |
---|
DeviceNotAvailableException | |
getInstalledPackageNames
public getInstalledPackageNames ()
Lança |
---|
DeviceNotAvailableException | |
getKeyguardState
public KeyguardControllerState getKeyguardState ()
Devoluções |
---|
KeyguardControllerState | |
Lança |
---|
DeviceNotAvailableException | |
getMainlineModuleInfo
public getMainlineModuleInfo ()
Lança |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfRunningUsersSupported ()
Lança |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfUsersSupported ()
Lança |
---|
DeviceNotAvailableException | |
getPrimaryUserId
public Integer getPrimaryUserId ()
Lança |
---|
DeviceNotAvailableException | |
obter captura de tela
public InputStreamSource getScreenshot ()
Devoluções |
---|
InputStreamSource | |
Lança |
---|
DeviceNotAvailableException | |
obter captura de tela
public InputStreamSource getScreenshot (String format,
boolean rescale)
Parâmetros |
---|
format | String |
rescale | boolean |
Devoluções |
---|
InputStreamSource | |
Lança |
---|
DeviceNotAvailableException | |
obter captura de tela
public InputStreamSource getScreenshot (String format)
Devoluções |
---|
InputStreamSource | |
Lança |
---|
DeviceNotAvailableException | |
obter captura de tela
public InputStreamSource getScreenshot (long displayId)
Parâmetros |
---|
displayId | long |
Devoluções |
---|
InputStreamSource | |
Lança |
---|
DeviceNotAvailableException | |
getSetting
public String getSetting (String namespace,
String key)
Parâmetros |
---|
namespace | String |
key | String |
Lança |
---|
DeviceNotAvailableException | |
getSetting
public String getSetting (int userId,
String namespace,
String key)
Parâmetros |
---|
userId | int |
namespace | String |
key | String |
Lança |
---|
DeviceNotAvailableException | |
getUninstallablePackageNames
public getUninstallablePackageNames ()
Lança |
---|
DeviceNotAvailableException | |
getUserFlags
public int getUserFlags (int userId)
Lança |
---|
DeviceNotAvailableException | |
getUserInfos
public getUserInfos ()
Lança |
---|
DeviceNotAvailableException | |
getUserSerialNumber
public int getUserSerialNumber (int userId)
Lança |
---|
DeviceNotAvailableException | |
temRecurso
public boolean hasFeature (String feature)
Parâmetros |
---|
feature | String |
Lança |
---|
DeviceNotAvailableException | |
instalarPacote
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
Parâmetros |
---|
packageFile | File |
reinstall | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
instalarPacote
public String installPackage (File packageFile,
File certFile,
boolean reinstall,
String... extraArgs)
Parâmetros |
---|
packageFile | File |
certFile | File |
reinstall | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
instalarPacote
public String installPackage (File packageFile,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parâmetros |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
instalarPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
Parâmetros |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
instalarPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
Parâmetros |
---|
packageFile | File |
reinstall | boolean |
userId | int |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
instalar pacotes
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
Parâmetros |
---|
packageFiles | |
reinstall | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
instalar pacotes
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parâmetros |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
instalarPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
Parâmetros |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
instalarPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
Parâmetros |
---|
packageFiles | |
reinstall | boolean |
userId | int |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
instalarRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parâmetros |
---|
remoteApkPaths | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
instalarRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
String... extraArgs)
Parâmetros |
---|
remoteApkPaths | |
reinstall | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
Lança |
---|
DeviceNotAvailableException | |
isMultiUserSupportado
public boolean isMultiUserSupported ()
Lança |
---|
DeviceNotAvailableException | |
isPackageInstalled
public boolean isPackageInstalled (String packageName)
Parâmetros |
---|
packageName | String |
Lança |
---|
DeviceNotAvailableException | |
isPackageInstalled
public boolean isPackageInstalled (String packageName,
String userId)
Parâmetros |
---|
packageName | String |
userId | String |
Lança |
---|
DeviceNotAvailableException | |
isUserRunning
public boolean isUserRunning (int userId)
Lança |
---|
DeviceNotAvailableException | |
isUserSecondary
public boolean isUserSecondary (int userId)
Lança |
---|
DeviceNotAvailableException | |
listaDisplayIds
public listDisplayIds ()
Lança |
---|
DeviceNotAvailableException | |
listaUsuários
public listUsers ()
Lança |
---|
DeviceNotAvailableException | |
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Parâmetros |
---|
exception | Throwable |
removerAdmin
public boolean removeAdmin (String componentName,
int userId)
Parâmetros |
---|
componentName | String |
userId | int |
Lança |
---|
DeviceNotAvailableException | |
removerProprietários
public void removeOwners ()
Lança |
---|
DeviceNotAvailableException | |
removerUsuário
public boolean removeUser (int userId)
Lança |
---|
DeviceNotAvailableException | |
setDeviceOwner
public boolean setDeviceOwner (String componentName,
int userId)
Parâmetros |
---|
componentName | String |
userId | int |
Lança |
---|
DeviceNotAvailableException | |
definirConfiguração
public void setSetting (String namespace,
String key,
String value)
Parâmetros |
---|
namespace | String |
key | String |
value | String |
Lança |
---|
DeviceNotAvailableException | |
definirConfiguração
public void setSetting (int userId,
String namespace,
String key,
String value)
Parâmetros |
---|
userId | int |
namespace | String |
key | String |
value | String |
Lança |
---|
DeviceNotAvailableException | |
usuário inicial
public boolean startUser (int userId)
Lança |
---|
DeviceNotAvailableException | |
usuário inicial
public boolean startUser (int userId,
boolean waitFlag)
Parâmetros |
---|
userId | int |
waitFlag | boolean |
Lança |
---|
DeviceNotAvailableException | |
pararUsuário
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
Parâmetros |
---|
userId | int |
waitFlag | boolean |
forceFlag | boolean |
Lança |
---|
DeviceNotAvailableException | |
pararUsuário
public boolean stopUser (int userId)
Lança |
---|
DeviceNotAvailableException | |
mudar de utilizador
public boolean switchUser (int userId)
Lança |
---|
DeviceNotAvailableException | |
mudar de utilizador
public boolean switchUser (int userId,
long timeout)
Parâmetros |
---|
userId | int |
timeout | long |
Lança |
---|
DeviceNotAvailableException | |
desinstalarPackage
public String uninstallPackage (String packageName)
Parâmetros |
---|
packageName | String |
Lança |
---|
DeviceNotAvailableException | |
desinstalarPackageForUser
public String uninstallPackageForUser (String packageName,
int userId)
Parâmetros |
---|
packageName | String |
userId | int |
Lança |
---|
DeviceNotAvailableException | |
Métodos protegidos
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode,
String reason)
Execute uma reinicialização do adb.
Parâmetros |
---|
rebootMode | NativeDevice.RebootMode : um modo desta reinicialização. |
reason | String : para esta reinicialização. |
Lança |
---|
DeviceNotAvailableException | |
getCheckNewUserSleep
protected long getCheckNewUserSleep ()
Exposto para testes.
getHostCurrentTime
protected long getHostCurrentTime ()
Exposto para testes
prePostBootSetup
protected void prePostBootSetup ()
Permite que cada tipo de dispositivo (AndroidNativeDevice, TestDevice) substitua esse método para configuração específica pós-inicialização.
Lança |
---|
DeviceNotAvailableException | |