Dispositivo de teste

public class TestDevice
extends NativeDevice

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


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.

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

Execute uma reinicialização do adb.

long getCheckNewUserSleep ()

Exposto para testes.

long getHostCurrentTime ()

Exposto para testes

void prePostBootSetup ()

Permite que cada tipo de dispositivo (AndroidNativeDevice, TestDevice) substitua esse método para configuração específica pós-inicialização.

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

Devoluções
boolean

Lança
DeviceNotAvailableException

criarUsuário

public int createUser (String name)

Parâmetros
name String

Devoluções
int

Lança
DeviceNotAvailableException

criarUsuário

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

Parâmetros
name String

guest boolean

ephemeral boolean

Devoluções
int

Lança
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Parâmetros
name String

Devoluções
int

Lança
DeviceNotAvailableException

desabilitarKeyguard

public void disableKeyguard ()

Lança
DeviceNotAvailableException

fazFileExist

public boolean doesFileExist (String deviceFilePath)

Parâmetros
deviceFilePath String

Devoluções
boolean

Lança
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Parâmetros
process String

devicePath String

Devoluções
File

Lança
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Devoluções

Lança
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Parâmetros
namespace String

Devoluções

Lança
DeviceNotAvailableException

obterAndroidId

public String getAndroidId (int userId)

Parâmetros
userId int

Devoluções
String

Lança
DeviceNotAvailableException

obterAndroidIds

public  getAndroidIds ()

Devoluções

Lança
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Parâmetros
packageName String

Devoluções
PackageInfo

Lança
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Devoluções

Lança
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Devoluções
DeviceFoldableState

Lança
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Devoluções
int

Lança
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Devoluções

Lança
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Devoluções

Lança
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Devoluções
KeyguardControllerState

Lança
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Devoluções

Lança
DeviceNotAvailableException

getMaxNumberOfRunningUsers suportados

public int getMaxNumberOfRunningUsersSupported ()

Devoluções
int

Lança
DeviceNotAvailableException

getMaxNumberOfUsers suportados

public int getMaxNumberOfUsersSupported ()

Devoluções
int

Lança
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Devoluções
Integer

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)

Parâmetros
format String

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

Devoluções
String

Lança
DeviceNotAvailableException

getSetting

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

Parâmetros
userId int

namespace String

key String

Devoluções
String

Lança
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Devoluções

Lança
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Parâmetros
userId int

Devoluções
int

Lança
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Devoluções

Lança
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Parâmetros
userId int

Devoluções
int

Lança
DeviceNotAvailableException

temRecurso

public boolean hasFeature (String feature)

Parâmetros
feature String

Devoluções
boolean

Lança
DeviceNotAvailableException

instalarPacote

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

Parâmetros
packageFile File

reinstall boolean

extraArgs String

Devoluções
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

Devoluções
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

Devoluções
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

Devoluções
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

Devoluções
String

Lança
DeviceNotAvailableException

instalar pacotes

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

Parâmetros
packageFiles

reinstall boolean

extraArgs String

Devoluções
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

Devoluções
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

Devoluções
String

Lança
DeviceNotAvailableException

instalarPackagesForUser

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

Parâmetros
packageFiles

reinstall boolean

userId int

extraArgs String

Devoluções
String

Lança
DeviceNotAvailableException

instalarRemotePackages

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

Parâmetros
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Devoluções
String

Lança
DeviceNotAvailableException

instalarRemotePackages

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

Parâmetros
remoteApkPaths

reinstall boolean

extraArgs String

Devoluções
String

Lança
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Devoluções
boolean

Lança
DeviceNotAvailableException

isMultiUserSupportado

public boolean isMultiUserSupported ()

Devoluções
boolean

Lança
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Parâmetros
packageName String

Devoluções
boolean

Lança
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Parâmetros
packageName String

userId String

Devoluções
boolean

Lança
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

Parâmetros
userId int

Devoluções
boolean

Lança
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Parâmetros
userId int

Devoluções
boolean

Lança
DeviceNotAvailableException

listaDisplayIds

public  listDisplayIds ()

Devoluções

Lança
DeviceNotAvailableException

listaUsuários

public  listUsers ()

Devoluções

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

Devoluções
boolean

Lança
DeviceNotAvailableException

removerProprietários

public void removeOwners ()

Lança
DeviceNotAvailableException

removerUsuário

public boolean removeUser (int userId)

Parâmetros
userId int

Devoluções
boolean

Lança
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Parâmetros
componentName String

userId int

Devoluções
boolean

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)

Parâmetros
userId int

Devoluções
boolean

Lança
DeviceNotAvailableException

usuário inicial

public boolean startUser (int userId, 
                boolean waitFlag)

Parâmetros
userId int

waitFlag boolean

Devoluções
boolean

Lança
DeviceNotAvailableException

pararUsuário

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

Parâmetros
userId int

waitFlag boolean

forceFlag boolean

Devoluções
boolean

Lança
DeviceNotAvailableException

pararUsuário

public boolean stopUser (int userId)

Parâmetros
userId int

Devoluções
boolean

Lança
DeviceNotAvailableException

mudar de utilizador

public boolean switchUser (int userId)

Parâmetros
userId int

Devoluções
boolean

Lança
DeviceNotAvailableException

mudar de utilizador

public boolean switchUser (int userId, 
                long timeout)

Parâmetros
userId int

timeout long

Devoluções
boolean

Lança
DeviceNotAvailableException

desinstalarPackage

public String uninstallPackage (String packageName)

Parâmetros
packageName String

Devoluções
String

Lança
DeviceNotAvailableException

desinstalarPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Parâmetros
packageName String

userId int

Devoluções
String

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.

Devoluções
long

getHostCurrentTime

protected long getHostCurrentTime ()

Exposto para testes

Devoluções
long

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