TestDevice

public class TestDevice
extends NativeDevice

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


Implementacja ITestDevice na urządzeniu z pełnym zestawem Androida

Podsumowanie

Fieldsem

public static final String DISMISS_KEYGUARD_CMD

Polecenia, których można używać do zamykania ekranu blokady.

Konstruktory publiczne

TestDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Metody publiczne

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)

Chronione metody

void doAdbReboot(NativeDevice.RebootMode rebootMode, String reason)

Uruchom ponownie urządzenie za pomocą adb.

long getCheckNewUserSleep()

Wyeksponowane do testowania.

long getHostCurrentTime()

Udostępnione do testowania

void prePostBootSetup()

Umożliwia każdemu typowi urządzenia (AndroidNativeDevice, TestDevice) zastąpienie tej metody w przypadku określonej konfiguracji po uruchomieniu.

Fieldsem

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

Polecenia, których można używać do zamykania ekranu blokady.

Konstruktory publiczne

TestDevice

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

Metody publiczne

clearErrorDialogs

public boolean clearErrorDialogs ()

Zwroty
boolean

Rzuty
DeviceNotAvailableException

createUser

public int createUser (String name)

Parametry
name String

Zwroty
int

Rzuty
DeviceNotAvailableException

createUser

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

Parametry
name String

guest boolean

ephemeral boolean

Zwroty
int

Rzuty
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Parametry
name String

Zwroty
int

Rzuty
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

Rzuty
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

Parametry
deviceFilePath String

Zwroty
boolean

Rzuty
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Parametry
process String

devicePath String

Zwroty
File

Rzuty
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Zwroty

Rzuty
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Parametry
namespace String

Zwroty

Rzuty
DeviceNotAvailableException

getAndroidId

public String getAndroidId (int userId)

Parametry
userId int

Zwroty
String

Rzuty
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Zwroty

Rzuty
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Parametry
packageName String

Zwroty
PackageInfo

Rzuty
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Zwroty

Rzuty
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Zwroty
DeviceFoldableState

Rzuty
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Zwroty
int

Rzuty
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Zwroty

Rzuty
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Zwroty

Rzuty
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Zwroty
KeyguardControllerState

Rzuty
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Zwroty

Rzuty
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Zwroty
int

Rzuty
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Zwroty
int

Rzuty
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Zwroty
Integer

Rzuty
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

Zwroty
InputStreamSource

Rzuty
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Parametry
format String

rescale boolean

Zwroty
InputStreamSource

Rzuty
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format)

Parametry
format String

Zwroty
InputStreamSource

Rzuty
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

Parametry
displayId long

Zwroty
InputStreamSource

Rzuty
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

Parametry
namespace String

key String

Zwroty
String

Rzuty
DeviceNotAvailableException

getSetting

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

Parametry
userId int

namespace String

key String

Zwroty
String

Rzuty
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Zwroty

Rzuty
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Parametry
userId int

Zwroty
int

Rzuty
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Zwroty

Rzuty
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Parametry
userId int

Zwroty
int

Rzuty
DeviceNotAvailableException

hasFeature

public boolean hasFeature (String feature)

Parametry
feature String

Zwroty
boolean

Rzuty
DeviceNotAvailableException

installPackage

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

Parametry
packageFile File

reinstall boolean

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

installPackage

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

Parametry
packageFile File

certFile File

reinstall boolean

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

installPackage

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

Parametry
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

installPackageForUser

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

Parametry
packageFile File

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

installPackageForUser

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

Parametry
packageFile File

reinstall boolean

userId int

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

installPackages

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

Parametry
packageFiles

reinstall boolean

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

installPackages

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

Parametry
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

installPackagesForUser

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

Parametry
packageFiles

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

installPackagesForUser

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

Parametry
packageFiles

reinstall boolean

userId int

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

installRemotePackages

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

Parametry
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

installRemotePackages

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

Parametry
remoteApkPaths

reinstall boolean

extraArgs String

Zwroty
String

Rzuty
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Zwroty
boolean

Rzuty
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

Zwroty
boolean

Rzuty
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Parametry
packageName String

Zwroty
boolean

Rzuty
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Parametry
packageName String

userId String

Zwroty
boolean

Rzuty
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

Parametry
userId int

Zwroty
boolean

Rzuty
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Parametry
userId int

Zwroty
boolean

Rzuty
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

Zwroty

Rzuty
DeviceNotAvailableException

listUsers

public  listUsers ()

Zwroty

Rzuty
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

Parametry
exception Throwable

removeAdmin

public boolean removeAdmin (String componentName, 
                int userId)

Parametry
componentName String

userId int

Zwroty
boolean

Rzuty
DeviceNotAvailableException

removeOwners

public void removeOwners ()

Rzuty
DeviceNotAvailableException

removeUser

public boolean removeUser (int userId)

Parametry
userId int

Zwroty
boolean

Rzuty
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Parametry
componentName String

userId int

Zwroty
boolean

Rzuty
DeviceNotAvailableException

setSetting

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

Parametry
namespace String

key String

value String

Rzuty
DeviceNotAvailableException

setSetting

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

Parametry
userId int

namespace String

key String

value String

Rzuty
DeviceNotAvailableException

startUser

public boolean startUser (int userId)

Parametry
userId int

Zwroty
boolean

Rzuty
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

Parametry
userId int

waitFlag boolean

Zwroty
boolean

Rzuty
DeviceNotAvailableException

stopUser

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

Parametry
userId int

waitFlag boolean

forceFlag boolean

Zwroty
boolean

Rzuty
DeviceNotAvailableException

stopUser

public boolean stopUser (int userId)

Parametry
userId int

Zwroty
boolean

Rzuty
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId)

Parametry
userId int

Zwroty
boolean

Rzuty
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId, 
                long timeout)

Parametry
userId int

timeout long

Zwroty
boolean

Rzuty
DeviceNotAvailableException

uninstallPackage

public String uninstallPackage (String packageName)

Parametry
packageName String

Zwroty
String

Rzuty
DeviceNotAvailableException

uninstallPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Parametry
packageName String

userId int

Zwroty
String

Rzuty
DeviceNotAvailableException

Chronione metody

doAdbReboot

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

Uruchom ponownie urządzenie za pomocą adb.

Parametry
rebootMode NativeDevice.RebootMode: tryb ponownego uruchamiania.

reason String: w przypadku tego restartu.

Rzuty
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Wyeksponowane do testowania.

Zwroty
long

getHostCurrentTime

protected long getHostCurrentTime ()

Udostępnione do testowania

Zwroty
long

prePostBootSetup

protected void prePostBootSetup ()

Umożliwia każdemu typowi urządzenia (AndroidNativeDevice, TestDevice) zastąpienie tej metody w przypadku określonej konfiguracji po uruchomieniu.

Rzuty
DeviceNotAvailableException