TestDevice
public class TestDevice
extends NativeDevice
Subclasses diretas conhecidas ManagedRemoteDevice | Um dispositivo executado dentro de uma máquina virtual que gerenciamos remotamente por meio de uma instância Tradefed dentro da VM. | NestedRemoteDevice | Representação do dispositivo rodando dentro de uma VM Cuttlefish remota. | RemoteAndroidDevice | Implementação de um ITestDevice para um dispositivo android pilha completa conectado via adb conexão. |
|
Subclasses indiretas conhecidas |
Implementação de um ITestDevice
para um dispositivo android pilha completa
Resumo
Campos |
---|
public static final String | DISMISS_KEYGUARD_CMD Comandos que podem ser usados para descartar 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 descartar a proteção do teclado.
Construtoras públicas
TestDevice
public TestDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)
Métodos públicos
clearErrorDialogs
public boolean clearErrorDialogs ()
Lança |
---|
DeviceNotAvailableException | |
createUser
public int createUser (String name)
Lança |
---|
DeviceNotAvailableException | |
createUser
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 | |
disableKeyguard
public void disableKeyguard ()
Lança |
---|
DeviceNotAvailableException | |
doesFileExist
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 | |
getAndroidId
public String getAndroidId (int userId)
Lança |
---|
DeviceNotAvailableException | |
getAndroidIds
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 | |
getScreenshot
public InputStreamSource getScreenshot ()
Devoluções |
---|
InputStreamSource | |
Lança |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot (String format,
boolean rescale)
Parâmetros |
---|
format | String |
rescale | boolean |
Devoluções |
---|
InputStreamSource | |
Lança |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot (String format)
Devoluções |
---|
InputStreamSource | |
Lança |
---|
DeviceNotAvailableException | |
getScreenshot
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 | |
hasFeature
public boolean hasFeature (String feature)
Parâmetros |
---|
feature | String |
Lança |
---|
DeviceNotAvailableException | |
installPackage
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
Parâmetros |
---|
packageFile | File |
reinstall | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
installPackage
public String installPackage (File packageFile,
File certFile,
boolean reinstall,
String... extraArgs)
Parâmetros |
---|
packageFile | File |
certFile | File |
reinstall | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
installPackage
public String installPackage (File packageFile,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parâmetros |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
installPackageForUser
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 | |
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
Parâmetros |
---|
packageFile | File |
reinstall | boolean |
userId | int |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
Parâmetros |
---|
packageFiles | |
reinstall | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parâmetros |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
installPackagesForUser
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 | |
installPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
Parâmetros |
---|
packageFiles | |
reinstall | boolean |
userId | int |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parâmetros |
---|
remoteApkPaths | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Lança |
---|
DeviceNotAvailableException | |
installRemotePackages
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 | |
isMultiUserSupported
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 | |
listDisplayIds
public listDisplayIds ()
Lança |
---|
DeviceNotAvailableException | |
listUsers
public listUsers ()
Lança |
---|
DeviceNotAvailableException | |
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Parâmetros |
---|
exception | Throwable |
removeAdmin
public boolean removeAdmin (String componentName,
int userId)
Parâmetros |
---|
componentName | String |
userId | int |
Lança |
---|
DeviceNotAvailableException | |
removeOwners
public void removeOwners ()
Lança |
---|
DeviceNotAvailableException | |
removeUser
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 | |
setSetting
public void setSetting (String namespace,
String key,
String value)
Parâmetros |
---|
namespace | String |
key | String |
value | String |
Lança |
---|
DeviceNotAvailableException | |
setSetting
public void setSetting (int userId,
String namespace,
String key,
String value)
Parâmetros |
---|
userId | int |
namespace | String |
key | String |
value | String |
Lança |
---|
DeviceNotAvailableException | |
startUser
public boolean startUser (int userId)
Lança |
---|
DeviceNotAvailableException | |
startUser
public boolean startUser (int userId,
boolean waitFlag)
Parâmetros |
---|
userId | int |
waitFlag | boolean |
Lança |
---|
DeviceNotAvailableException | |
stopUser
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
Parâmetros |
---|
userId | int |
waitFlag | boolean |
forceFlag | boolean |
Lança |
---|
DeviceNotAvailableException | |
stopUser
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 | |
uninstallPackage
public String uninstallPackage (String packageName)
Parâmetros |
---|
packageName | String |
Lança |
---|
DeviceNotAvailableException | |
uninstallPackageForUser
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 deste reinicialização. |
reason | String : para este reinício. |
Lança |
---|
DeviceNotAvailableException | |
getCheckNewUserSleep
protected long getCheckNewUserSleep ()
Exposto para teste.
getHostCurrentTime
protected long getHostCurrentTime ()
Exposto para teste
prePostBootSetup
protected void prePostBootSetup ()
Permite que cada tipo de dispositivo (AndroidNativeDevice, TestDevice) substitua este método para configuração pós-inicialização específica.
Lança |
---|
DeviceNotAvailableException | |