Appareil de test

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é

Des champs

public static final String DISMISS_KEYGUARD_CMD

Commandes pouvant être utilisées pour ignorer le keyguard.

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

void doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason)

Effectuez un redémarrage adb.

long getCheckNewUserSleep ()

Exposé pour les tests.

long getHostCurrentTime ()

Exposé pour les tests

void prePostBootSetup ()

Permet à chaque type de périphérique (AndroidNativeDevice, TestDevice) de remplacer cette méthode pour une configuration post-démarrage spécifique.

Des champs

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

Commandes pouvant être utilisées pour ignorer le keyguard.

Constructeurs publics

Appareil de test

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

Méthodes publiques

clearErrorDialogs

public boolean clearErrorDialogs ()

Retour
boolean

Jetés
DeviceNotAvailableException

Créer un utilisateur

public int createUser (String name)

Paramètres
name String

Retour
int

Jetés
DeviceNotAvailableException

Créer un utilisateur

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

Paramètres
name String

guest boolean

ephemeral boolean

Retour
int

Jetés
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Paramètres
name String

Retour
int

Jetés
DeviceNotAvailableException

désactiverKeyguard

public void disableKeyguard ()

Jetés
DeviceNotAvailableException

Est-ce queFichierExiste

public boolean doesFileExist (String deviceFilePath)

Paramètres
deviceFilePath String

Retour
boolean

Jetés
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Paramètres
process String

devicePath String

Retour
File

Jetés
DeviceNotAvailableException

getActiveApex

public  getActiveApexes ()

Retour

Jetés
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Paramètres
namespace String

Retour

Jetés
DeviceNotAvailableException

obtenirAndroidId

public String getAndroidId (int userId)

Paramètres
userId int

Retour
String

Jetés
DeviceNotAvailableException

obtenir des identifiants Android

public  getAndroidIds ()

Retour

Jetés
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Paramètres
packageName String

Retour
PackageInfo

Jetés
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Retour

Jetés
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Retour
DeviceFoldableState

Jetés
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Retour
int

Jetés
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Retour

Jetés
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Retour

Jetés
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Retour
KeyguardControllerState

Jetés
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Retour

Jetés
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Retour
int

Jetés
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Retour
int

Jetés
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Retour
Integer

Jetés
DeviceNotAvailableException

obtenirCapture d'écran

public InputStreamSource getScreenshot ()

Retour
InputStreamSource

Jetés
DeviceNotAvailableException

obtenirCapture d'écran

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Paramètres
format String

rescale boolean

Retour
InputStreamSource

Jetés
DeviceNotAvailableException

obtenirCapture d'écran

public InputStreamSource getScreenshot (String format)

Paramètres
format String

Retour
InputStreamSource

Jetés
DeviceNotAvailableException

obtenirCapture d'écran

public InputStreamSource getScreenshot (long displayId)

Paramètres
displayId long

Retour
InputStreamSource

Jetés
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

Paramètres
namespace String

key String

Retour
String

Jetés
DeviceNotAvailableException

getSetting

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

Paramètres
userId int

namespace String

key String

Retour
String

Jetés
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Retour

Jetés
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Paramètres
userId int

Retour
int

Jetés
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Retour

Jetés
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Paramètres
userId int

Retour
int

Jetés
DeviceNotAvailableException

hasFeature

public boolean hasFeature (String feature)

Paramètres
feature String

Retour
boolean

Jetés
DeviceNotAvailableException

installer le paquet

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

Paramètres
packageFile File

reinstall boolean

extraArgs String

Retour
String

Jetés
DeviceNotAvailableException

installer le paquet

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

Paramètres
packageFile File

certFile File

reinstall boolean

extraArgs String

Retour
String

Jetés
DeviceNotAvailableException

installer le paquet

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

Paramètres
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Retour
String

Jetés
DeviceNotAvailableException

installerPackageForUser

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

Retour
String

Jetés
DeviceNotAvailableException

installerPackageForUser

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

Paramètres
packageFile File

reinstall boolean

