TestDevice

public class TestDevice
extends NativeDevice

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


Implementazione di un ITestDevice per un dispositivo Android full stack

Riepilogo

Campi

public static final String DISMISS_KEYGUARD_CMD

Comandi che possono essere utilizzati per ignorare la schermata di blocco.

Costruttori pubblici

TestDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Metodi pubblici

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)

Metodi protetti

void doAdbReboot(NativeDevice.RebootMode rebootMode, String reason)

Esegui un riavvio ADB.

long getCheckNewUserSleep()

Esposto per i test.

long getHostCurrentTime()

Esposto per i test

void prePostBootSetup()

Consente a ogni tipo di dispositivo (AndroidNativeDevice, TestDevice) di eseguire l'override di questo metodo per una configurazione post-boot specifica.

Campi

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

Comandi che possono essere utilizzati per ignorare la schermata di blocco.

Costruttori pubblici

TestDevice

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

Metodi pubblici

clearErrorDialogs

public boolean clearErrorDialogs ()

Ritorni
boolean

Lanci
DeviceNotAvailableException

createUser

public int createUser (String name)

Parametri
name String

Ritorni
int

Lanci
DeviceNotAvailableException

createUser

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

Parametri
name String

guest boolean

ephemeral boolean

Ritorni
int

Lanci
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Parametri
name String

Ritorni
int

Lanci
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

Lanci
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

Parametri
deviceFilePath String

Ritorni
boolean

Lanci
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Parametri
process String

devicePath String

Ritorni
File

Lanci
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Ritorni

Lanci
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Parametri
namespace String

Ritorni

Lanci
DeviceNotAvailableException

getAndroidId

public String getAndroidId (int userId)

Parametri
userId int

Ritorni
String

Lanci
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Ritorni

Lanci
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Parametri
packageName String

Ritorni
PackageInfo

Lanci
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Ritorni

Lanci
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Ritorni
DeviceFoldableState

Lanci
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Ritorni
int

Lanci
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Ritorni

Lanci
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Ritorni

Lanci
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Ritorni
KeyguardControllerState

Lanci
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Ritorni

Lanci
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Ritorni
int

Lanci
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Ritorni
int

Lanci
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Ritorni
Integer

Lanci
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

Ritorni
InputStreamSource

Lanci
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Parametri
format String

rescale boolean

Ritorni
InputStreamSource

Lanci
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format)

Parametri
format String

Ritorni
InputStreamSource

Lanci
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

Parametri
displayId long

Ritorni
InputStreamSource

Lanci
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

Parametri
namespace String

key String

Ritorni
String

Lanci
DeviceNotAvailableException

getSetting

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

Parametri
userId int

namespace String

key String

Ritorni
String

Lanci
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Ritorni

Lanci
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Parametri
userId int

Ritorni
int

Lanci
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Ritorni

Lanci
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Parametri
userId int

Ritorni
int

Lanci
DeviceNotAvailableException

hasFeature

public boolean hasFeature (String feature)

Parametri
feature String

Ritorni
boolean

Lanci
DeviceNotAvailableException

installPackage

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

Parametri
packageFile File

reinstall boolean

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

installPackage

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

Parametri
packageFile File

certFile File

reinstall boolean

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

installPackage

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

Parametri
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

installPackageForUser

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

Parametri
packageFile File

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

installPackageForUser

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

Parametri
packageFile File

reinstall boolean

userId int

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

installPackages

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

Parametri
packageFiles

reinstall boolean

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

installPackages

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

Parametri
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

installPackagesForUser

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

Parametri
packageFiles

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

installPackagesForUser

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

Parametri
packageFiles

reinstall boolean

userId int

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

installRemotePackages

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

Parametri
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

installRemotePackages

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

Parametri
remoteApkPaths

reinstall boolean

extraArgs String

Ritorni
String

Lanci
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Ritorni
boolean

Lanci
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

Ritorni
boolean

Lanci
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Parametri
packageName String

Ritorni
boolean

Lanci
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Parametri
packageName String

userId String

Ritorni
boolean

Lanci
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

Parametri
userId int

Ritorni
boolean

Lanci
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Parametri
userId int

Ritorni
boolean

Lanci
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

Ritorni

Lanci
DeviceNotAvailableException

listUsers

public  listUsers ()

Ritorni

Lanci
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

Parametri
exception Throwable

removeAdmin

public boolean removeAdmin (String componentName, 
                int userId)

Parametri
componentName String

userId int

Ritorni
boolean

Lanci
DeviceNotAvailableException

removeOwners

public void removeOwners ()

Lanci
DeviceNotAvailableException

removeUser

public boolean removeUser (int userId)

Parametri
userId int

Ritorni
boolean

Lanci
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Parametri
componentName String

userId int

Ritorni
boolean

Lanci
DeviceNotAvailableException

setSetting

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

Parametri
namespace String

key String

value String

Lanci
DeviceNotAvailableException

setSetting

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

Parametri
userId int

namespace String

key String

value String

Lanci
DeviceNotAvailableException

startUser

public boolean startUser (int userId)

Parametri
userId int

Ritorni
boolean

Lanci
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

Parametri
userId int

waitFlag boolean

Ritorni
boolean

Lanci
DeviceNotAvailableException

stopUser

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

Parametri
userId int

waitFlag boolean

forceFlag boolean

Ritorni
boolean

Lanci
DeviceNotAvailableException

stopUser

public boolean stopUser (int userId)

Parametri
userId int

Ritorni
boolean

Lanci
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId)

Parametri
userId int

Ritorni
boolean

Lanci
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId, 
                long timeout)

Parametri
userId int

timeout long

Ritorni
boolean

Lanci
DeviceNotAvailableException

uninstallPackage

public String uninstallPackage (String packageName)

Parametri
packageName String

Ritorni
String

Lanci
DeviceNotAvailableException

uninstallPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Parametri
packageName String

userId int

Ritorni
String

Lanci
DeviceNotAvailableException

Metodi protetti

doAdbReboot

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

Esegui un riavvio ADB.

Parametri
rebootMode NativeDevice.RebootMode: una modalità di questo riavvio.

reason String: per questo riavvio.

Lanci
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Esposto per i test.

Ritorni
long

getHostCurrentTime

protected long getHostCurrentTime ()

Esposto per i test

Ritorni
long

prePostBootSetup

protected void prePostBootSetup ()

Consente a ogni tipo di dispositivo (AndroidNativeDevice, TestDevice) di eseguire l'override di questo metodo per una configurazione post-boot specifica.

Lanci
DeviceNotAvailableException