TestDevice

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 de pilha completa

Resumo

Campos

public static final String DISMISS_KEYGUARD_CMD

Comandos que podem ser usados para dispensar a tela de bloqueio.

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)

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)

Faça 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 uma configuração específica após a inicialização.

Campos

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

Comandos que podem ser usados para dispensar a tela de bloqueio.

Construtores públicos

TestDevice

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

Métodos públicos

clearErrorDialogs

public boolean clearErrorDialogs ()

Retorna
boolean

Gera
DeviceNotAvailableException

createUser

public int createUser (String name)

Parâmetros
name String

Retorna
int

Gera
DeviceNotAvailableException

createUser

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

Parâmetros
name String

guest boolean

ephemeral boolean

Retorna
int

Gera
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Parâmetros
name String

Retorna
int

Gera
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

Gera
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

Parâmetros
deviceFilePath String

Retorna
boolean

Gera
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Parâmetros
process String

devicePath String

Retorna
File

Gera
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Retorna

Gera
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Parâmetros
namespace String

Retorna

Gera
DeviceNotAvailableException

getAndroidId

public String getAndroidId (int userId)

Parâmetros
userId int

Retorna
String

Gera
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Retorna

Gera
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Parâmetros
packageName String

Retorna
PackageInfo

Gera
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Retorna

Gera
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Retorna
DeviceFoldableState

Gera
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Retorna
int

Gera
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Retorna

Gera
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Retorna

Gera
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Retorna
KeyguardControllerState

Gera
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Retorna

Gera
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Retorna
int

Gera
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Retorna
int

Gera
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Retorna
Integer

Gera
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

Retorna
InputStreamSource

Gera
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Parâmetros
format String

rescale boolean

Retorna
InputStreamSource

Gera
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format)

Parâmetros
format String

Retorna
InputStreamSource

Gera
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

Parâmetros
displayId long

Retorna
InputStreamSource

Gera
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

Parâmetros
namespace String

key String

Retorna
String

Gera
DeviceNotAvailableException

getSetting

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

Parâmetros
userId int

namespace String

key String

Retorna
String

Gera
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Retorna

Gera
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Parâmetros
userId int

Retorna
int

Gera
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Retorna

Gera
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Parâmetros
userId int

Retorna
int

Gera
DeviceNotAvailableException

hasFeature

public boolean hasFeature (String feature)

Parâmetros
feature String

Retorna
boolean

Gera
DeviceNotAvailableException

installPackage

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

Parâmetros
packageFile File

reinstall boolean

extraArgs String

Retorna
String

Gera
DeviceNotAvailableException

installPackage

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

Parâmetros
packageFile File

certFile File

reinstall boolean

extraArgs String

Retorna
String

Gera
DeviceNotAvailableException

installPackage

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

Parâmetros
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Retorna
String

Gera
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

Retorna
String

Gera
DeviceNotAvailableException

installPackageForUser

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

Parâmetros
packageFile File

reinstall boolean

userId int

extraArgs String

Retorna
String

Gera
DeviceNotAvailableException

installPackages

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

Parâmetros
packageFiles

reinstall boolean

extraArgs String

Retorna
String

Gera
DeviceNotAvailableException

installPackages

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

Parâmetros
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Retorna
String

Gera
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

Retorna
String

Gera
DeviceNotAvailableException

installPackagesForUser

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

Parâmetros
packageFiles

reinstall boolean

userId int

extraArgs String

Retorna
String

Gera
DeviceNotAvailableException

installRemotePackages

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

Parâmetros
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Retorna
String

Gera
DeviceNotAvailableException

installRemotePackages

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

Parâmetros
remoteApkPaths

reinstall boolean

extraArgs String

Retorna
String

Gera
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Retorna
boolean

Gera
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

Retorna
boolean

Gera
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Parâmetros
packageName String

Retorna
boolean

Gera
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Parâmetros
packageName String

userId String

Retorna
boolean

Gera
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

Parâmetros
userId int

Retorna
boolean

Gera
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Parâmetros
userId int

Retorna
boolean

Gera
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

Retorna

Gera
DeviceNotAvailableException

listUsers

public  listUsers ()

Retorna

Gera
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

Retorna
boolean

Gera
DeviceNotAvailableException

removeOwners

public void removeOwners ()

Gera
DeviceNotAvailableException

removeUser

public boolean removeUser (int userId)

Parâmetros
userId int

Retorna
boolean

Gera
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Parâmetros
componentName String

userId int

Retorna
boolean

Gera
DeviceNotAvailableException

setSetting

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

Parâmetros
namespace String

key String

value String

Gera
DeviceNotAvailableException

setSetting

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

Parâmetros
userId int

namespace String

key String

value String

Gera
DeviceNotAvailableException

startUser

public boolean startUser (int userId)

Parâmetros
userId int

Retorna
boolean

Gera
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

Parâmetros
userId int

waitFlag boolean

Retorna
boolean

Gera
DeviceNotAvailableException

stopUser

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

Parâmetros
userId int

waitFlag boolean

forceFlag boolean

Retorna
boolean

Gera
DeviceNotAvailableException

stopUser

public boolean stopUser (int userId)

Parâmetros
userId int

Retorna
boolean

Gera
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId)

Parâmetros
userId int

Retorna
boolean

Gera
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId, 
                long timeout)

Parâmetros
userId int

timeout long

Retorna
boolean

Gera
DeviceNotAvailableException

uninstallPackage

public String uninstallPackage (String packageName)

Parâmetros
packageName String

Retorna
String

Gera
DeviceNotAvailableException

uninstallPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Parâmetros
packageName String

userId int

Retorna
String

Gera
DeviceNotAvailableException

Métodos protegidos

doAdbReboot

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

Faça uma reinicialização do adb.

Parâmetros
rebootMode NativeDevice.RebootMode: um modo dessa reinicialização.

reason String: para esta reinicialização.

Gera
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Exposto para testes.

Retorna
long

getHostCurrentTime

protected long getHostCurrentTime ()

Exposto para testes

Retorna
long

prePostBootSetup

protected void prePostBootSetup ()

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

Gera
DeviceNotAvailableException