اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
TestDevice
public
class
TestDevice
extends NativeDevice
الفئات الفرعية المباشرة المعروفة
|
الفئات الفرعية غير المباشرة المعروفة
|
تنفيذ ITestDevice
لجهاز Android مزوّد بمجموعة كاملة من الأدوات
ملخّص
الحقول |
public
static
final
String |
DISMISS_KEYGUARD_CMD
الأوامر التي يمكن استخدامها لإغلاق شاشة القفل
|
الطرق العامة |
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)
المعلمات |
namespace |
String |
عمليات الرمي |
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 ()
المرتجعات |
InputStreamSource |
|
عمليات الرمي |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot (String format,
boolean rescale)
المعلمات |
format |
String |
rescale |
boolean |
المرتجعات |
InputStreamSource |
|
عمليات الرمي |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot (String format)
المرتجعات |
InputStreamSource |
|
عمليات الرمي |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot (long displayId)
المرتجعات |
InputStreamSource |
|
عمليات الرمي |
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 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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 (حسب التوقيت العالمي المتفَّق عليه)"],[],[]]