Appareil de test
public class TestDevice
extends NativeDevice
Sous-classes directes connues |
Sous-classes indirectes connues |
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. |
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) |
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 ()
Jetés |
---|
DeviceNotAvailableException | |
Créer un utilisateur
public int createUser (String name)
Jetés |
---|
DeviceNotAvailableException | |
Créer un utilisateur
public int createUser (String name,
boolean guest,
boolean ephemeral)
Paramètres |
---|
name | String |
guest | boolean |
ephemeral | boolean |
Jetés |
---|
DeviceNotAvailableException | |
createUserNoThrow
public int createUserNoThrow (String name)
Jetés |
---|
DeviceNotAvailableException | |
désactiverKeyguard
public void disableKeyguard ()
Jetés |
---|
DeviceNotAvailableException | |
Est-ce queFichierExiste
public boolean doesFileExist (String deviceFilePath)
Paramètres |
---|
deviceFilePath | String |
Jetés |
---|
DeviceNotAvailableException | |
dumpHeap
public File dumpHeap (String process,
String devicePath)
Paramètres |
---|
process | String |
devicePath | String |
Jetés |
---|
DeviceNotAvailableException | |
getActiveApex
public getActiveApexes ()
Jetés |
---|
DeviceNotAvailableException | |
getAllSettings
public getAllSettings (String namespace)
Paramètres |
---|
namespace | String |
Jetés |
---|
DeviceNotAvailableException | |
obtenirAndroidId
public String getAndroidId (int userId)
Jetés |
---|
DeviceNotAvailableException | |
obtenir des identifiants Android
public getAndroidIds ()
Jetés |
---|
DeviceNotAvailableException | |
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
Paramètres |
---|
packageName | String |
Jetés |
---|
DeviceNotAvailableException | |
getAppPackageInfos
public getAppPackageInfos ()
Jetés |
---|
DeviceNotAvailableException | |
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
Retour |
---|
DeviceFoldableState | |
Jetés |
---|
DeviceNotAvailableException | |
getCurrentUser
public int getCurrentUser ()
Jetés |
---|
DeviceNotAvailableException | |
getFoldableStates
public getFoldableStates ()
Jetés |
---|
DeviceNotAvailableException | |
getInstalledPackageNames
public getInstalledPackageNames ()
Jetés |
---|
DeviceNotAvailableException | |
getKeyguardState
public KeyguardControllerState getKeyguardState ()
Retour |
---|
KeyguardControllerState | |
Jetés |
---|
DeviceNotAvailableException | |
getMainlineModuleInfo
public getMainlineModuleInfo ()
Jetés |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfRunningUsersSupported ()
Jetés |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfUsersSupported ()
Jetés |
---|
DeviceNotAvailableException | |
getPrimaryUserId
public Integer getPrimaryUserId ()
Jetés |
---|
DeviceNotAvailableException | |
obtenirCapture d'écran
public InputStreamSource getScreenshot ()
Jetés |
---|
DeviceNotAvailableException | |
obtenirCapture d'écran
public InputStreamSource getScreenshot (String format,
boolean rescale)
Paramètres |
---|
format | String |
rescale | boolean |
Jetés |
---|
DeviceNotAvailableException | |
obtenirCapture d'écran
public InputStreamSource getScreenshot (String format)
Jetés |
---|
DeviceNotAvailableException | |
obtenirCapture d'écran
public InputStreamSource getScreenshot (long displayId)
Paramètres |
---|
displayId | long |
Jetés |
---|
DeviceNotAvailableException | |
getSetting
public String getSetting (String namespace,
String key)
Paramètres |
---|
namespace | String |
key | String |
Jetés |
---|
DeviceNotAvailableException | |
getSetting
public String getSetting (int userId,
String namespace,
String key)
Paramètres |
---|
userId | int |
namespace | String |
key | String |
Jetés |
---|
DeviceNotAvailableException | |
getUninstallablePackageNames
public getUninstallablePackageNames ()
Jetés |
---|
DeviceNotAvailableException | |
getUserFlags
public int getUserFlags (int userId)
Jetés |
---|
DeviceNotAvailableException | |
getUserInfos
public getUserInfos ()
Jetés |
---|
DeviceNotAvailableException | |
getUserSerialNumber
public int getUserSerialNumber (int userId)
Jetés |
---|
DeviceNotAvailableException | |
hasFeature
public boolean hasFeature (String feature)
Paramètres |
---|
feature | String |
Jetés |
---|
DeviceNotAvailableException | |
installer le paquet
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
Paramètres |
---|
packageFile | File |
reinstall | boolean |
extraArgs | 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 |
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 |
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 |
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 |
Jetés |
---|
DeviceNotAvailableException | |
installerPackages
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
Paramètres |
---|
packageFiles | |
reinstall | boolean |
extraArgs | String |
Jetés |
---|
DeviceNotAvailableException | |
installerPackages
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Paramètres |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | 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 |
Jetés |
---|
DeviceNotAvailableException | |
installerPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
Paramètres |
---|
packageFiles | |
reinstall | boolean |
userId | int |
extraArgs | String |
Jetés |
---|
DeviceNotAvailableException | |
installerRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Paramètres |
---|
remoteApkPaths | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Jetés |
---|
DeviceNotAvailableException | |
installerRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
String... extraArgs)
Paramètres |
---|
remoteApkPaths | |
reinstall | boolean |
extraArgs | String |
Jetés |
---|
DeviceNotAvailableException | |
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
Jetés |
---|
DeviceNotAvailableException | |
isMultiUserSupported
public boolean isMultiUserSupported ()
Jetés |
---|
DeviceNotAvailableException | |
estPackageInstalled
public boolean isPackageInstalled (String packageName)
Paramètres |
---|
packageName | String |
Jetés |
---|
DeviceNotAvailableException | |
estPackageInstalled
public boolean isPackageInstalled (String packageName,
String userId)
Paramètres |
---|
packageName | String |
userId | String |
Jetés |
---|
DeviceNotAvailableException | |
estUserRunning
public boolean isUserRunning (int userId)
Jetés |
---|
DeviceNotAvailableException | |
isUserSecondary
public boolean isUserSecondary (int userId)
Jetés |
---|
DeviceNotAvailableException | |
listDisplayIds
public listDisplayIds ()
Jetés |
---|
DeviceNotAvailableException | |
listeUtilisateurs
public listUsers ()
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 |
Jetés |
---|
DeviceNotAvailableException | |
Supprimer les propriétaires
public void removeOwners ()
Jetés |
---|
DeviceNotAvailableException | |
supprimer l'utilisateur
public boolean removeUser (int userId)
Jetés |
---|
DeviceNotAvailableException | |
setDeviceOwner
public boolean setDeviceOwner (String componentName,
int userId)
Paramètres |
---|
componentName | String |
userId | int |
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)
Jetés |
---|
DeviceNotAvailableException | |
démarrerUtilisateur
public boolean startUser (int userId,
boolean waitFlag)
Paramètres |
---|
userId | int |
waitFlag | 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 |
Jetés |
---|
DeviceNotAvailableException | |
arrêter l'utilisateur
public boolean stopUser (int userId)
Jetés |
---|
DeviceNotAvailableException | |
changer d'utilisateur
public boolean switchUser (int userId)
Jetés |
---|
DeviceNotAvailableException | |
changer d'utilisateur
public boolean switchUser (int userId,
long timeout)
Paramètres |
---|
userId | int |
timeout | long |
Jetés |
---|
DeviceNotAvailableException | |
désinstallerPackage
public String uninstallPackage (String packageName)
Paramètres |
---|
packageName | String |
Jetés |
---|
DeviceNotAvailableException | |
désinstallerPackageForUser
public String uninstallPackageForUser (String packageName,
int userId)
Paramètres |
---|
packageName | String |
userId | int |
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.
getHostCurrentTime
protected long getHostCurrentTime ()
Exposé pour les tests
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 | |