userId int

extraArgs String

Retour
String

Jetés
DeviceNotAvailableException

installerPackages

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

Paramètres
packageFiles

reinstall boolean

extraArgs String

Retour
String

Jetés
DeviceNotAvailableException

installerPackages

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

Paramètres
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Retour
String

Jetés
DeviceNotAvailableException

installerPackagesForUser

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

Paramètres
packageFiles

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Retour
String

Jetés
DeviceNotAvailableException

installerPackagesForUser

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

Paramètres
packageFiles

reinstall boolean

userId int

extraArgs String

Retour
String

Jetés
DeviceNotAvailableException

installerRemotePackages

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

Paramètres
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Retour
String

Jetés
DeviceNotAvailableException

installerRemotePackages

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

Paramètres
remoteApkPaths

reinstall boolean

extraArgs String

Retour
String

Jetés
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Retour
boolean

Jetés
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

Retour
boolean

Jetés
DeviceNotAvailableException

estPackageInstalled

public boolean isPackageInstalled (String packageName)

Paramètres
packageName String

Retour
boolean

Jetés
DeviceNotAvailableException

estPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Paramètres
packageName String

userId String

Retour
boolean

Jetés
DeviceNotAvailableException

estUserRunning

public boolean isUserRunning (int userId)

Paramètres
userId int

Retour
boolean

Jetés
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Paramètres
userId int

Retour
boolean

Jetés
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

Retour

Jetés
DeviceNotAvailableException

listeUtilisateurs

public  listUsers ()

Retour

Jetés
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

Paramètres
exception Throwable

supprimerAdmin

public boolean removeAdmin (String componentName, 
                int userId)

Paramètres
componentName String

userId int

Retour
boolean

Jetés
DeviceNotAvailableException

Supprimer les propriétaires

public void removeOwners ()

Jetés
DeviceNotAvailableException

supprimer l'utilisateur

public boolean removeUser (int userId)

Paramètres
userId int

Retour
boolean

Jetés
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Paramètres
componentName String

userId int

Retour
boolean

Jetés
DeviceNotAvailableException

setSetting

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

Paramètres
namespace String

key String

value String

Jetés
DeviceNotAvailableException

setSetting

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

Paramètres
userId int

namespace String

key String

value String

Jetés
DeviceNotAvailableException

démarrerUtilisateur

public boolean startUser (int userId)

Paramètres
userId int

Retour
boolean

Jetés
DeviceNotAvailableException

démarrerUtilisateur

public boolean startUser (int userId, 
                boolean waitFlag)

Paramètres
userId int

waitFlag boolean

Retour
boolean

Jetés
DeviceNotAvailableException

arrêter l'utilisateur

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

Paramètres
userId int

waitFlag boolean

forceFlag boolean

Retour
boolean

Jetés
DeviceNotAvailableException

arrêter l'utilisateur

public boolean stopUser (int userId)

Paramètres
userId int

Retour
boolean

Jetés
DeviceNotAvailableException

changer d'utilisateur

public boolean switchUser (int userId)

Paramètres
userId int

Retour
boolean

Jetés
DeviceNotAvailableException

changer d'utilisateur

public boolean switchUser (int userId, 
                long timeout)

Paramètres
userId int

timeout long

Retour
boolean

Jetés
DeviceNotAvailableException

désinstallerPackage

public String uninstallPackage (String packageName)

Paramètres
packageName String

Retour
String

Jetés
DeviceNotAvailableException

désinstallerPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Paramètres
packageName String

userId int

Retour
String

Jetés
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 : un mode de ce redémarrage.

reason String : pour ce redémarrage.

Jetés
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Exposé pour les tests.

Retour
long

getHostCurrentTime

protected long getHostCurrentTime ()

Exposé pour les tests

Retour
long

préPostBootSetup

protected void prePostBootSetup ()

Permet à chaque type de périphérique (AndroidNativeDevice, TestDevice) de remplacer cette méthode pour une configuration post-démarrage spécifique.

Jetés
DeviceNotAvailableException