Dispositivo de prueba

public class TestDevice
extends NativeDevice

java.lang.Objeto
com.android.tradefed.device.NativeDevice
com.android.tradefed.device.TestDevice


Implementación de un ITestDevice para un dispositivo Android de pila completa

Resumen

Campos

public static final String DISMISS_KEYGUARD_CMD

Comandos que se pueden utilizar para descartar el bloqueo de teclas.

Constructores públicos

TestDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

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)

Métodos protegidos

void doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason)

Realice un reinicio de adb.

long getCheckNewUserSleep ()

Expuesto para pruebas.

long getHostCurrentTime ()

Expuesto para pruebas

void prePostBootSetup ()

Permite que cada tipo de dispositivo (AndroidNativeDevice, TestDevice) anule este método para una configuración posterior al arranque específica.

Campos

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

Comandos que se pueden utilizar para descartar el bloqueo de teclas.

Constructores públicos

Dispositivo de prueba

public TestDevice (IDevice device, 
                IDeviceStateMonitor stateMonitor, 
                IDeviceMonitor allocationMonitor)

Métodos públicos

clearErrorDiálogos

public boolean clearErrorDialogs ()

Devoluciones
boolean

Lanza
DeviceNotAvailableException

crear usuario

public int createUser (String name)

Parámetros
name String

Devoluciones
int

Lanza
DeviceNotAvailableException

crear usuario

public int createUser (String name, 
                boolean guest, 
                boolean ephemeral)

Parámetros
name String

guest boolean

ephemeral boolean

Devoluciones
int

Lanza
DeviceNotAvailableException

crearUsuarioNoThrow

public int createUserNoThrow (String name)

Parámetros
name String

Devoluciones
int

Lanza
DeviceNotAvailableException

desactivar Keyguard

public void disableKeyguard ()

Lanza
DeviceNotAvailableException

¿Existe el archivo?

public boolean doesFileExist (String deviceFilePath)

Parámetros
deviceFilePath String

Devoluciones
boolean

Lanza
DeviceNotAvailableException

montón de volcado

public File dumpHeap (String process, 
                String devicePath)

Parámetros
process String

devicePath String

Devoluciones
File

Lanza
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Devoluciones

Lanza
DeviceNotAvailableException

obtener todas las configuraciones

public  getAllSettings (String namespace)

Parámetros
namespace String

Devoluciones

Lanza
DeviceNotAvailableException

obtenerID de Android

public String getAndroidId (int userId)

Parámetros
userId int

Devoluciones
String

Lanza
DeviceNotAvailableException

obtenerIds de Android

public  getAndroidIds ()

Devoluciones

Lanza
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Parámetros
packageName String

Devoluciones
PackageInfo

Lanza
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Devoluciones

Lanza
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Devoluciones
DeviceFoldableState

Lanza
DeviceNotAvailableException

obtener usuario actual

public int getCurrentUser ()

Devoluciones
int

Lanza
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Devoluciones

Lanza
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Devoluciones

Lanza
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Devoluciones
KeyguardControllerState

Lanza
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Devoluciones

Lanza
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Devoluciones
int

Lanza
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Devoluciones
int

Lanza
DeviceNotAvailableException

obtener ID de usuario principal

public Integer getPrimaryUserId ()

Devoluciones
Integer

Lanza
DeviceNotAvailableException

obtener captura de pantalla

public InputStreamSource getScreenshot ()

Devoluciones
InputStreamSource

Lanza
DeviceNotAvailableException

obtener captura de pantalla

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Parámetros
format String

rescale boolean

Devoluciones
InputStreamSource

Lanza
DeviceNotAvailableException

obtener captura de pantalla

public InputStreamSource getScreenshot (String format)

Parámetros
format String

Devoluciones
InputStreamSource

Lanza
DeviceNotAvailableException

obtener captura de pantalla

public InputStreamSource getScreenshot (long displayId)

Parámetros
displayId long

Devoluciones
InputStreamSource

Lanza
DeviceNotAvailableException

obtener configuración

public String getSetting (String namespace, 
                String key)

Parámetros
namespace String

key String

Devoluciones
String

Lanza
DeviceNotAvailableException

obtener configuración

public String getSetting (int userId, 
                String namespace, 
                String key)

Parámetros
userId int

namespace String

key String

Devoluciones
String

Lanza
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Devoluciones

Lanza
DeviceNotAvailableException

obtener banderas de usuario

public int getUserFlags (int userId)

Parámetros
userId int

Devoluciones
int

Lanza
DeviceNotAvailableException

obtener información de usuario

public  getUserInfos ()

Devoluciones

Lanza
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Parámetros
userId int

Devoluciones
int

Lanza
DeviceNotAvailableException

tiene característica

public boolean hasFeature (String feature)

Parámetros
feature String

Devoluciones
boolean

Lanza
DeviceNotAvailableException

paquete de instalación

public String installPackage (File packageFile, 
                boolean reinstall, 
                String... extraArgs)

Parámetros
packageFile File

reinstall boolean

extraArgs String

Devoluciones
String

Lanza
DeviceNotAvailableException

paquete de instalación

public String installPackage (File packageFile, 
                File certFile, 
                boolean reinstall, 
                String... extraArgs)

Parámetros
packageFile File

certFile File

reinstall boolean

extraArgs String

Devoluciones
String

Lanza
DeviceNotAvailableException

paquete de instalación

public String installPackage (File packageFile, 
                boolean reinstall, 
                boolean grantPermissions, 
                String... extraArgs)

Parámetros
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Devoluciones
String

Lanza
DeviceNotAvailableException

instalarPaqueteParaUsuario

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

Devoluciones
String

Lanza
DeviceNotAvailableException

