Ab dem 27. März 2025 empfehlen wir, android-latest-release
anstelle von aosp-main
zu verwenden, um AOSP zu erstellen und Beiträge dazu zu leisten. Weitere Informationen finden Sie unter Änderungen am AOSP.
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
TestDevice
public
class
TestDevice
extends NativeDevice
Bekannte direkte Unterklassen
ManagedRemoteDevice |
Ein Gerät, das in einer virtuellen Maschine ausgeführt wird, die wir per Fernzugriff über eine Tradefed-Instanz in der VM verwalten.
|
NestedRemoteDevice |
Darstellung des Geräts, das in einer Remote-Cuttlefish-VM ausgeführt wird.
|
RemoteAndroidDevice |
Implementierung einer ITestDevice für ein Full-Stack-Android-Gerät, das über adb connect verbunden ist.
|
|
Bekannte indirekte Unterklassen
|
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)
|
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 ()
Ausgabe |
DeviceNotAvailableException |
|
createUser
public int createUser (String name)
Ausgabe |
DeviceNotAvailableException |
|
createUser
public int createUser (String name,
boolean guest,
boolean ephemeral)
Parameter |
name |
String |
guest |
boolean |
ephemeral |
boolean |
Ausgabe |
DeviceNotAvailableException |
|
createUserNoThrow
public int createUserNoThrow (String name)
Ausgabe |
DeviceNotAvailableException |
|
disableKeyguard
public void disableKeyguard ()
Ausgabe |
DeviceNotAvailableException |
|
doesFileExist
public boolean doesFileExist (String deviceFilePath)
Parameter |
deviceFilePath |
String |
Ausgabe |
DeviceNotAvailableException |
|
dumpHeap
public File dumpHeap (String process,
String devicePath)
Parameter |
process |
String |
devicePath |
String |
Ausgabe |
DeviceNotAvailableException |
|
getActiveApexes
public getActiveApexes ()
Ausgabe |
DeviceNotAvailableException |
|
getAllSettings
public getAllSettings (String namespace)
Parameter |
namespace |
String |
Ausgabe |
DeviceNotAvailableException |
|
getAndroidId
public String getAndroidId (int userId)
Ausgabe |
DeviceNotAvailableException |
|
getAndroidIds
public getAndroidIds ()
Ausgabe |
DeviceNotAvailableException |
|
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
Parameter |
packageName |
String |
Ausgabe |
DeviceNotAvailableException |
|
getAppPackageInfos
public getAppPackageInfos ()
Ausgabe |
DeviceNotAvailableException |
|
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
Returns |
DeviceFoldableState |
|
Ausgabe |
DeviceNotAvailableException |
|
getCurrentUser
public int getCurrentUser ()
Ausgabe |
DeviceNotAvailableException |
|
getFoldableStates
public getFoldableStates ()
Ausgabe |
DeviceNotAvailableException |
|
getInstalledPackageNames
public getInstalledPackageNames ()
Ausgabe |
DeviceNotAvailableException |
|
getKeyguardState
public KeyguardControllerState getKeyguardState ()
Returns |
KeyguardControllerState |
|
Ausgabe |
DeviceNotAvailableException |
|
getMainlineModuleInfo
public getMainlineModuleInfo ()
Ausgabe |
DeviceNotAvailableException |
|
public int getMaxNumberOfRunningUsersSupported ()
Ausgabe |
DeviceNotAvailableException |
|
public int getMaxNumberOfUsersSupported ()
Ausgabe |
DeviceNotAvailableException |
|
getPrimaryUserId
public Integer getPrimaryUserId ()
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)
Returns |
InputStreamSource |
|
Ausgabe |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot (long displayId)
Returns |
InputStreamSource |
|
Ausgabe |
DeviceNotAvailableException |
|
getSetting
public String getSetting (String namespace,
String key)
Parameter |
namespace |
String |
key |
String |
Ausgabe |
DeviceNotAvailableException |
|
getSetting
public String getSetting (int userId,
String namespace,
String key)
Parameter |
userId |
int |
namespace |
String |
key |
String |
Ausgabe |
DeviceNotAvailableException |
|
getUninstallablePackageNames
public getUninstallablePackageNames ()
Ausgabe |
DeviceNotAvailableException |
|
getUserFlags
public int getUserFlags (int userId)
Ausgabe |
DeviceNotAvailableException |
|
getUserInfos
public getUserInfos ()
Ausgabe |
DeviceNotAvailableException |
|
getUserSerialNumber
public int getUserSerialNumber (int userId)
Ausgabe |
DeviceNotAvailableException |
|
hasFeature
public boolean hasFeature (String feature)
Ausgabe |
DeviceNotAvailableException |
|
installPackage
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
Parameter |
packageFile |
File |
reinstall |
boolean |
extraArgs |
String |
Ausgabe |
DeviceNotAvailableException |
|
installPackage
public String installPackage (File packageFile,
File certFile,
boolean reinstall,
String... extraArgs)
Parameter |
packageFile |
File |
certFile |
File |
reinstall |
boolean |
extraArgs |
String |
Ausgabe |
DeviceNotAvailableException |
|
installPackage
public String installPackage (File packageFile,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parameter |
packageFile |
File |
reinstall |
boolean |
grantPermissions |
boolean |
extraArgs |
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 |
Ausgabe |
DeviceNotAvailableException |
|
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
Parameter |
packageFile |
File |
reinstall |
boolean |
userId |
int |
extraArgs |
String |
Ausgabe |
DeviceNotAvailableException |
|
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
Parameter |
packageFiles |
|
reinstall |
boolean |
extraArgs |
String |
Ausgabe |
DeviceNotAvailableException |
|
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parameter |
packageFiles |
|
reinstall |
boolean |
grantPermissions |
boolean |
extraArgs |
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 |
Ausgabe |
DeviceNotAvailableException |
|
installPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
Parameter |
packageFiles |
|
reinstall |
boolean |
userId |
int |
extraArgs |
String |
Ausgabe |
DeviceNotAvailableException |
|
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parameter |
remoteApkPaths |
|
reinstall |
boolean |
grantPermissions |
boolean |
extraArgs |
String |
Ausgabe |
DeviceNotAvailableException |
|
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
String... extraArgs)
Parameter |
remoteApkPaths |
|
reinstall |
boolean |
extraArgs |
String |
Ausgabe |
DeviceNotAvailableException |
|
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
Ausgabe |
DeviceNotAvailableException |
|
isMultiUserSupported
public boolean isMultiUserSupported ()
Ausgabe |
DeviceNotAvailableException |
|
isPackageInstalled
public boolean isPackageInstalled (String packageName)
Parameter |
packageName |
String |
Ausgabe |
DeviceNotAvailableException |
|
isPackageInstalled
public boolean isPackageInstalled (String packageName,
String userId)
Parameter |
packageName |
String |
userId |
String |
Ausgabe |
DeviceNotAvailableException |
|
isUserRunning
public boolean isUserRunning (int userId)
Ausgabe |
DeviceNotAvailableException |
|
isUserSecondary
public boolean isUserSecondary (int userId)
Ausgabe |
DeviceNotAvailableException |
|
listDisplayIds
public listDisplayIds ()
Ausgabe |
DeviceNotAvailableException |
|
listUsers
public listUsers ()
Ausgabe |
DeviceNotAvailableException |
|
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Parameter |
exception |
Throwable |
removeAdmin
public boolean removeAdmin (String componentName,
int userId)
Parameter |
componentName |
String |
userId |
int |
Ausgabe |
DeviceNotAvailableException |
|
removeOwners
public void removeOwners ()
Ausgabe |
DeviceNotAvailableException |
|
removeUser
public boolean removeUser (int userId)
Ausgabe |
DeviceNotAvailableException |
|
setDeviceOwner
public boolean setDeviceOwner (String componentName,
int userId)
Parameter |
componentName |
String |
userId |
int |
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)
Ausgabe |
DeviceNotAvailableException |
|
startUser
public boolean startUser (int userId,
boolean waitFlag)
Parameter |
userId |
int |
waitFlag |
boolean |
Ausgabe |
DeviceNotAvailableException |
|
stopUser
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
Parameter |
userId |
int |
waitFlag |
boolean |
forceFlag |
boolean |
Ausgabe |
DeviceNotAvailableException |
|
stopUser
public boolean stopUser (int userId)
Ausgabe |
DeviceNotAvailableException |
|
switchUser
public boolean switchUser (int userId)
Ausgabe |
DeviceNotAvailableException |
|
switchUser
public boolean switchUser (int userId,
long timeout)
Parameter |
userId |
int |
timeout |
long |
Ausgabe |
DeviceNotAvailableException |
|
uninstallPackage
public String uninstallPackage (String packageName)
Parameter |
packageName |
String |
Ausgabe |
DeviceNotAvailableException |
|
uninstallPackageForUser
public String uninstallPackageForUser (String packageName,
int userId)
Parameter |
packageName |
String |
userId |
int |
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.
getHostCurrentTime
protected long getHostCurrentTime ()
Für Tests freigegeben
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 |
|
Alle Inhalte und Codebeispiele auf dieser Seite unterliegen den Lizenzen wie im Abschnitt Inhaltslizenz beschrieben. Java und OpenJDK sind Marken oder eingetragene Marken von Oracle und/oder seinen Tochtergesellschaften.
Zuletzt aktualisiert: 2025-03-26 (UTC).
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-03-26 (UTC)."],[],[]]