TestDevice

public class TestDevice
extends NativeDevice

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


Implémentation d'un ITestDevice pour un appareil Android full stack

Résumé

Champs

public static final String DISMISS_KEYGUARD_CMD

Commandes permettant de fermer le clavier de verrouillage.

Constructeurs publics

TestDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Méthodes publiques

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éthodes protégées

void doAdbReboot(NativeDevice.RebootMode rebootMode, String reason)

Effectuez un redémarrage ADB.

long getCheckNewUserSleep()

Exposé à des fins de test.

long getHostCurrentTime()

Exposé à des fins de test

void prePostBootSetup()

Permet à chaque type d'appareil (AndroidNativeDevice, TestDevice) de remplacer cette méthode pour une configuration spécifique après le démarrage.

Champs

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

Commandes permettant de fermer le clavier de verrouillage.

Constructeurs publics

TestDevice

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

Méthodes publiques

clearErrorDialogs

public boolean clearErrorDialogs ()

Renvoie
boolean

Génère
DeviceNotAvailableException

createUser

public int createUser (String name)

Paramètres
name String

Renvoie
int

Génère
DeviceNotAvailableException

createUser

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

Paramètres
name String

guest boolean

ephemeral boolean

Renvoie
int

Génère
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Paramètres
name String

Renvoie
int

Génère
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

Génère
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

Paramètres
deviceFilePath String

Renvoie
boolean

Génère
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Paramètres
process String

devicePath String

Renvoie
File

Génère
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Renvoie

Génère
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Paramètres
namespace String

Renvoie

Génère
DeviceNotAvailableException

getAndroidId

public String getAndroidId (int userId)

Paramètres
userId int

Renvoie
String

Génère
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Renvoie

Génère
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Paramètres
packageName String

Renvoie
PackageInfo

Génère
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Renvoie

Génère
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Renvoie
DeviceFoldableState

Génère
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Renvoie
int

Génère
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Renvoie

Génère
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Renvoie

Génère
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Renvoie
KeyguardControllerState

Génère
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Renvoie

Génère
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Renvoie
int

Génère
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Renvoie
int

Génère
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Renvoie
Integer

Génère
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

Renvoie
InputStreamSource

Génère
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Paramètres
format String

rescale boolean

Renvoie
InputStreamSource

Génère
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format)

Paramètres
format String

Renvoie
InputStreamSource

Génère
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

Paramètres
displayId long

Renvoie
InputStreamSource

Génère
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

Paramètres
namespace String

key String

Renvoie
String

Génère
DeviceNotAvailableException

getSetting

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

Paramètres
userId int

namespace String

key String

Renvoie
String

Génère
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Renvoie

Génère
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Paramètres
userId int

Renvoie
int

Génère
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Renvoie

Génère
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Paramètres
userId int

Renvoie
int

Génère
DeviceNotAvailableException

hasFeature

public boolean hasFeature (String feature)

Paramètres
feature String

Renvoie
boolean

Génère
DeviceNotAvailableException

installPackage

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

Paramètres
packageFile File

reinstall boolean

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

installPackage

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

Paramètres
packageFile File

certFile File

reinstall boolean

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

installPackage

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

Paramètres
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

installPackageForUser

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

Paramètres
packageFile File

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

installPackageForUser

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

Paramètres
packageFile File

reinstall boolean

userId int

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

installPackages

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

Paramètres
packageFiles

reinstall boolean

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

installPackages

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

Paramètres
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

installPackagesForUser

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

Paramètres
packageFiles

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

installPackagesForUser

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

Paramètres
packageFiles

reinstall boolean

userId int

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

installRemotePackages

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

Paramètres
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

installRemotePackages

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

Paramètres
remoteApkPaths

reinstall boolean

extraArgs String

Renvoie
String

Génère
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Renvoie
boolean

Génère
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

Renvoie
boolean

Génère
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Paramètres
packageName String

Renvoie
boolean

Génère
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Paramètres
packageName String

userId String

Renvoie
boolean

Génère
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

Paramètres
userId int

Renvoie
boolean

Génère
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Paramètres
userId int

Renvoie
boolean

Génère
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

Renvoie

Génère
DeviceNotAvailableException

listUsers

public  listUsers ()

Renvoie

Génère
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

Paramètres
exception Throwable

removeAdmin

public boolean removeAdmin (String componentName, 
                int userId)

Paramètres
componentName String

userId int

Renvoie
boolean

Génère
DeviceNotAvailableException

removeOwners

public void removeOwners ()

Génère
DeviceNotAvailableException

removeUser

public boolean removeUser (int userId)

Paramètres
userId int

Renvoie
boolean

Génère
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Paramètres
componentName String

userId int

Renvoie
boolean

Génère
DeviceNotAvailableException

setSetting

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

Paramètres
namespace String

key String

value String

Génère
DeviceNotAvailableException

setSetting

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

Paramètres
userId int

namespace String

key String

value String

Génère
DeviceNotAvailableException

startUser

public boolean startUser (int userId)

Paramètres
userId int

Renvoie
boolean

Génère
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

Paramètres
userId int

waitFlag boolean

Renvoie
boolean

Génère
DeviceNotAvailableException

stopUser

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

Paramètres
userId int

waitFlag boolean

forceFlag boolean

Renvoie
boolean

Génère
DeviceNotAvailableException

stopUser

public boolean stopUser (int userId)

Paramètres
userId int

Renvoie
boolean

Génère
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId)

Paramètres
userId int

Renvoie
boolean

Génère
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId, 
                long timeout)

Paramètres
userId int

timeout long

Renvoie
boolean

Génère
DeviceNotAvailableException

uninstallPackage

public String uninstallPackage (String packageName)

Paramètres
packageName String

Renvoie
String

Génère
DeviceNotAvailableException

uninstallPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Paramètres
packageName String

userId int

Renvoie
String

Génère
DeviceNotAvailableException

Méthodes protégées

doAdbReboot

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

Effectuez un redémarrage ADB.

Paramètres
rebootMode NativeDevice.RebootMode: mode de ce redémarrage.

reason String: pour ce redémarrage.

Génère
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Exposé à des fins de test.

Renvoie
long

getHostCurrentTime

protected long getHostCurrentTime ()

Exposé à des fins de test

Renvoie
long

prePostBootSetup

protected void prePostBootSetup ()

Permet à chaque type d'appareil (AndroidNativeDevice, TestDevice) de remplacer cette méthode pour une configuration spécifique après le démarrage.

Génère
DeviceNotAvailableException