instalarPaqueteParaUsuario

public String installPackageForUser (File packageFile, 
                boolean reinstall, 
                int userId, 
                String... extraArgs)

Parámetros
packageFile File

reinstall boolean

userId int

extraArgs String

Devoluciones
String

Lanza
DeviceNotAvailableException

instalarPaquetes

public String installPackages ( packageFiles, 
                boolean reinstall, 
                String... extraArgs)

Parámetros
packageFiles

reinstall boolean

extraArgs String

Devoluciones
String

Lanza
DeviceNotAvailableException

instalarPaquetes

public String installPackages ( packageFiles, 
                boolean reinstall, 
                boolean grantPermissions, 
                String... extraArgs)

Parámetros
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Devoluciones
String

Lanza
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

Devoluciones
String

Lanza
DeviceNotAvailableException

instalarPackagesForUser

public String installPackagesForUser ( packageFiles, 
                boolean reinstall, 
                int userId, 
                String... extraArgs)

Parámetros
packageFiles

reinstall boolean

userId int

extraArgs String

Devoluciones
String

Lanza
DeviceNotAvailableException

instalarRemotePackages

public String installRemotePackages ( remoteApkPaths, 
                boolean reinstall, 
                boolean grantPermissions, 
                String... extraArgs)

Parámetros
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Devoluciones
String

Lanza
DeviceNotAvailableException

instalarRemotePackages

public String installRemotePackages ( remoteApkPaths, 
                boolean reinstall, 
                String... extraArgs)

Parámetros
remoteApkPaths

reinstall boolean

extraArgs String

Devoluciones
String

Lanza
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Devoluciones
boolean

Lanza
DeviceNotAvailableException

es compatible con múltiples usuarios

public boolean isMultiUserSupported ()

Devoluciones
boolean

Lanza
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Parámetros
packageName String

Devoluciones
boolean

Lanza
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Parámetros
packageName String

userId String

Devoluciones
boolean

Lanza
DeviceNotAvailableException

esUsuarioRunning

public boolean isUserRunning (int userId)

Parámetros
userId int

Devoluciones
boolean

Lanza
DeviceNotAvailableException

esUsuarioSecundario

public boolean isUserSecondary (int userId)

Parámetros
userId int

Devoluciones
boolean

Lanza
DeviceNotAvailableException

listaDisplayIds

public  listDisplayIds ()

Devoluciones

Lanza
DeviceNotAvailableException

listaUsuarios

public  listUsers ()

Devoluciones

Lanza
DeviceNotAvailableException

postInvocaciónTearDown

public void postInvocationTearDown (Throwable exception)

Parámetros
exception Throwable

eliminarAdmin

public boolean removeAdmin (String componentName, 
                int userId)

Parámetros
componentName String

userId int

Devoluciones
boolean

Lanza
DeviceNotAvailableException

eliminarPropietarios

public void removeOwners ()

Lanza
DeviceNotAvailableException

eliminarUsuario

public boolean removeUser (int userId)

Parámetros
userId int

Devoluciones
boolean

Lanza
DeviceNotAvailableException

establecerPropietario del dispositivo

public boolean setDeviceOwner (String componentName, 
                int userId)

Parámetros
componentName String

userId int

Devoluciones
boolean

Lanza
DeviceNotAvailableException

establecerConfiguración

public void setSetting (String namespace, 
                String key, 
                String value)

Parámetros
namespace String

key String

value String

Lanza
DeviceNotAvailableException

establecerConfiguración

public void setSetting (int userId, 
                String namespace, 
                String key, 
                String value)

Parámetros
userId int

namespace String

key String

value String

Lanza
DeviceNotAvailableException

inicioUsuario

public boolean startUser (int userId)

Parámetros
userId int

Devoluciones
boolean

Lanza
DeviceNotAvailableException

inicioUsuario

public boolean startUser (int userId, 
                boolean waitFlag)

Parámetros
userId int

waitFlag boolean

Devoluciones
boolean

Lanza
DeviceNotAvailableException

detener usuario

public boolean stopUser (int userId, 
                boolean waitFlag, 
                boolean forceFlag)

Parámetros
userId int

waitFlag boolean

forceFlag boolean

Devoluciones
boolean

Lanza
DeviceNotAvailableException

detener usuario

public boolean stopUser (int userId)

Parámetros
userId int

Devoluciones
boolean

Lanza
DeviceNotAvailableException

cambiar de usuario

public boolean switchUser (int userId)

Parámetros
userId int

Devoluciones
boolean

Lanza
DeviceNotAvailableException

cambiar de usuario

public boolean switchUser (int userId, 
                long timeout)

Parámetros
userId int

timeout long

Devoluciones
boolean

Lanza
DeviceNotAvailableException

desinstalar paquete

public String uninstallPackage (String packageName)

Parámetros
packageName String

Devoluciones
String

Lanza
DeviceNotAvailableException

desinstalarPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Parámetros
packageName String

userId int

Devoluciones
String

Lanza
DeviceNotAvailableException

Métodos protegidos

doAdbReiniciar

protected void doAdbReboot (NativeDevice.RebootMode rebootMode, 
                String reason)

Realice un reinicio de adb.

Parámetros
rebootMode NativeDevice.RebootMode : un modo de este reinicio.

reason String : para este reinicio.

Lanza
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Expuesto para pruebas.

Devoluciones
long

getHostCurrentTime

protected long getHostCurrentTime ()

Expuesto para pruebas

Devoluciones
long

configuración previa al inicio del arranque

protected void prePostBootSetup ()

Permite que cada tipo de dispositivo (AndroidNativeDevice, TestDevice) anule este método para una configuración posterior al arranque específica.

Lanza
DeviceNotAvailableException