TestDevice

public class TestDevice
extends NativeDevice

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


Implementierung einer ITestDevice für ein Full-Stack-Android-Gerät

Zusammenfassung

Felder

public static final String DISMISS_KEYGUARD_CMD

Befehle, mit denen der Sperrbildschirm geschlossen werden kann.

Öffentliche Konstruktoren

TestDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Öffentliche Methoden

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)

Geschützte Methoden

void doAdbReboot(NativeDevice.RebootMode rebootMode, String reason)

Führen Sie einen ADB-Neustart durch.

long getCheckNewUserSleep()

Wird für Tests freigegeben.

long getHostCurrentTime()

Für Tests freigegeben

void prePostBootSetup()

Ermöglicht es jedem Gerätetyp (AndroidNativeDevice, TestDevice), diese Methode für die spezifische Einrichtung nach dem Start zu überschreiben.

Felder

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

Befehle, mit denen der Sperrbildschirm geschlossen werden kann.

Öffentliche Konstruktoren

TestDevice

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

Öffentliche Methoden

clearErrorDialogs

public boolean clearErrorDialogs ()

Returns
boolean

Ausgabe
DeviceNotAvailableException

createUser

public int createUser (String name)

Parameter
name String

Returns
int

Ausgabe
DeviceNotAvailableException

createUser

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

Parameter
name String

guest boolean

ephemeral boolean

Returns
int

Ausgabe
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Parameter
name String

Returns
int

Ausgabe
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

Ausgabe
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

Parameter
deviceFilePath String

Returns
boolean

Ausgabe
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Parameter
process String

devicePath String

Returns
File

Ausgabe
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Returns

Ausgabe
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Parameter
namespace String

Returns

Ausgabe
DeviceNotAvailableException

getAndroidId

public String getAndroidId (int userId)

Parameter
userId int

Returns
String

Ausgabe
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Returns

Ausgabe
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Parameter
packageName String

Returns
PackageInfo

Ausgabe
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Returns

Ausgabe
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Returns
DeviceFoldableState

Ausgabe
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Returns
int

Ausgabe
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Returns

Ausgabe
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Returns

Ausgabe
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Returns
KeyguardControllerState

Ausgabe
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Returns

Ausgabe
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Returns
int

Ausgabe
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Returns
int

Ausgabe
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Returns
Integer

Ausgabe
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

Returns
InputStreamSource

Ausgabe
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Parameter
format String

rescale boolean

Returns
InputStreamSource

Ausgabe
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format)

Parameter
format String

Returns
InputStreamSource

Ausgabe
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

Parameter
displayId long

Returns
InputStreamSource

Ausgabe
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

Parameter
namespace String

key String

Returns
String

Ausgabe
DeviceNotAvailableException

getSetting

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

Parameter
userId int

namespace String

key String

Returns
String

Ausgabe
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Returns

Ausgabe
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Parameter
userId int

Returns
int

Ausgabe
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Returns

Ausgabe
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Parameter
userId int

Returns
int

Ausgabe
DeviceNotAvailableException

hasFeature

public boolean hasFeature (String feature)

Parameter
feature String

Returns
boolean

Ausgabe
DeviceNotAvailableException

installPackage

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

Parameter
packageFile File

reinstall boolean

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

installPackage

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

Parameter
packageFile File

certFile File

reinstall boolean

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

installPackage

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

Parameter
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

installPackageForUser

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

Parameter
packageFile File

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

installPackageForUser

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

Parameter
packageFile File

reinstall boolean

userId int

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

installPackages

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

Parameter
packageFiles

reinstall boolean

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

installPackages

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

Parameter
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

installPackagesForUser

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

Parameter
packageFiles

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

installPackagesForUser

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

Parameter
packageFiles

reinstall boolean

userId int

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

installRemotePackages

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

Parameter
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

installRemotePackages

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

Parameter
remoteApkPaths

reinstall boolean

extraArgs String

Returns
String

Ausgabe
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Returns
boolean

Ausgabe
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

Returns
boolean

Ausgabe
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Parameter
packageName String

Returns
boolean

Ausgabe
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Parameter
packageName String

userId String

Returns
boolean

Ausgabe
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

Parameter
userId int

Returns
boolean

Ausgabe
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Parameter
userId int

Returns
boolean

Ausgabe
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

Returns

Ausgabe
DeviceNotAvailableException

listUsers

public  listUsers ()

Returns

Ausgabe
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

Parameter
exception Throwable

removeAdmin

public boolean removeAdmin (String componentName, 
                int userId)

Parameter
componentName String

userId int

Returns
boolean

Ausgabe
DeviceNotAvailableException

removeOwners

public void removeOwners ()

Ausgabe
DeviceNotAvailableException

removeUser

public boolean removeUser (int userId)

Parameter
userId int

Returns
boolean

Ausgabe
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Parameter
componentName String

userId int

Returns
boolean

Ausgabe
DeviceNotAvailableException

setSetting

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

Parameter
namespace String

key String

value String

Ausgabe
DeviceNotAvailableException

setSetting

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

Parameter
userId int

namespace String

key String

value String

Ausgabe
DeviceNotAvailableException

startUser

public boolean startUser (int userId)

Parameter
userId int

Returns
boolean

Ausgabe
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

Parameter
userId int

waitFlag boolean

Returns
boolean

Ausgabe
DeviceNotAvailableException

stopUser

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

Parameter
userId int

waitFlag boolean

forceFlag boolean

Returns
boolean

Ausgabe
DeviceNotAvailableException

stopUser

public boolean stopUser (int userId)

Parameter
userId int

Returns
boolean

Ausgabe
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId)

Parameter
userId int

Returns
boolean

Ausgabe
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId, 
                long timeout)

Parameter
userId int

timeout long

Returns
boolean

Ausgabe
DeviceNotAvailableException

uninstallPackage

public String uninstallPackage (String packageName)

Parameter
packageName String

Returns
String

Ausgabe
DeviceNotAvailableException

uninstallPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Parameter
packageName String

userId int

Returns
String

Ausgabe
DeviceNotAvailableException

Geschützte Methoden

doAdbReboot

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

Führen Sie einen ADB-Neustart durch.

Parameter
rebootMode NativeDevice.RebootMode: einen Modus dieses Neustarts.

reason String: für diesen Neustart.

Ausgabe
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Wird für Tests freigegeben.

Returns
long

getHostCurrentTime

protected long getHostCurrentTime ()

Für Tests freigegeben

Returns
long

prePostBootSetup

protected void prePostBootSetup ()

Ermöglicht es jedem Gerätetyp (AndroidNativeDevice, TestDevice), diese Methode für die spezifische Einrichtung nach dem Start zu überschreiben.

Ausgabe
DeviceNotAvailableException