החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
TestDevice
public
class
TestDevice
extends NativeDevice
הטמעה של ITestDevice
במכשיר Android עם סטאק מלא
סיכום
שדות |
public
static
final
String |
DISMISS_KEYGUARD_CMD
פקודות שאפשר להשתמש בהן כדי לסגור את מסך הנעילה.
|
קונסטרוקטורים גלויים לכולם |
TestDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
|
שיטות ציבוריות |
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)
|
שדות
DISMISS_KEYGUARD_CMD
public static final String DISMISS_KEYGUARD_CMD
פקודות שאפשר להשתמש בהן כדי לסגור את מסך הנעילה.
קונסטרוקטורים גלויים לכולם
TestDevice
public TestDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)
שיטות ציבוריות
clearErrorDialogs
public boolean clearErrorDialogs ()
זריקות |
DeviceNotAvailableException |
|
createUser
public int createUser (String name)
זריקות |
DeviceNotAvailableException |
|
createUser
public int createUser (String name,
boolean guest,
boolean ephemeral)
פרמטרים |
name |
String |
guest |
boolean |
ephemeral |
boolean |
זריקות |
DeviceNotAvailableException |
|
createUserNoThrow
public int createUserNoThrow (String name)
זריקות |
DeviceNotAvailableException |
|
disableKeyguard
public void disableKeyguard ()
זריקות |
DeviceNotAvailableException |
|
doesFileExist
public boolean doesFileExist (String deviceFilePath)
פרמטרים |
deviceFilePath |
String |
זריקות |
DeviceNotAvailableException |
|
dumpHeap
public File dumpHeap (String process,
String devicePath)
פרמטרים |
process |
String |
devicePath |
String |
זריקות |
DeviceNotAvailableException |
|
getActiveApexes
public getActiveApexes ()
זריקות |
DeviceNotAvailableException |
|
getAllSettings
public getAllSettings (String namespace)
זריקות |
DeviceNotAvailableException |
|
getAndroidId
public String getAndroidId (int userId)
זריקות |
DeviceNotAvailableException |
|
getAndroidIds
public getAndroidIds ()
זריקות |
DeviceNotAvailableException |
|
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
פרמטרים |
packageName |
String |
זריקות |
DeviceNotAvailableException |
|
getAppPackageInfos
public getAppPackageInfos ()
זריקות |
DeviceNotAvailableException |
|
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
החזרות |
DeviceFoldableState |
|
זריקות |
DeviceNotAvailableException |
|
getCurrentUser
public int getCurrentUser ()
זריקות |
DeviceNotAvailableException |
|
getFoldableStates
public getFoldableStates ()
זריקות |
DeviceNotAvailableException |
|
getInstalledPackageNames
public getInstalledPackageNames ()
זריקות |
DeviceNotAvailableException |
|
getKeyguardState
public KeyguardControllerState getKeyguardState ()
החזרות |
KeyguardControllerState |
|
זריקות |
DeviceNotAvailableException |
|
getMainlineModuleInfo
public getMainlineModuleInfo ()
זריקות |
DeviceNotAvailableException |
|
public int getMaxNumberOfRunningUsersSupported ()
זריקות |
DeviceNotAvailableException |
|
public int getMaxNumberOfUsersSupported ()
זריקות |
DeviceNotAvailableException |
|
getPrimaryUserId
public Integer getPrimaryUserId ()
זריקות |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot ()
זריקות |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot (String format,
boolean rescale)
פרמטרים |
format |
String |
rescale |
boolean |
זריקות |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot (String format)
זריקות |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot (long displayId)
זריקות |
DeviceNotAvailableException |
|
getSetting
public String getSetting (String namespace,
String key)
פרמטרים |
namespace |
String |
key |
String |
זריקות |
DeviceNotAvailableException |
|
getSetting
public String getSetting (int userId,
String namespace,
String key)
פרמטרים |
userId |
int |
namespace |
String |
key |
String |
זריקות |
DeviceNotAvailableException |
|
getUninstallablePackageNames
public getUninstallablePackageNames ()
זריקות |
DeviceNotAvailableException |
|
getUserFlags
public int getUserFlags (int userId)
זריקות |
DeviceNotAvailableException |
|
getUserInfos
public getUserInfos ()
זריקות |
DeviceNotAvailableException |
|
getUserSerialNumber
public int getUserSerialNumber (int userId)
זריקות |
DeviceNotAvailableException |
|
hasFeature
public boolean hasFeature (String feature)
זריקות |
DeviceNotAvailableException |
|
installPackage
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
פרמטרים |
packageFile |
File |
reinstall |
boolean |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
installPackage
public String installPackage (File packageFile,
File certFile,
boolean reinstall,
String... extraArgs)
פרמטרים |
packageFile |
File |
certFile |
File |
reinstall |
boolean |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
installPackage
public String installPackage (File packageFile,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
פרמטרים |
packageFile |
File |
reinstall |
boolean |
grantPermissions |
boolean |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
פרמטרים |
packageFile |
File |
reinstall |
boolean |
grantPermissions |
boolean |
userId |
int |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
פרמטרים |
packageFile |
File |
reinstall |
boolean |
userId |
int |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
פרמטרים |
packageFiles |
|
reinstall |
boolean |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
פרמטרים |
packageFiles |
|
reinstall |
boolean |
grantPermissions |
boolean |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
installPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
פרמטרים |
packageFiles |
|
reinstall |
boolean |
grantPermissions |
boolean |
userId |
int |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
installPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
פרמטרים |
packageFiles |
|
reinstall |
boolean |
userId |
int |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
פרמטרים |
remoteApkPaths |
|
reinstall |
boolean |
grantPermissions |
boolean |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
String... extraArgs)
פרמטרים |
remoteApkPaths |
|
reinstall |
boolean |
extraArgs |
String |
זריקות |
DeviceNotAvailableException |
|
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
זריקות |
DeviceNotAvailableException |
|
isMultiUserSupported
public boolean isMultiUserSupported ()
זריקות |
DeviceNotAvailableException |
|
isPackageInstalled
public boolean isPackageInstalled (String packageName)
פרמטרים |
packageName |
String |
זריקות |
DeviceNotAvailableException |
|
isPackageInstalled
public boolean isPackageInstalled (String packageName,
String userId)
פרמטרים |
packageName |
String |
userId |
String |
זריקות |
DeviceNotAvailableException |
|
isUserRunning
public boolean isUserRunning (int userId)
זריקות |
DeviceNotAvailableException |
|
isUserSecondary
public boolean isUserSecondary (int userId)
זריקות |
DeviceNotAvailableException |
|
listDisplayIds
public listDisplayIds ()
זריקות |
DeviceNotAvailableException |
|
listUsers
public listUsers ()
זריקות |
DeviceNotAvailableException |
|
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
פרמטרים |
exception |
Throwable |
removeAdmin
public boolean removeAdmin (String componentName,
int userId)
פרמטרים |
componentName |
String |
userId |
int |
זריקות |
DeviceNotAvailableException |
|
removeOwners
public void removeOwners ()
זריקות |
DeviceNotAvailableException |
|
removeUser
public boolean removeUser (int userId)
זריקות |
DeviceNotAvailableException |
|
setDeviceOwner
public boolean setDeviceOwner (String componentName,
int userId)
פרמטרים |
componentName |
String |
userId |
int |
זריקות |
DeviceNotAvailableException |
|
setSetting
public void setSetting (String namespace,
String key,
String value)
פרמטרים |
namespace |
String |
key |
String |
value |
String |
זריקות |
DeviceNotAvailableException |
|
setSetting
public void setSetting (int userId,
String namespace,
String key,
String value)
פרמטרים |
userId |
int |
namespace |
String |
key |
String |
value |
String |
זריקות |
DeviceNotAvailableException |
|
startUser
public boolean startUser (int userId)
זריקות |
DeviceNotAvailableException |
|
startUser
public boolean startUser (int userId,
boolean waitFlag)
פרמטרים |
userId |
int |
waitFlag |
boolean |
זריקות |
DeviceNotAvailableException |
|
stopUser
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
פרמטרים |
userId |
int |
waitFlag |
boolean |
forceFlag |
boolean |
זריקות |
DeviceNotAvailableException |
|
stopUser
public boolean stopUser (int userId)
זריקות |
DeviceNotAvailableException |
|
switchUser
public boolean switchUser (int userId)
זריקות |
DeviceNotAvailableException |
|
switchUser
public boolean switchUser (int userId,
long timeout)
פרמטרים |
userId |
int |
timeout |
long |
זריקות |
DeviceNotAvailableException |
|
uninstallPackage
public String uninstallPackage (String packageName)
פרמטרים |
packageName |
String |
זריקות |
DeviceNotAvailableException |
|
uninstallPackageForUser
public String uninstallPackageForUser (String packageName,
int userId)
פרמטרים |
packageName |
String |
userId |
int |
זריקות |
DeviceNotAvailableException |
|
שיטות מוגנות
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode,
String reason)
מבצעים הפעלה מחדש של adb.
פרמטרים |
rebootMode |
NativeDevice.RebootMode : מצב ההפעלה מחדש. |
reason |
String : להפעלה מחדש הזו. |
זריקות |
DeviceNotAvailableException |
|
getCheckNewUserSleep
protected long getCheckNewUserSleep ()
חשוף לבדיקה.
getHostCurrentTime
protected long getHostCurrentTime ()
חשיפה לצורך בדיקה
prePostBootSetup
protected void prePostBootSetup ()
מאפשר לכל סוג מכשיר (AndroidNativeDevice, TestDevice) לשנות את השיטה הזו להגדרה ספציפית לאחר האתחול.
זריקות |
DeviceNotAvailableException |
|
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-03-26 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-03-26 (שעון UTC)."],[],[]]