TestDevice

public class TestDevice
extends NativeDevice

java.lang.Object
   ↳ 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

Son comandos que se pueden usar 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)

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

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

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

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

String 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)

Realiza un reinicio de adb.

long getCheckNewUserSleep()

Se expone para pruebas.

long getHostCurrentTime()

Se expone para pruebas

void prePostBootSetup()

Permite que cada tipo de dispositivo (AndroidNativeDevice, TestDevice) anule este método para una configuración específica después del inicio.

Campos

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

Son comandos que se pueden usar para descartar el bloqueo de teclas.

Constructores públicos

TestDevice

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

Métodos públicos

clearErrorDialogs

public boolean clearErrorDialogs ()

Muestra
boolean

Arroja
DeviceNotAvailableException

createUser

public int createUser (String name)

Parámetros
name String

Muestra
int

Arroja
DeviceNotAvailableException

createUser

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

Parámetros
name String

guest boolean

ephemeral boolean

Muestra
int

Arroja
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Parámetros
name String

Muestra
int

Arroja
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

Arroja
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

Parámetros
deviceFilePath String

Muestra
boolean

Arroja
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Parámetros
process String

devicePath String

Muestra
File

Arroja
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Muestra

Arroja
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Parámetros
namespace String

Muestra

Arroja
DeviceNotAvailableException

getAndroidId

public String getAndroidId (int userId)

Parámetros
userId int

Muestra
String

Arroja
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Muestra

Arroja
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Parámetros
packageName String

Muestra
PackageInfo

Arroja
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Muestra

Arroja
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Muestra
DeviceFoldableState

Arroja
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Muestra
int

Arroja
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Muestra

Arroja
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Muestra

Arroja
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Muestra
KeyguardControllerState

Arroja
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Muestra

Arroja
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Muestra
int

Arroja
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Muestra
int

Arroja
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Muestra
Integer

Arroja
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

Muestra
InputStreamSource

Arroja
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Parámetros
format String

rescale boolean

Muestra
InputStreamSource

Arroja
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format)

Parámetros
format String

Muestra
InputStreamSource

Arroja
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

Parámetros
displayId long

Muestra
InputStreamSource

Arroja
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

Parámetros
namespace String

key String

Muestra
String

Arroja
DeviceNotAvailableException

getSetting

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

Parámetros
userId int

namespace String

key String

Muestra
String

Arroja
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Muestra

Arroja
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Parámetros
userId int

Muestra
int

Arroja
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Muestra

Arroja
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Parámetros
userId int

Muestra
int

Arroja
DeviceNotAvailableException

hasFeature

public boolean hasFeature (String feature)

Parámetros
feature String

Muestra
boolean

Arroja
DeviceNotAvailableException

installPackage

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

Parámetros
packageFile File

reinstall boolean

extraArgs String

Muestra
String

Arroja
DeviceNotAvailableException

installPackage

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

Parámetros
packageFile File

certFile File

reinstall boolean

extraArgs String

Muestra
String

Arroja
DeviceNotAvailableException

installPackage

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

Parámetros
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Muestra
String

Arroja
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

Muestra
String

Arroja
DeviceNotAvailableException

installPackageForUser

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

Parámetros
packageFile File

reinstall boolean

userId int

extraArgs String

Muestra
String

Arroja
DeviceNotAvailableException

installPackages

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

Parámetros
packageFiles

reinstall boolean

extraArgs String

Muestra
String

Arroja
DeviceNotAvailableException

installPackages

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

Parámetros
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Muestra
String

Arroja
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

Muestra
String

Arroja
DeviceNotAvailableException

installPackagesForUser

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

Parámetros
packageFiles

reinstall boolean

userId int

extraArgs String

Muestra
String

Arroja
DeviceNotAvailableException

installRemotePackages

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

Parámetros
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Muestra
String

Arroja
DeviceNotAvailableException

installRemotePackages

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

Parámetros
remoteApkPaths

reinstall boolean

extraArgs String

Muestra
String

Arroja
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Muestra
boolean

Arroja
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

Muestra
boolean

Arroja
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Parámetros
packageName String

Muestra
boolean

Arroja
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Parámetros
packageName String

userId String

Muestra
boolean

Arroja
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

Parámetros
userId int

Muestra
boolean

Arroja
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Parámetros
userId int

Muestra
boolean

Arroja
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

Muestra

Arroja
DeviceNotAvailableException

listUsers

public  listUsers ()

Muestra

Arroja
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

Muestra
boolean

Arroja
DeviceNotAvailableException

removeOwners

public void removeOwners ()

Arroja
DeviceNotAvailableException

removeUser

public boolean removeUser (int userId)

Parámetros
userId int

Muestra
boolean

Arroja
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Parámetros
componentName String

userId int

Muestra
boolean

Arroja
DeviceNotAvailableException

setSetting

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

Parámetros
namespace String

key String

value String

Arroja
DeviceNotAvailableException

setSetting

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

Parámetros
userId int

namespace String

key String

value String

Arroja
DeviceNotAvailableException

startUser

public boolean startUser (int userId)

Parámetros
userId int

Muestra
boolean

Arroja
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

Parámetros
userId int

waitFlag boolean

Muestra
boolean

Arroja
DeviceNotAvailableException

stopUser

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

Parámetros
userId int

waitFlag boolean

forceFlag boolean

Muestra
boolean

Arroja
DeviceNotAvailableException

stopUser

public boolean stopUser (int userId)

Parámetros
userId int

Muestra
boolean

Arroja
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId)

Parámetros
userId int

Muestra
boolean

Arroja
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId, 
                long timeout)

Parámetros
userId int

timeout long

Muestra
boolean

Arroja
DeviceNotAvailableException

uninstallPackage

public String uninstallPackage (String packageName)

Parámetros
packageName String

Muestra
String

Arroja
DeviceNotAvailableException

uninstallPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Parámetros
packageName String

userId int

Muestra
String

Arroja
DeviceNotAvailableException

Métodos protegidos

doAdbReboot

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

Realiza un reinicio de adb.

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

reason String: Para este reinicio.

Arroja
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Se expone para pruebas.

Muestra
long

getHostCurrentTime

protected long getHostCurrentTime ()

Se expone para pruebas

Muestra
long

prePostBootSetup

protected void prePostBootSetup ()

Permite que cada tipo de dispositivo (AndroidNativeDevice, TestDevice) anule este método para una configuración específica después del inicio.

Arroja
DeviceNotAvailableException