Google is committed to advancing racial equity for Black communities. See how.
Cette page a été traduite par l'API Cloud Translation.
Switch to English

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é

Des champs

public static final String DISMISS_KEYGUARD_CMD

Commandes qui peuvent être utilisées pour fermer 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 ()

int getCurrentUser ()

getInstalledPackageNames ()

KeyguardControllerState getKeyguardState ()

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)

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 d'appareil (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 qui peuvent être utilisées pour fermer le keyguard.

Constructeurs publics

TestDevice

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

Méthodes publiques

clearErrorDialogs

public boolean clearErrorDialogs ()

Retour
boolean

Jette
DeviceNotAvailableException

Créer un utilisateur

public int createUser (String name)

Paramètres
name String

Retour
int

Jette
DeviceNotAvailableException

Créer un utilisateur

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

Paramètres
name String

guest boolean

ephemeral boolean

Retour
int

Jette
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Paramètres
name String

Retour
int

Jette
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

Jette
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

Paramètres
deviceFilePath String

Retour
boolean

Jette
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Paramètres
process String

devicePath String

Retour
File

Jette
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Retour

Jette
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Paramètres
namespace String

Retour

Jette
DeviceNotAvailableException

getAndroidId

public String getAndroidId (int userId)

Paramètres
userId int

Retour
String

Jette
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Retour

Jette
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Paramètres
packageName String

Retour
PackageInfo

Jette
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Retour

Jette
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Retour
int

Jette
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Retour

Jette
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Retour
KeyguardControllerState

Jette
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Retour
int

Jette
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Retour
int

Jette
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Retour
Integer

Jette
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

Retour
InputStreamSource

Jette
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Paramètres
format String

rescale boolean

Retour
InputStreamSource

Jette
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format)

Paramètres
format String

Retour
InputStreamSource

Jette
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

Paramètres
displayId long

Retour
InputStreamSource

Jette
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

Paramètres
namespace String

key String

Retour
String

Jette
DeviceNotAvailableException

getSetting

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

Paramètres
userId int

namespace String

key String

Retour
String

Jette
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Retour

Jette
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Paramètres
userId int

Retour
int

Jette
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Retour

Jette
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Paramètres
userId int

Retour
int

Jette
DeviceNotAvailableException

hasFeature

public boolean hasFeature (String feature)

Paramètres
feature String

Retour
boolean

Jette
DeviceNotAvailableException

installer le paquet

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

Paramètres
packageFile File

reinstall boolean

extraArgs String

Retour
String

Jette
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

Jette
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

Jette
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

Retour
String

Jette
DeviceNotAvailableException

installPackageForUser

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

Paramètres
packageFile File

reinstall boolean

userId int

extraArgs String

Retour
String

Jette
DeviceNotAvailableException

installPackages

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

Paramètres
packageFiles

reinstall boolean

extraArgs String

Retour
String

Jette
DeviceNotAvailableException

installPackages

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

Paramètres
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Retour
String

Jette
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

Retour
String

Jette
DeviceNotAvailableException

installPackagesForUser

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

Paramètres
packageFiles

reinstall boolean

userId int

extraArgs String

Retour
String

Jette
DeviceNotAvailableException

installRemotePackages

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

Paramètres
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Retour
String

Jette
DeviceNotAvailableException

installRemotePackages

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

Paramètres
remoteApkPaths

reinstall boolean

extraArgs String

Retour
String

Jette
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Retour
boolean

Jette
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

Retour
boolean

Jette
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Paramètres
packageName String

Retour
boolean

Jette
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Paramètres
packageName String

userId String

Retour
boolean

Jette
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

Paramètres
userId int

Retour
boolean

Jette
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Paramètres
userId int

Retour
boolean

Jette
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

Retour

Jette
DeviceNotAvailableException

listUsers

public  listUsers ()

Retour

Jette
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

Retour
boolean

Jette
DeviceNotAvailableException

removeOwners

public void removeOwners ()

Jette
DeviceNotAvailableException

removeUser

public boolean removeUser (int userId)

Paramètres
userId int

Retour
boolean

Jette
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Paramètres
componentName String

userId int

Retour
boolean

Jette
DeviceNotAvailableException

setSetting

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

Paramètres
namespace String

key String

value String

Jette
DeviceNotAvailableException

setSetting

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

Paramètres
userId int

namespace String

key String

value String

Jette
DeviceNotAvailableException

startUser

public boolean startUser (int userId)

Paramètres
userId int

Retour
boolean

Jette
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

Paramètres
userId int

waitFlag boolean

Retour
boolean

Jette
DeviceNotAvailableException

stopUser

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

Paramètres
userId int

waitFlag boolean

forceFlag boolean

Retour
boolean

Jette
DeviceNotAvailableException

stopUser

public boolean stopUser (int userId)

Paramètres
userId int

Retour
boolean

Jette
DeviceNotAvailableException

changer d'utilisateur

public boolean switchUser (int userId)

Paramètres
userId int

Retour
boolean

Jette
DeviceNotAvailableException

changer d'utilisateur

public boolean switchUser (int userId, 
                long timeout)

Paramètres
userId int

timeout long

Retour
boolean

Jette
DeviceNotAvailableException

désinstallerPackage

public String uninstallPackage (String packageName)

Paramètres
packageName String

Retour
String

Jette
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.

Jette
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Exposé pour les tests.

Retour
long

getHostCurrentTime

protected long getHostCurrentTime ()

Exposé pour les tests

Retour
long

prePostBootSetup

protected void prePostBootSetup ()

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

Jette
DeviceNotAvailableException