NativeDevice

public class NativeDevice
extends Object implements IManagedTestDevice , IConfigurationReceiver , ITestLoggerReceiver

java.lang.object
com.android.tradefed.device.NativeDevice


اجرای پیش‌فرض دستگاه‌های اندرویدی ITestDevice بدون پشته.

خلاصه

کلاس های تو در تو

class NativeDevice.AdbAction

یک ERROR(DeviceAction/com.android.tradefed.device.NativeDevice.DeviceAction DeviceAction) برای اجرای دستور «adb ....» سیستم عامل.

class NativeDevice.AdbShellAction

class NativeDevice.RebootDeviceAction

ERROR(DeviceAction/com.android.tradefed.device.NativeDevice.DeviceAction DeviceAction) برای راه اندازی مجدد دستگاه.

ثابت ها

int INVALID_USER_ID

مقدار بازگشتی برای هر شناسه کاربری نامعتبر/یافتنی: UserHandle مقدار -10000 را تعریف کرد

long MAX_HOST_DEVICE_TIME_OFFSET

int MAX_RETRY_ATTEMPTS

تعداد پیش فرض دستور سعی مجدد برای انجام

زمینه های

protected static final String SD_CARD

protected static final String STORAGE_EMULATED

protected TestDeviceOptions mOptions

protected final IDeviceStateMonitor mStateMonitor

سازندگان عمومی

NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

یک TestDevice ایجاد می کند.

روش های عمومی

boolean canSwitchToHeadlessSystemUser ()

برمی‌گرداند که آیا مجاز است به کاربر SYSTEM بدون سر تغییر کند یا خیر.

boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

بررسی کنید که آیا یک ویژگی در حال حاضر با حداقل پشتیبانی پشتیبانی می شود یا خیر.

boolean checkConnectivity ()

بررسی کنید که دستگاه اتصال شبکه دارد.

boolean clearErrorDialogs ()

سعی کنید هر گفتگوی خطای نمایش داده شده در رابط کاربری دستگاه را رد کنید.

void clearLastConnectedWifiNetwork ()

آخرین شبکه وای فای متصل را پاک می کند.

void clearLogcat ()

تمام داده های logcat انباشته شده را حذف می کند.

boolean connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid)

به شبکه وای فای متصل می شود.

boolean connectToWifiNetwork (String wifiSsid, String wifiPsk)

به شبکه وای فای متصل می شود.

boolean connectToWifiNetwork ( wifiSsidToPsk) connectToWifiNetwork ( wifiSsidToPsk)

به شبکه وای فای متصل می شود.f

boolean connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid)

به شبکه وای فای متصل می شود.

boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid)

گونه ای از connectToWifiNetwork(String, String) که فقط در صورتی متصل می شود که دستگاه در حال حاضر اتصال شبکه نداشته باشد.

boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk)

گونه ای از connectToWifiNetwork(String, String) که فقط در صورتی متصل می شود که دستگاه در حال حاضر اتصال شبکه نداشته باشد.

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

یک کاربر با نام مشخص و پرچم های ارائه شده ایجاد کنید

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

یک کاربر با نام مشخص و پرچم های ارائه شده ایجاد کنید

int createUser (String name)

یک کاربر با نام مشخص و پرچم های پیش فرض 0 ایجاد کنید.

int createUserNoThrow (String name)

یک کاربر با نام مشخص و پرچم های پیش فرض 0 ایجاد کنید.

void deleteFile (String deviceFilePath)

روش کمکی برای حذف یک فایل یا دایرکتوری در دستگاه.

void deregisterDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver)

IDeviceActionReceiver ثبت شده را حذف می کند.

boolean deviceSoftRestarted ( ProcessInfo prevSystemServerProcess)

روش کمکی برای بررسی اینکه آیا دستگاه با مقایسه system_server فعلی با system_server ProcessInfo قبلی، نرم‌افزار راه‌اندازی شده است یا خیر.

boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)

روش کمکی برای بررسی اینکه آیا دستگاه از زمان UTC از دوره زمانی از دستگاه و ERROR(/TimeUnit) نرم‌افزار راه‌اندازی شده است یا خیر.

boolean disableAdbRoot ()

ریشه adb را خاموش می کند.

void disableKeyguard ()

تلاش برای غیرفعال کردن محافظ صفحه کلید.

boolean disableNetworkMonitor ()

مانیتورینگ شبکه را در دستگاه غیرفعال می کند.

boolean disconnectFromWifi ()

از شبکه وای فای قطع می شود.

boolean doesFileExist (String deviceFilePath, int userId)

روش کمکی برای تعیین اینکه آیا فایل روی دستگاه برای یک کاربر خاص وجود دارد یا خیر.

boolean doesFileExist (String deviceFilePath)

روش کمکی برای تعیین وجود فایل روی دستگاه.

File dumpHeap (String process, String devicePath)

سعی کنید پشته را از system_server تخلیه کنید.

boolean enableAdbRoot ()

ریشه adb را روشن می کند.

boolean enableNetworkMonitor ()

نظارت بر شبکه را بر روی دستگاه فعال می کند.

String executeAdbCommand (long timeout, String... cmdArgs)

متد Helper که یک دستور adb را به عنوان یک فرمان سیستم با یک بازه زمانی مشخص اجرا می کند.

String executeAdbCommand (long timeout, envMap, String... cmdArgs) executeAdbCommand (long timeout, envMap, String... cmdArgs)

متد Helper که یک دستور adb را به عنوان یک فرمان سیستم با یک بازه زمانی مشخص اجرا می کند.

String executeAdbCommand (String... cmdArgs)

متد Helper که دستور adb را به عنوان دستور سیستم اجرا می کند.

CommandResult executeFastbootCommand (String... cmdArgs)

روش Helper که یک فرمان fastboot را به عنوان یک فرمان سیستم با زمان پیش فرض 2 دقیقه اجرا می کند.

CommandResult executeFastbootCommand (long timeout, String... cmdArgs)

متد Helper که دستور fastboot را به عنوان دستور سیستم اجرا می کند.

CommandResult executeLongFastbootCommand (String... cmdArgs)

متد Helper که یک فرمان طولانی در حال اجرا fastboot را به عنوان فرمان سیستم اجرا می کند.

CommandResult executeLongFastbootCommand ( envVarMap, String... cmdArgs) executeLongFastbootCommand ( envVarMap, String... cmdArgs)

روش کمکی که یک فرمان طولانی در حال اجرا سریع بوت را به عنوان فرمان سیستم با متغیرهای محیط سیستم اجرا می کند.

String executeShellCommand (String command)

متد Helper که یک دستور adb shell را اجرا می کند و خروجی را به صورت ERROR(/String) برمی گرداند.

void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

یک فرمان پوسته adb را با پارامترهای بیشتری برای کنترل رفتار فرمان اجرا می کند.

void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

یک فرمان پوسته adb را با پارامترهای بیشتری برای کنترل رفتار فرمان اجرا می کند.

void executeShellCommand (String command, IShellOutputReceiver receiver)

دستور adb shell داده شده را اجرا می کند و در صورت شکست دستور چندین بار دوباره امتحان می کند.

CommandResult executeShellV2Command (String cmd)

متد Helper که یک دستور adb shell را اجرا می کند و نتایج را به صورت CommandResult با خروجی وضعیت فرمان، stdout و stderr به درستی پر می کند.

CommandResult executeShellV2Command (String cmd, OutputStream pipeToOutput)

متد Helper که یک دستور adb shell را اجرا می کند و نتایج را به صورت CommandResult که به درستی با خروجی وضعیت فرمان و stderr پر شده است برمی گرداند.

CommandResult executeShellV2Command (String cmd, File pipeAsInput)

متد Helper که یک دستور adb shell را اجرا می کند و نتایج را به صورت CommandResult با خروجی وضعیت فرمان، stdout و stderr به درستی پر می کند.

CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

یک فرمان پوسته adb را با پارامترهای بیشتری برای کنترل رفتار فرمان اجرا می کند.

CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit)

یک فرمان پوسته adb را با پارامترهای بیشتری برای کنترل رفتار فرمان اجرا می کند.

CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

یک فرمان پوسته adb را با پارامترهای بیشتری برای کنترل رفتار فرمان اجرا می کند.

CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

یک فرمان پوسته adb را با پارامترهای بیشتری برای کنترل رفتار فرمان اجرا می کند.

CommandResult fastbootWipePartition (String partition)

روش کمکی که یک پارتیشن را برای دستگاه پاک می کند.

getActiveApexes ()

اطلاعات مربوط به APEX های فعال شده در دستگاه را واکشی کنید.

getAllSettings (String namespace)

جفت مقدار کلید فضای نام درخواستی را برگردانید.

DeviceAllocationState getAllocationState ()

وضعیت تخصیص فعلی دستگاه را برگردانید

String getAndroidId (int userId)

شناسه android مرتبط با userId را پیدا کرده و برگردانید، در صورت یافت نشدن آن null.

getAndroidIds ()

یک نقشه از شناسه های اندرویدی که با شناسه های کاربر منطبق پیدا شده اند ایجاد کنید.

int getApiLevel ()

سطح API دستگاه را دریافت کنید.

PackageInfo getAppPackageInfo (String packageName)

اطلاعات مربوط به بسته نصب شده روی دستگاه را واکشی کنید.

getAppPackageInfos ()

اطلاعات بسته های نصب شده روی دستگاه را واکشی کنید.

String getBasebandVersion ()

روش آسان برای دریافت نسخه بیس باند (رادیویی) این دستگاه.

Integer getBattery ()

سطح فعلی باتری یک دستگاه را برمی‌گرداند یا اگر سطح باتری در دسترس نباشد، Null را برمی‌گرداند.

boolean getBooleanProperty (String name, boolean defaultValue)

مقدار بولی ویژگی داده شده را برمی گرداند.

getBootHistory ()

روش Helper نقشه تاریخچه بوت را با زمان بوت و دلیل بوت جمع آوری می کند.

getBootHistorySince (long utcEpochTime, TimeUnit timeUnit)

روش Helper نقشه تاریخچه راه‌اندازی را با زمان بوت و دلیل راه‌اندازی از زمان معین از دوره زمانی از دستگاه و واحد زمانی مشخص شده جمع‌آوری می‌کند.

String getBootloaderVersion ()

روش راحت برای دریافت نسخه بوت لودر این دستگاه.

InputStreamSource getBugreport ()

گزارش اشکال را از دستگاه بازیابی می کند.

InputStreamSource getBugreportz ()

یک bugreportz را از دستگاه بازیابی می کند.

String getBuildAlias ()

نام مستعار بیلدی که دستگاه در حال حاضر در حال اجرا است را بازیابی کنید.

String getBuildFlavor ()

طعم ساخت دستگاه را بازیابی کنید.

String getBuildId ()

بیلدی که دستگاه در حال اجرا است را بازیابی کنید.

String getBuildSigningKeys ()

نوع کلید مورد استفاده برای امضای تصویر دستگاه را برمی‌گرداند

معمولاً دستگاه‌های Android ممکن است با کلیدهای آزمایشی (مانند AOSP) یا کلیدهای انتشار (که توسط سازنده‌های دستگاه کنترل می‌شوند) امضا شوند.

DeviceDescriptor getCachedDeviceDescriptor ()

اگر دستگاه اختصاص داده شده باشد، DeviceDescriptor ذخیره شده را برمی‌گرداند، در غیر این صورت DeviceDescriptor فعلی را برمی‌گرداند.

DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

اگر دستگاه اختصاص داده شده باشد، DeviceDescriptor ذخیره شده را برمی‌گرداند، در غیر این صورت DeviceDescriptor فعلی را برمی‌گرداند.

String[] getChildren (String path)

جایگزینی برای استفاده از IFileEntry که گاهی اوقات به دلیل مجوزها کار نمی کند.

AbstractConnection getConnection ()

اتصال فعلی مرتبط با دستگاه.

DeviceFoldableState getCurrentFoldableState ()

وضعیت تاشو فعلی دستگاه را برمی‌گرداند یا در صورت بروز برخی مشکلات، آن را خالی می‌کند.

int getCurrentUser ()

شناسه کاربر فعلی را برگردانید.

String getDeviceClass ()

کلاس دستگاه را دریافت کنید.

long getDeviceDate ()

تاریخ دستگاه را بر حسب میلی‌ثانیه از آن دوره برگردانید.

DeviceDescriptor getDeviceDescriptor ()

یک DeviceDescriptor را از اطلاعات دستگاه برگردانید تا اطلاعات مربوط به آن را بدون عبور از شی دستگاه واقعی دریافت کنید.

DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

یک DeviceDescriptor را از اطلاعات دستگاه برگردانید تا اطلاعات مربوط به آن را بدون عبور از شی دستگاه واقعی دریافت کنید.

TestDeviceState getDeviceState ()

وضعیت دستگاه را دریافت کنید.

long getDeviceTimeOffset (Date date)

کمک کننده برای دریافت تفاوت زمانی بین دستگاه و یک ERROR(/Date) داده شده.

InputStreamSource getEmulatorOutput ()

جریان شبیه ساز stdout و stderr را دریافت کنید

Process getEmulatorProcess ()

ERROR(/Process) مربوط به این شبیه ساز را برگردانید.

final File getExecuteShellCommandLog ()

گزارشی که شامل تمام گزارش‌های executeShellCommand(String) است.

long getExternalStoreFreeSpace ()

روش کمکی برای تعیین میزان فضای خالی در حافظه خارجی دستگاه.

String getFastbootPath ()

مسیر باینری fastboot مورد استفاده را برمی گرداند.

String getFastbootProductType ()

روشی راحت برای دریافت نوع محصول این دستگاه در حالت فست بوت.

String getFastbootProductVariant ()

روشی راحت برای دریافت نوع محصول این دستگاه در حالت فست بوت.

String getFastbootSerialNumber ()

شماره سریال حالت فست بوت را برمی گرداند.

String getFastbootVariable (String variableName)

مقدار متغیر fastboot داده شده را از دستگاه بازیابی کنید.

String getFastbootVersion ()

رشته نسخه باینری fastboot مورد استفاده را برمی گرداند.

IFileEntry getFileEntry (String path)

یک مرجع به یک فایل راه دور در دستگاه را بازیابی کنید.

IFileEntry getFileEntry (FileListingService.FileEntry entry)

کمک کننده غیر رسمی برای دریافت FileEntry از مسیر غیر ریشه.

getFoldableStates ()

لیست حالت های تاشو را در دستگاه برمی گرداند.

IDevice getIDevice ()

یک ارجاع به IDevice ddmlib مرتبط را برمی‌گرداند.

getInstalledPackageNames ()

نام بسته های برنامه موجود در دستگاه را واکشی کنید.

long getIntProperty (String name, long defaultValue)

مقدار صحیح ویژگی داده شده را از دستگاه برمی‌گرداند.

String getIpAddress ()

آدرس IP دستگاه را دریافت می کند.

KeyguardControllerState getKeyguardState ()

یک شی را برگردانید تا وضعیت فعلی صفحه کلید را دریافت کنید یا در صورت عدم پشتیبانی، null را دریافت کنید.

long getLastExpectedRebootTimeMillis ()

آخرین باری را که APIهای Tradefed راه‌اندازی مجدد را در میلی‌ثانیه از زمان EPOCH راه‌اندازی کردند، برمی‌گرداند که توسط ERROR(/System#currentTimeMillis()) برمی‌گردد.

int getLaunchApiLevel ()

اولین سطح API راه اندازی شده دستگاه را دریافت کنید.

InputStreamSource getLogcat ()

یک جریان عکس فوری از داده های logcat را می گیرد.

InputStreamSource getLogcat (int maxBytes)

یک جریان عکس فوری از آخرین maxBytes داده logcat گرفته شده را می گیرد.

InputStreamSource getLogcatDump ()

یک روگرفت از logcat فعلی برای دستگاه دریافت کنید.

InputStreamSource getLogcatSince (long date)

یک جریان عکس فوری از داده‌های logcat گرفته شده را با شروع تاریخ ارائه شده می‌گیرد.

String getMacAddress ()

آدرس MAC دستگاه را برمی‌گرداند، در صورت عدم درخواست از دستگاه، باطل می‌شود.

Integer getMainUserId ()

شناسه اصلی کاربر را برمی گرداند.

getMainlineModuleInfo ()

اطلاعات مربوط به ماژول های خط اصلی نصب شده روی دستگاه را دریافت کنید.

int getMaxNumberOfRunningUsersSupported ()

حداکثر تعداد کاربرانی که به طور همزمان در حال اجرا هستند را دریافت کنید.

int getMaxNumberOfUsersSupported ()

حداکثر تعداد کاربران پشتیبانی شده را دریافت کنید.

Process getMicrodroidProcess ()
IDeviceStateMonitor getMonitor ()

IDeviceStateMonitor مرتبط با دستگاه را برگردانید.

String getMountPoint (String mountName)

نقطه اتصال را برمی‌گرداند.

ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

MountPointInfo مربوط به مسیر mountpoint مشخص شده را برمی‌گرداند، یا اگر آن مسیر چیزی نصب نشده باشد یا به‌طور دیگری در /proc/mounts به‌عنوان یک نقطه mount ظاهر نشود، null برمی‌گرداند.

getMountPointInfo ()

یک نسخه تجزیه شده از اطلاعات موجود در /proc/mounts در دستگاه را برمی گرداند

TestDeviceOptions getOptions ()

گزینه های تست دستگاه را واکشی کنید.

long getPartitionFreeSpace (String partition)

روش کمکی برای تعیین مقدار فضای خالی در پارتیشن دستگاه.

Integer getPrimaryUserId ()

شناسه کاربر اصلی را برمی گرداند.

ProcessInfo getProcessByName (String processName)

متد Helper دستور "pidof" و "stat" را اجرا می کند و شی ProcessInfo را با PID و زمان شروع فرآیند پردازش داده شده برمی گرداند.

String getProcessPid (String process)

اگر مشکلی پیش آمده باشد، پید سرویس را برمی‌گرداند یا نول می‌کند.

String getProductType ()

روش راحت برای دریافت نوع محصول این دستگاه.

String getProductVariant ()

روش راحت برای دریافت نوع محصول این دستگاه.

String getProperty (String name)

مقدار مشخصه داده شده را از دستگاه بازیابی کنید.

ITestDevice.RecoveryMode getRecoveryMode ()

حالت بازیابی فعلی مورد استفاده برای دستگاه را دریافت کنید.

InputStreamSource getScreenshot (String format)

یک اسکرین شات از دستگاه می گیرد.

InputStreamSource getScreenshot (long displayId)

یک اسکرین شات از دستگاهی که شناسه نمایش داده شده را می گیرد.

InputStreamSource getScreenshot (String format, boolean rescale)

یک اسکرین شات از دستگاه می گیرد.

InputStreamSource getScreenshot ()

یک اسکرین شات از دستگاه می گیرد.

String getSerialNumber ()

روش آسان برای دریافت شماره سریال این دستگاه.

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

مقدار تنظیمات درخواستی را برگردانید.

String getSetting (String namespace, String key)

getSetting(int, String, String) را ببینید و روی کاربر سیستم انجام شود.

String getSimOperator ()

اپراتور سیم کارت را برگردانید یا اگر در دسترس نیست یا دستگاه در دسترس نیست، آن را خالی کنید.

String getSimState ()

وضعیت سیم کارت را برگردانید یا اگر در دسترس نیست یا دستگاه در دسترس نیست، آن را خالی کنید.

getTombstones ()

لیست سنگ قبرها را از دستگاه ها واکشی و برگردانید.

long getTotalMemory ()

حجم کل حافظه فیزیکی را بر حسب بایت یا -1 را در صورت خطای داخلی برمی گرداند

getUninstallablePackageNames ()

نام بسته های برنامه را که می توان حذف نصب کرد واکشی کنید.

boolean getUseFastbootErase ()

برای پاک کردن پارتیشن روی دستگاه از فرمت fastboot erase یا fastboot استفاده کنید.

int getUserFlags (int userId)

پرچم های یک کاربر معین را پیدا کرده و برگردانید.

getUserInfos ()

نقشه useId به UserInfo را در دستگاه دریافت می کند.

int getUserSerialNumber (int userId)

در صورت یافتن شماره سریال مرتبط به userId، در هر مورد دیگر -10000 را برگردانید.

IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

DeviceEvent داده شده را پردازش کنید.

DeviceEvent را پردازش کنید، که ممکن است این دستگاه را به وضعیت تخصیص جدید منتقل کند یا نکند.

boolean hasFeature (String feature)

بررسی کنید که آیا یک ویژگی در دستگاه موجود است یا خیر.

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

بسته اندروید را روی دستگاه نصب کنید.

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

بسته اندروید را روی دستگاه نصب کنید.

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

یک بسته اندرویدی را برای یک کاربر خاص روی دستگاه نصب کنید.

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

یک بسته اندرویدی را برای یک کاربر خاص روی دستگاه نصب کنید.

boolean isAdbRoot ()

boolean isAdbTcp ()
boolean isAppEnumerationSupported ()

بررسی کنید که آیا پلتفرم روی دستگاه از شمارش برنامه پشتیبانی می‌کند یا خیر

boolean isBypassLowTargetSdkBlockSupported ()

بررسی کنید که آیا پلتفرم روی دستگاه از دور زدن بلوک sdk هدف پایین در نصب برنامه پشتیبانی می‌کند یا خیر

boolean isDeviceEncrypted ()

اگر دستگاه رمزگذاری شده باشد برمی گردد.

boolean isDirectory (String path)

اگر مسیر روی دستگاه یک دایرکتوری است، True را برگردانید، در غیر این صورت false.

boolean isEnableAdbRoot ()
boolean isEncryptionSupported ()

اگر رمزگذاری در دستگاه پشتیبانی شود، برمی‌گردد.

boolean isExecutable (String fullPath)

اگر مسیر فایل روی دستگاه یک فایل اجرایی باشد، True را برمی‌گرداند، در غیر این صورت false است.

boolean isFastbootEnabled ()

اگر فست بوت برای دستگاه موجود است، برگردید.

boolean isHeadless ()

اگر دستگاه بدون هد است (بدون صفحه) true را برگردانید، در غیر این صورت false.

boolean isHeadlessSystemUserMode ()

نشان می دهد که آیا دستگاه از حالت کاربر سیستم بدون سر استفاده می کند یا خیر.

boolean isMainUserPermanentAdmin ()

نشان می دهد که آیا کاربر اصلی یک سرپرست دائمی است و نمی توان آن را حذف کرد یا به وضعیت غیر سرپرست تنزل داد.

boolean isMultiUserSupported ()

تعیین می کند که آیا چند کاربر پشتیبانی می شود یا خیر.

boolean isPackageInstalled (String packageName, String userId)

دستگاه را برای نام بسته معین و شناسه کاربری داده شده جستجو کنید تا بررسی کنید که آیا در حال حاضر برای آن کاربر نصب شده است یا خیر.

boolean isPackageInstalled (String packageName)

دستگاه را برای یک نام بسته جستجو کنید تا بررسی کنید که آیا در حال حاضر نصب شده است یا خیر.

boolean isRuntimePermissionSupported ()

بررسی کنید که آیا پلتفرم روی دستگاه از اعطای مجوز زمان اجرا پشتیبانی می کند یا خیر

boolean isStateBootloaderOrFastbootd ()

اگر دستگاه در TestDeviceState#FASTBOOT یا TestDeviceState.FASTBOOTD باشد، درست برمی‌گردد.

boolean isUserRunning (int userId)

بررسی کنید که آیا یک کاربر مشخص در حال اجرا است یا خیر.

boolean isUserSecondary (int userId)

آیا کاربر مشخص شده با توجه به پرچم های آن کاربر ثانویه است یا خیر.

boolean isUserVisible (int userId)

بررسی می کند که آیا کاربر داده شده قابل مشاهده است یا خیر.

boolean isUserVisibleOnDisplay (int userId, int displayId)

بررسی می کند که آیا کاربر داده شده در صفحه نمایش داده شده قابل مشاهده است یا خیر.

boolean isVisibleBackgroundUsersOnDefaultDisplaySupported ()

نشان می‌دهد که آیا دستگاه به کاربران اجازه می‌دهد در پس‌زمینه در ERROR(/java.android.view.Display#DEFAULT_DISPLAY) قابل مشاهده باشند یا خیر.

boolean isVisibleBackgroundUsersSupported ()

نشان می دهد که آیا دستگاه به کاربران اجازه می دهد در پس زمینه قابل مشاهده باشند یا خیر.

boolean isWifiEnabled ()

تست کنید آیا وای فای فعال است یا خیر.

listDisplayIds ()

لیستی از شناسه نمایشگرهای موجود در دستگاه را که توسط "dumpsys SurfaceFlinger" گزارش شده است، جمع آوری کنید.

listDisplayIdsForStartingVisibleBackgroundUsers ()

لیستی از نمایشگرهایی را دریافت می کند که می توانند برای start a user visible in the background استفاده شوند.

listUsers ()

لیست کاربران دستگاه را دریافت می کند.

boolean logAnrs ( ITestLogger logger)

ANR ها را از دستگاه جمع آوری و ثبت می کند.

boolean logBugreport (String dataName, ITestLogger listener)

روش کمکی برای گرفتن گزارش اشکال و ورود آن به خبرنگاران.

void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)

یک پیام را در logcat دستگاه ثبت کنید.

void nonBlockingReboot ()

دستوری را برای راه اندازی مجدد دستگاه صادر می کند و با فرمان کامل و زمانی که دستگاه دیگر برای adb قابل مشاهده نیست، برمی گردد.

void postAdbRootAction ()

اگر دستگاه نیاز به انجام برخی اقدامات خاص بعد از ریشه adb و قبل از اینکه دستگاه دوباره آنلاین شود، لغو شود.

void postAdbUnrootAction ()

اگر دستگاه نیاز به انجام برخی اقدامات خاص پس از unroot adb و قبل از اینکه دستگاه دوباره آنلاین شود، لغو شود.

void postBootSetup ()

دستورالعمل‌هایی را برای پیکربندی دستگاه برای آزمایش آن پس از هر بار بوت انجام دهید.

void postInvocationTearDown (Throwable exception)

مراحل اضافی برای پاکسازی مورد نیاز خاص دستگاه که پس از انجام فراخوانی اجرا می شود.

void preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes)

مراحل اضافی برای تنظیم مورد نیاز خاص دستگاه که قبل از جریان فراخوانی روی دستگاه اجرا می شود.

boolean pullDir (String deviceFilePath, File localDir)

به صورت بازگشتی محتویات دایرکتوری را از دستگاه بکشید.

boolean pullFile (String remoteFilePath, File localFile)

یک فایل را از دستگاه بازیابی می کند.

File pullFile (String remoteFilePath, int userId)

یک فایل را از دستگاه بازیابی می کند، آن را در یک ERROR(/File) موقت محلی ذخیره می کند و آن File برمی گرداند.

File pullFile (String remoteFilePath)

یک فایل را از دستگاه بازیابی می کند، آن را در یک ERROR(/File) موقت محلی ذخیره می کند و آن File برمی گرداند.

boolean pullFile (String remoteFilePath, File localFile, int userId)

یک فایل را از دستگاه بازیابی می کند.

String pullFileContents (String remoteFilePath)

یک فایل را از دستگاه بازیابی می کند و محتویات را برمی گرداند.

File pullFileFromExternal (String remoteFilePath)

یک روش راحت برای بازیابی یک فایل از حافظه خارجی دستگاه، ذخیره آن در یک ERROR(/File) موقت محلی و بازگشت یک مرجع به آن File .

boolean pushDir (File localFileDir, String deviceFilePath, excludedDirectories) pushDir (File localFileDir, String deviceFilePath, excludedDirectories)

به صورت بازگشتی محتویات دایرکتوری را به دستگاه فشار دهید در حالی که برخی دایرکتوری ها را که فیلتر شده اند حذف کنید.

boolean pushDir (File localFileDir, String deviceFilePath)

به صورت بازگشتی محتویات دایرکتوری را به دستگاه فشار دهید.

boolean pushFile (File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded)

گونه ای از pushFile(File, String) که می تواند به صورت اختیاری ارزیابی نیاز به ارائه دهنده محتوا را در نظر بگیرد.

boolean pushFile (File localFile, String remoteFilePath)

یک فایل را به دستگاه فشار دهید.

boolean pushString (String contents, String remoteFilePath)

فایل فشار ایجاد شده از رشته ای به دستگاه

void reboot (String reason)

دستگاه را به حالت adb راه‌اندازی مجدد می‌کند و reason مشخصی برای ادامه راه‌اندازی مجدد دارد.

void reboot ()

دستگاه را به حالت adb راه اندازی مجدد می کند.

void rebootIntoBootloader ()

دستگاه را به حالت بوت لودر راه اندازی مجدد می کند.

void rebootIntoFastbootd ()

دستگاه را در حالت فست بوت مجدد راه اندازی می کند.

void rebootIntoRecovery ()

دستگاه را به حالت بازیابی adb راه اندازی مجدد می کند.

void rebootIntoSideload ()

دستگاه را به حالت adb sideload مجدد راه اندازی می کند (توجه داشته باشید که این یک حالت ویژه در حال بازیابی است)

مسدود می شود تا زمانی که دستگاه وارد حالت بار جانبی شود

void rebootIntoSideload (boolean autoReboot)

دستگاه را به حالت adb sideload مجدد راه اندازی می کند (توجه داشته باشید که این یک حالت ویژه در حال بازیابی است)

مسدود می شود تا زمانی که دستگاه وارد حالت بار جانبی شود

void rebootUntilOnline ()

جایگزینی برای reboot() که فقط تا زمانی که دستگاه آنلاین شود مسدود می شود، یعنی برای adb قابل مشاهده است.

void rebootUntilOnline (String reason)

جایگزینی برای reboot() که فقط تا زمانی که دستگاه آنلاین شود مسدود می شود، یعنی برای adb قابل مشاهده است.

void rebootUserspace ()

فقط قسمتی از دستگاه را در فضای کاربر راه اندازی مجدد می کند.

void rebootUserspaceUntilOnline ()

جایگزینی برای rebootUserspace() ()} که فقط تا زمانی که دستگاه آنلاین شود مسدود می شود، یعنی برای adb قابل مشاهده است.

boolean recoverDevice ()

تلاش برای بازیابی ارتباطات دستگاه

void registerDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver)

IDeviceActionReceiver را برای این دستگاه ثبت می کند.

void remountSystemWritable ()

پارتیشن سیستم روی دستگاه را قابل نوشتن کنید.

void remountVendorWritable ()

پارتیشن فروشنده روی دستگاه را قابل نوشتن کنید.

boolean removeAdmin (String componentName, int userId)

ادمین دستگاه داده شده را در کاربر مشخص حذف کنید و اگر موفقیت آمیز بود true برگردانید، در غیر این صورت false .

void removeOwners ()

همه دارندگان نمایه دستگاه موجود را با بهترین تلاش حذف کنید.

boolean removeUser (int userId)

یک کاربر معین را از دستگاه حذف کنید.

void resetContentProviderSetup ()

پرچم را برای راه اندازی ارائه دهنده محتوا بازنشانی کنید تا دوباره فعال شود.

boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)

روش آسان برای انجام ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) با یک یا چند شنونده به عنوان پارامتر ارسال شده است.

boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners)

تست های ابزار دقیق را اجرا می کند و بازیابی دستگاه را فراهم می کند.

boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners)

همانند ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) اما تست را اجرا می کند برای کاربر داده شده

boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)

مانند ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) اما آزمایش را برای یک کاربر مشخص اجرا می کند.

void setConfiguration ( IConfiguration configuration)

IConfiguration در حال استفاده را تزریق می کند.

void setDate (Date date)

تاریخ را روی دستگاه تنظیم می کند

توجه: تنظیم تاریخ در دستگاه نیاز به روت دارد

boolean setDeviceOwner (String componentName, int userId)

یک جزء سرپرست دستگاه را به عنوان مالک دستگاه در کاربر مشخص تنظیم کنید.

void setDeviceState ( TestDeviceState deviceState)

وضعیت دستگاه را به روز کنید.

void setEmulatorOutputStream ( SizeLimitedOutputStream output)

برای شبیه ساز SizeLimitedOutputStream را برای ورود به خروجی تنظیم کنید

void setEmulatorProcess (Process p)

ERROR(/Process) را زمانی که این دستگاه شبیه ساز است، تنظیم می کند.

void setFastbootEnabled (boolean fastbootEnabled)

گزینه fastboot را برای دستگاه تنظیم کنید.

void setFastbootPath (String fastbootPath)

مسیر باینری fastboot را که باید استفاده شود را تعیین می کند.

void setIDevice (IDevice newDevice)

IDevice مرتبط با این ITestDevice را به روز کنید.

void setLogStartDelay (int delay)

زمان انتظار را قبل از شروع ضبط logcat برای یک دستگاه آنلاین بر حسب میلی ثانیه تنظیم می کند.

void setOptions ( TestDeviceOptions options)

TestDeviceOptions را برای دستگاه تنظیم کنید

boolean setProperty (String propKey, String propValue)

مقدار ویژگی داده شده را روی دستگاه تنظیم می کند.

void setRecovery ( IDeviceRecovery recovery)

IDeviceRecovery را برای استفاده برای این دستگاه تنظیم کنید.

void setRecoveryMode ( ITestDevice.RecoveryMode mode)

حالت بازیابی فعلی را برای استفاده برای دستگاه تنظیم کنید.

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

به setSetting(int, String, String, String) مراجعه کنید و در کاربر سیستم انجام شد.

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

یک مقدار تنظیم به فضای نام یک کاربر معین اضافه کنید.

void setTestLogger ( ITestLogger testLogger)

نمونه ITestLogger تزریق می کند

void setUseFastbootErase (boolean useFastbootErase)

تنظیم کنید که برای پاک کردن یک پارتیشن روی دستگاه از فرمت fastboot erase یا fastboot استفاده شود.

void startLogcat ()

شروع به گرفتن خروجی logcat از دستگاه در پس زمینه کنید.

boolean startUser (int userId)

اگر کاربر در حال حاضر متوقف شده باشد، کاربر مشخصی را در پس‌زمینه راه‌اندازی می‌کند.

boolean startUser (int userId, boolean waitFlag)

اگر کاربر در حال حاضر متوقف شده باشد، کاربر مشخصی را در پس‌زمینه راه‌اندازی می‌کند.

boolean startVisibleBackgroundUser (int userId, int displayId, boolean waitFlag)

کاربر مشخصی را در پس‌زمینه شروع می‌کند که در صفحه نمایش داده شده قابل مشاهده است (یعنی به کاربر اجازه می‌دهد فعالیت‌ها را در آن نمایشگر راه‌اندازی کند).

void stopEmulatorOutput ()

خروجی شبیه ساز را ببندید و حذف کنید.

void stopLogcat ()

گرفتن خروجی logcat از دستگاه را متوقف کنید و داده های ذخیره شده logcat را دور بریزید.

boolean stopUser (int userId)

یک کاربر معین را متوقف می کند.

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

یک کاربر معین را متوقف کنید.

String switchToAdbTcp ()

دستگاه را به حالت adb-over-tcp تغییر دهید.

boolean switchToAdbUsb ()

دستگاه را به حالت adb از طریق usb تغییر دهید.

boolean switchUser (int userId)

به userId دیگری با مهلت زمانی پیش‌فرض تغییر وضعیت دهید.

boolean switchUser (int userId, long timeout)

به شناسه کاربری دیگری با مهلت زمانی ارائه شده به عنوان مهلت تغییر دهید.

boolean syncFiles (File localFileDir, String deviceFilePath)

به صورت تدریجی محتویات یک فهرست فایل محلی را با دستگاه همگام می کند.

Bugreport takeBugreport ()

یک Bugreport بگیرید و آن را در یک شی Bugreport برمی گرداند تا آن را مدیریت کند.

String uninstallPackage (String packageName)

یک بسته Android را از دستگاه حذف نصب کنید.

String uninstallPackageForUser (String packageName, int userId)

یک بسته Android را برای یک کاربر خاص از دستگاه حذف نصب کنید.

boolean unlockDevice ()

اگر دستگاه در حالت رمزگذاری شده باشد، قفل دستگاه را باز می کند.

boolean waitForBootComplete (long timeOut)

مسدود می شود تا زمانی که پرچم کامل بوت دستگاه تنظیم شود.

boolean waitForDeviceAvailable ()

منتظر می ماند تا دستگاه پاسخگو و برای آزمایش در دسترس باشد.

boolean waitForDeviceAvailable (long waitTime)

منتظر می ماند تا دستگاه پاسخگو و برای آزمایش در دسترس باشد.

boolean waitForDeviceAvailableInRecoverPath (long waitTime)

منتظر می ماند تا دستگاه بدون در نظر گرفتن مسیر بازیابی پاسخگو و در دسترس باشد.

void waitForDeviceBootloader ()

مسدود می شود تا زمانی که دستگاه از طریق فست بوت قابل مشاهده باشد.

boolean waitForDeviceInRecovery (long waitTime)

مسدود کردن دستگاه در حالت «بازیابی adb» (توجه داشته باشید که این با IDeviceRecovery متفاوت است).

boolean waitForDeviceInSideload (long waitTime)

مسدود کردن دستگاه در حالت "adb sideload".

boolean waitForDeviceNotAvailable (long waitTime)

بلوک‌هایی که دستگاه در دسترس نیست، یعنی از adb موجود نیست

void waitForDeviceOnline ()

مسدود می شود تا زمانی که دستگاه از طریق adb قابل مشاهده باشد.

void waitForDeviceOnline (long waitTime)

مسدود می شود تا زمانی که دستگاه از طریق adb قابل مشاهده باشد.

boolean waitForDeviceShell (long waitTime)

منتظر می ماند تا دستگاه به یک دستور اولیه پوسته adb پاسخ دهد.

روش های محافظت شده

String[] buildAdbShellCommand (String command, boolean forceExitStatusDetection)

دستور OS را برای جلسه دستور adb shell داده شده می سازد و args می کند

void checkApiLevelAgainst (String feature, int strictMinLevel)
NativeDevice.RebootDeviceAction createRebootDeviceAction ( NativeDevice.RebootMode rebootMode, String reason)

یک RebootDeviceAction ایجاد کنید تا در هنگام انجام یک عمل راه اندازی مجدد استفاده شود.

IRunUtil createRunUtil ()
void doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason)

یک راه اندازی مجدد adb انجام دهید.

void ensureRuntimePermissionSupported ()

روش کمکی برای پرتاب استثنا در صورت عدم پشتیبانی از مجوز زمان اجرا

int getApiLevelSafe ()
ITestLogger getLogger ()
IRunUtil getRunUtil ()

نمونه RunUtil را برای استفاده دریافت کنید.

void initializeConnection ( IBuildInfo info, MultiMap <String, String> attributes)
String internalGetProperty (String propName, String fastbootVar, String description)

یک ویژگی دستگاه را از کش ddmlib به طور پیش‌فرض واکشی کنید و بسته به اینکه دستگاه در Fastboot باشد یا خیر، به «adb shell getprop» یا «fastboot getvar» برگردید.

boolean isInRebootCallback ()

برمی‌گرداند که آیا فراخوان‌های راه‌اندازی مجدد در حال حاضر اجرا می‌شوند یا خیر.

boolean isNewer (File localFile, IFileEntry entry)

اگر فایل محلی جدیدتر از فایل راه دور باشد، true را برگردانید.

void notifyRebootEnded ()

به همه IDeviceActionReceiver درباره رویداد پایان راه‌اندازی مجدد اطلاع می‌دهد.

void notifyRebootStarted ()

همه IDeviceActionReceiver را در مورد رویداد شروع راه اندازی مجدد مطلع می کند.

boolean performDeviceAction (String actionDescription, NativeDevice.DeviceAction action, int retryAttempts)

عملی را در این دستگاه انجام می دهد.

void postAdbReboot ()

اقدامات اضافی احتمالی که می توان پس از راه اندازی مجدد انجام داد.

void prePostBootSetup ()

به هر نوع دستگاه (AndroidNativeDevice، TestDevice) اجازه می‌دهد این روش را برای راه‌اندازی خاص پس از بوت لغو کند.

boolean pullFileInternal (String remoteFilePath, File localFile)
void setClock (Clock clock)

نمونه ساعت را برای استفاده تنظیم کنید.

void setMicrodroidProcess (Process process)

TestDevice را به عنوان microdroid علامت گذاری کرده و CID آن را تنظیم می کند.

void setTestDeviceOptions ( deviceOptions) setTestDeviceOptions ( deviceOptions)
CommandResult simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd)

یک فرمان ساده fastboot را با متغیرهای محیطی اجرا می کند و وضعیت دستور را گزارش می دهد.

CommandResult simpleFastbootCommand (long timeout, String[] fullCmd)

یک فرمان ساده fastboot را اجرا می کند و وضعیت فرمان را گزارش می کند.

boolean waitForDeviceNotAvailable (String operationDesc, long time)

منتظر بمانید تا دستگاه در دسترس نباشد (گزارش به adb را متوقف کنید).

ثابت ها

INVALID_USER_ID

public static final int INVALID_USER_ID

مقدار بازگشتی برای هر شناسه کاربری نامعتبر/یافتنی: UserHandle مقدار -10000 را تعریف کرد

مقدار ثابت: -10000 (0xffffd8f0)

MAX_HOST_DEVICE_TIME_OFFSET

protected static final long MAX_HOST_DEVICE_TIME_OFFSET

مقدار ثابت: 5000 (0x0000000000001388)

MAX_RETRY_ATTEMPTS

protected static final int MAX_RETRY_ATTEMPTS

تعداد پیش فرض دستور سعی مجدد برای انجام

مقدار ثابت: 2 (0x00000002)

زمینه های

SD_CARD

protected static final String SD_CARD

STORAGE_EMULATED

protected static final String STORAGE_EMULATED

mOptions

protected TestDeviceOptions mOptions

mStateMonitor

protected final IDeviceStateMonitor mStateMonitor

سازندگان عمومی

NativeDevice

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

یک TestDevice ایجاد می کند.

مولفه های
device IDevice : IDevice مرتبط

stateMonitor IDeviceStateMonitor : مکانیسم IDeviceStateMonitor برای استفاده

allocationMonitor IDeviceMonitor : IDeviceMonitor برای اطلاع از تغییرات وضعیت تخصیص. می تواند پوچ باشد

روش های عمومی

canSwitchToHeadlessSystemUser

public boolean canSwitchToHeadlessSystemUser ()

برمی‌گرداند که آیا مجاز است به کاربر SYSTEM بدون سر تغییر کند یا خیر.

برمی گرداند
boolean

پرتاب می کند
DeviceNotAvailableException

checkApiLevelAgainstNextRelease

public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

بررسی کنید که آیا یک ویژگی در حال حاضر با حداقل پشتیبانی پشتیبانی می شود یا خیر. این روش قبل از اینکه سطح API افزایش یابد، ویژگی‌های منتشر نشده را در نظر می‌گیرد.

مولفه های
strictMinLevel int : حداقل حداقل سطح ممکن که از این ویژگی پشتیبانی می کند.

برمی گرداند
boolean اگر سطح پشتیبانی شود درست است. در غیر این صورت نادرست است.

پرتاب می کند
DeviceNotAvailableException

بررسی اتصال

public boolean checkConnectivity ()

بررسی کنید که دستگاه اتصال شبکه دارد.

برمی گرداند
boolean true اگر دستگاه اتصال شبکه کار می کند، false .

پرتاب می کند
DeviceNotAvailableException

clearErrorDialogs

public boolean clearErrorDialogs ()

سعی کنید هر گفتگوی خطای نمایش داده شده در رابط کاربری دستگاه را رد کنید.

برمی گرداند
boolean true اگر هیچ گفتگویی وجود نداشته باشد یا گفتگوها با موفقیت پاک شوند. false در غیر این صورت

پرتاب می کند
DeviceNotAvailableException

clearLastConnectedWifiNetwork

public void clearLastConnectedWifiNetwork ()

آخرین شبکه وای فای متصل را پاک می کند. این باید هنگام شروع فراخوانی جدید برای جلوگیری از اتصال به شبکه وای فای مورد استفاده در آزمایش قبلی پس از راه‌اندازی مجدد دستگاه خوانده شود.

clearLogcat

public void clearLogcat ()

تمام داده های logcat انباشته شده را حذف می کند.

این برای مواردی مفید است که می‌خواهید مطمئن شوید ITestDevice#getLogcat() فقط داده‌های گزارش تولید شده پس از یک نقطه خاص (مانند فلش کردن یک دستگاه جدید و غیره) را برمی‌گرداند.

اتصال به شبکه Wifi

public boolean connectToWifiNetwork ( wifiSsidToPsk, 
                boolean scanSsid)

به شبکه وای فای متصل می شود.

وای فای را روشن می کند و مسدود می کند تا زمانی که اتصال موفقیت آمیز با یکی از شبکه های وای فای ارائه شده در نقشه wifiSsidToPsk برقرار شود. هنگامی که یک اتصال برقرار شد، نمونه سعی می کند پس از هر بار راه اندازی مجدد، اتصال را بازیابی کند تا زمانی که ITestDevice#disconnectFromWifi() یا ITestDevice#clearLastConnectedWifiNetwork() فراخوانی شود.

مولفه های
wifiSsidToPsk : نقشه ای از SSID وای فای به گذرواژه ها.

scanSsid boolean : آیا باید SSIDهای مخفی این شبکه را اسکن کرد یا خیر.

برمی گرداند
boolean true اگر با موفقیت به شبکه وای فای متصل شوید. false در غیر این صورت

پرتاب می کند
DeviceNotAvailableException

اتصال به شبکه Wifi

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk)

به شبکه وای فای متصل می شود.

فای را روشن می کند و مسدود می کند تا زمانی که اتصال موفقیت آمیز به شبکه وای فای مشخص شده برقرار شود. هنگامی که یک اتصال برقرار شد، نمونه سعی می کند پس از هر بار راه اندازی مجدد، اتصال را بازیابی کند تا زمانی که ITestDevice#disconnectFromWifi() یا ITestDevice#clearLastConnectedWifiNetwork() فراخوانی شود.

مولفه های
wifiSsid String : وای فای ssid برای اتصال

wifiPsk String : عبارت عبور PSK یا اگر رمزگذاری نشده باشد، null است

برمی گرداند
boolean true اگر با موفقیت به شبکه وای فای متصل شوید. false در غیر این صورت

پرتاب می کند
DeviceNotAvailableException

اتصال به شبکه Wifi

public boolean connectToWifiNetwork ( wifiSsidToPsk)

به شبکه وای فای متصل می شود.

وای فای را روشن می کند و مسدود می کند تا زمانی که اتصال موفقیت آمیز با یکی از شبکه های وای فای ارائه شده در نقشه wifiSsidToPsk برقرار شود. هنگامی که یک اتصال برقرار شد، نمونه سعی می کند پس از هر بار راه اندازی مجدد، اتصال را بازیابی کند تا زمانی که ITestDevice#disconnectFromWifi() یا ITestDevice#clearLastConnectedWifiNetwork() فراخوانی شود.f

مولفه های
wifiSsidToPsk : نقشه ای از SSID وای فای به گذرواژه ها.

برمی گرداند
boolean true اگر با موفقیت به شبکه وای فای متصل شوید. false در غیر این صورت

پرتاب می کند
DeviceNotAvailableException

اتصال به شبکه Wifi

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk, 
                boolean scanSsid)

به شبکه وای فای متصل می شود.

فای را روشن می کند و مسدود می کند تا زمانی که اتصال موفقیت آمیز به شبکه وای فای مشخص شده برقرار شود. هنگامی که یک اتصال برقرار شد، نمونه سعی می کند پس از هر بار راه اندازی مجدد، اتصال را بازیابی کند تا زمانی که ITestDevice#disconnectFromWifi() یا ITestDevice#clearLastConnectedWifiNetwork() فراخوانی شود.

مولفه های
wifiSsid String : وای فای ssid برای اتصال

wifiPsk String : عبارت عبور PSK یا اگر رمزگذاری نشده باشد، null است

scanSsid boolean : آیا باید SSID مخفی این شبکه را اسکن کرد.

برمی گرداند
boolean true اگر با موفقیت به شبکه وای فای متصل شوید. false در غیر این صورت

پرتاب می کند
DeviceNotAvailableException

ConnectToWifiNetworkIfNeeded

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk, 
                boolean scanSsid)

گونه ای از connectToWifiNetwork(String, String) که فقط در صورتی متصل می شود که دستگاه در حال حاضر اتصال شبکه نداشته باشد.

مولفه های
scanSsid boolean : آیا باید SSID مخفی این شبکه را اسکن کرد

برمی گرداند
boolean true اگر با موفقیت به شبکه وای فای متصل شوید. false در غیر این صورت

پرتاب می کند
DeviceNotAvailableException

ConnectToWifiNetworkIfNeeded

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk)

گونه ای از connectToWifiNetwork(String, String) که فقط در صورتی متصل می شود که دستگاه در حال حاضر اتصال شبکه نداشته باشد.

برمی گرداند
boolean true اگر با موفقیت به شبکه وای فای متصل شوید. false در غیر این صورت

پرتاب می کند
DeviceNotAvailableException

createUser

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

یک کاربر با نام مشخص و پرچم های ارائه شده ایجاد کنید

مولفه های
name String : کاربر برای ایجاد در دستگاه

guest boolean : فعال کردن پرچم کاربر --guest در حین ایجاد

ephemeral boolean : در حین ایجاد، پرچم کاربر را فعال کنید

برمی گرداند
int شناسه کاربر ایجاد شده

پرتاب می کند
DeviceNotAvailableException

createUser

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

یک کاربر با نام مشخص و پرچم های ارائه شده ایجاد کنید

مولفه های
name String : کاربر برای ایجاد در دستگاه

guest boolean : فعال کردن پرچم کاربر --guest در حین ایجاد

ephemeral boolean : در حین ایجاد، پرچم کاربر را فعال کنید

forTesting boolean : پرچم تست --برای آزمایش در حین ایجاد را فعال کنید

برمی گرداند
int شناسه کاربر ایجاد شده

پرتاب می کند
DeviceNotAvailableException

createUser

public int createUser (String name)

یک کاربر با نام مشخص و پرچم های پیش فرض 0 ایجاد کنید.

مولفه های
name String : کاربر برای ایجاد در دستگاه

برمی گرداند
int عدد صحیح برای شناسه کاربری ایجاد شده

پرتاب می کند
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

یک کاربر با نام مشخص و پرچم های پیش فرض 0 ایجاد کنید.

مولفه های
name String : کاربر برای ایجاد در دستگاه

برمی گرداند
int عدد صحیح برای شناسه کاربر ایجاد شده یا -1 برای خطا.

پرتاب می کند
DeviceNotAvailableException

حذف فایل

public void deleteFile (String deviceFilePath)

روش کمکی برای حذف یک فایل یا دایرکتوری در دستگاه.

مولفه های
deviceFilePath String : مسیر مطلق فایل روی دستگاه.

پرتاب می کند
DeviceNotAvailableException

لغو ثبت DeviceActionReceiver

public void deregisterDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)

IDeviceActionReceiver ثبت شده را حذف می کند.

مولفه های
deviceActionReceiver IDeviceActionReceiver : یک IDeviceActionReceiver که حذف خواهد شد.

deviceSoftRestarted

public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)

روش کمکی برای بررسی اینکه آیا دستگاه با مقایسه system_server فعلی با system_server ProcessInfo قبلی، نرم‌افزار راه‌اندازی شده است یا خیر. برای دریافت ProcessInfo از getProcessByName(String) استفاده کنید.

مولفه های
prevSystemServerProcess ProcessInfo : فرآیند system_server قبلی ProcessInfo .

برمی گرداند
boolean true اگر دستگاه به صورت نرم راه اندازی شود

پرتاب می کند
DeviceNotAvailableException

deviceSoftRestartedSince

public boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

روش کمکی برای بررسی اینکه آیا دستگاه از زمان UTC از دوره زمانی از دستگاه و ERROR(/TimeUnit) نرم‌افزار راه‌اندازی شده است یا خیر. Soft-Restart به system_server اشاره دارد که خارج از راه‌اندازی مجدد سخت دستگاه (برای مثال: راه‌اندازی مجدد درخواستی) مجدداً راه‌اندازی شده است. دستگاه فعلی utcEpochTime در میلی ثانیه را می توان با روش getDeviceDate() بدست آورد.

مولفه های
utcEpochTime long : زمان دستگاه در ثانیه از زمان.

timeUnit TimeUnit : واحد زمان TimeUnit برای utcEpochTime داده شده.

برمی گرداند
boolean true اگر دستگاه به صورت نرم راه اندازی شود

پرتاب می کند
DeviceNotAvailableException

غیرفعال کردن AdbRoot

public boolean disableAdbRoot ()

ریشه adb را خاموش می کند.

غیرفعال کردن ریشه adb ممکن است باعث قطع ارتباط دستگاه با adb شود. این روش تا زمانی که دستگاه در دسترس نباشد مسدود خواهد شد.

برمی گرداند
boolean در صورت موفقیت true

پرتاب می کند
DeviceNotAvailableException

غیرفعال کردن کیگارد

public void disableKeyguard ()

تلاش برای غیرفعال کردن محافظ صفحه کلید.

ابتدا منتظر بمانید تا ارسال ورودی آماده شود، این تقریباً همزمان با گزارش دستگاه BOOT_COMPLETE، ظاهراً ناهمزمان، اتفاق می‌افتد، زیرا پیاده‌سازی چارچوب فعلی دارای شرایط مسابقه گاه به گاه است. سپس دستور رد کردن صفحه کلید ارسال می شود (فقط روی موارد غیر ایمن کار می کند)

پرتاب می کند
DeviceNotAvailableException

شبکه مانیتور را غیرفعال کنید

public boolean disableNetworkMonitor ()

مانیتورینگ شبکه را در دستگاه غیرفعال می کند.

برمی گرداند
boolean true اگر نظارت با موفقیت غیرفعال شود. false اگر شکست خورد

پرتاب می کند
DeviceNotAvailableException

قطع اتصال از وای فای

public boolean disconnectFromWifi ()

از شبکه وای فای قطع می شود.

تمام شبکه ها را از لیست شبکه های شناخته شده حذف می کند و وای فای را غیرفعال می کند.

برمی گرداند
boolean true اگر با موفقیت از شبکه وای فای قطع شود. false اگر قطع اتصال انجام نشد.

پرتاب می کند
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath, 
                int userId)

روش کمکی برای تعیین اینکه آیا فایل روی دستگاه برای یک کاربر خاص وجود دارد یا خیر.

مولفه های
deviceFilePath String : مسیر مطلق فایل روی دستگاه برای بررسی

userId int : شناسه کاربری که وجود فایل را با آن بررسی کنید

برمی گرداند
boolean true در صورت وجود فایل، false در غیر این صورت.

پرتاب می کند
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

روش کمکی برای تعیین وجود فایل روی دستگاه.

مولفه های
deviceFilePath String : مسیر مطلق فایل روی دستگاه برای بررسی

برمی گرداند
boolean true در صورت وجود فایل، false در غیر این صورت.

پرتاب می کند
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

سعی کنید پشته را از system_server تخلیه کنید. این وظیفه تماس گیرنده است که فایل تخلیه شده را پاک کند.

مولفه های
process String : نام فرآیند دستگاهی که باید روی آن تخلیه شود.

devicePath String : مسیر روی دستگاه که در آن روگرفت را قرار دهید. این باید مکانی باشد که مجوزها اجازه آن را می دهند.

برمی گرداند
File ERROR(/File) حاوی گزارش. اگر چیزی شکست خورده است.

پرتاب می کند
DeviceNotAvailableException

فعال کردن AdbRoot

public boolean enableAdbRoot ()

ریشه adb را روشن می کند. اگر تنظیم "enable-root" "false" باشد، پیامی را ثبت می کند و بدون فعال کردن root باز می گردد.

فعال کردن ریشه adb ممکن است باعث قطع ارتباط دستگاه با adb شود. این روش تا زمانی که دستگاه در دسترس نباشد مسدود خواهد شد.

برمی گرداند
boolean در صورت موفقیت true

پرتاب می کند
DeviceNotAvailableException

مانیتور شبکه را فعال کنید

public boolean enableNetworkMonitor ()

نظارت بر شبکه را بر روی دستگاه فعال می کند.

برمی گرداند
boolean true اگر نظارت با موفقیت فعال شود. false اگر شکست خورد

پرتاب می کند
DeviceNotAvailableException

دستور Adb را اجرا کنید

public String executeAdbCommand (long timeout, 
                String... cmdArgs)

متد Helper که یک دستور adb را به عنوان یک فرمان سیستم با یک بازه زمانی مشخص اجرا می کند.

executeShellCommand(String) باید هر جا که امکان دارد استفاده شود، زیرا آن روش تشخیص خرابی و عملکرد بهتری را ارائه می دهد.

مولفه های
timeout long : زمان بر حسب میلی ثانیه قبل از اینکه دستگاه پاسخگو نباشد، 0 لیتر بدون وقفه

cmdArgs String : دستور adb و آرگومان هایی که باید اجرا شوند

برمی گرداند
String stdout از دستور. اگر دستور اجرا نشد null .

پرتاب می کند
DeviceNotAvailableException

دستور Adb را اجرا کنید

public String executeAdbCommand (long timeout, 
                 envMap, 
                String... cmdArgs)

متد Helper که یک دستور adb را به عنوان یک فرمان سیستم با یک بازه زمانی مشخص اجرا می کند.

executeShellCommand(String) باید هر جا که امکان دارد استفاده شود، زیرا آن روش تشخیص خرابی و عملکرد بهتری را ارائه می دهد.

مولفه های
timeout long : زمان بر حسب میلی ثانیه قبل از اینکه دستگاه پاسخگو نباشد، 0 لیتر بدون وقفه

envMap : محیطی برای تنظیم دستور

cmdArgs String : دستور adb و آرگومان هایی که باید اجرا شوند

برمی گرداند
String stdout از دستور. اگر دستور اجرا نشد null .

پرتاب می کند
DeviceNotAvailableException

دستور Adb را اجرا کنید

public String executeAdbCommand (String... cmdArgs)

متد Helper که دستور adb را به عنوان دستور سیستم اجرا می کند.

executeShellCommand(String) باید هر جا که امکان دارد استفاده شود، زیرا آن روش تشخیص خرابی و عملکرد بهتری را ارائه می دهد.

مولفه های
cmdArgs String : دستور adb و آرگومان هایی که باید اجرا شوند

برمی گرداند
String stdout از دستور. اگر دستور اجرا نشد null .

پرتاب می کند
DeviceNotAvailableException

دستور Fastboot Command را اجرا کنید

public CommandResult executeFastbootCommand (String... cmdArgs)

روش Helper که یک فرمان fastboot را به عنوان یک فرمان سیستم با زمان پیش فرض 2 دقیقه اجرا می کند.

انتظار می رود زمانی استفاده شود که دستگاه از قبل در حالت فست بوت است.

مولفه های
cmdArgs String : دستور fastboot و آرگومان هایی که باید اجرا شوند

برمی گرداند
CommandResult CommandResult حاوی خروجی فرمان است

پرتاب می کند
DeviceNotAvailableException

دستور Fastboot Command را اجرا کنید

public CommandResult executeFastbootCommand (long timeout, 
                String... cmdArgs)

متد Helper که دستور fastboot را به عنوان دستور سیستم اجرا می کند.

انتظار می رود زمانی استفاده شود که دستگاه از قبل در حالت فست بوت است.

مولفه های
timeout long : زمان بر حسب میلی ثانیه قبل از انقضای فرمان

cmdArgs String : دستور fastboot و آرگومان هایی که باید اجرا شوند

برمی گرداند
CommandResult CommandResult حاوی خروجی فرمان است

پرتاب می کند
DeviceNotAvailableException

اجرایLongFastbootCommand

public CommandResult executeLongFastbootCommand (String... cmdArgs)

متد Helper که یک فرمان طولانی در حال اجرا fastboot را به عنوان فرمان سیستم اجرا می کند.

با executeFastbootCommand(String) یکسان است، به جز اینکه از زمان طولانی تری استفاده می کند.

مولفه های
cmdArgs String : دستور fastboot و آرگومان هایی که باید اجرا شوند

برمی گرداند
CommandResult CommandResult حاوی خروجی فرمان است

پرتاب می کند
DeviceNotAvailableException

اجرایLongFastbootCommand

public CommandResult executeLongFastbootCommand ( envVarMap, 
                String... cmdArgs)

روش کمکی که یک فرمان طولانی در حال اجرا سریع بوت را به عنوان فرمان سیستم با متغیرهای محیط سیستم اجرا می کند.

با executeFastbootCommand(String) یکسان است، به جز اینکه از زمان طولانی تری استفاده می کند.

مولفه های
envVarMap : متغیرهای محیطی سیستم که دستور fastboot با آنها اجرا می شود

cmdArgs String : دستور fastboot و آرگومان هایی که باید اجرا شوند

برمی گرداند
CommandResult CommandResult حاوی خروجی فرمان است

پرتاب می کند
DeviceNotAvailableException

ShellCommand را اجرا کنید

public String executeShellCommand (String command)

متد Helper که یک دستور adb shell را اجرا می کند و خروجی را به صورت ERROR(/String) برمی گرداند.

مولفه های
command String : دستور adb shell برای اجرا

برمی گرداند
String خروجی پوسته

پرتاب می کند
DeviceNotAvailableException

ShellCommand را اجرا کنید

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

یک فرمان پوسته adb را با پارامترهای بیشتری برای کنترل رفتار فرمان اجرا می کند.

مولفه های
command String : دستور adb shell برای اجرا

receiver IShellOutputReceiver : IShellOutputReceiver برای هدایت خروجی پوسته به آن.

maxTimeToOutputShellResponse long : حداکثر مدت زمانی که فرمان مجاز است هیچ پاسخی صادر نکند. واحد همانطور که در timeUnit مشخص شده است

timeUnit TimeUnit : واحد برای maxTimeToOutputShellResponse

retryAttempts int : حداکثر تعداد دفعات تکرار دستور در صورت عدم موفقیت به دلیل یک استثنا. اگر retryAttempts بدون موفقیت انجام شود، DeviceNotResponsiveException پرتاب می شود.

پرتاب می کند
DeviceNotAvailableException

ShellCommand را اجرا کنید

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeoutForCommand, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

یک فرمان پوسته adb را با پارامترهای بیشتری برای کنترل رفتار فرمان اجرا می کند.

مولفه های
command String : دستور adb shell برای اجرا

receiver IShellOutputReceiver : IShellOutputReceiver برای هدایت خروجی پوسته به آن.

maxTimeoutForCommand long : حداکثر زمان برای تکمیل دستور. واحد همانطور که در timeUnit مشخص شده است

maxTimeToOutputShellResponse long : حداکثر مدت زمانی که فرمان مجاز است هیچ پاسخی صادر نکند. واحد همانطور که در timeUnit مشخص شده است

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

retryAttempts int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success.

پرتاب می کند
DeviceNotAvailableException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver)

Executes the given adb shell command, retrying multiple times if command fails.

A simpler form of executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int) with default values.

مولفه های
command String : the adb shell command to run

receiver IShellOutputReceiver : the IShellOutputReceiver to direct shell output to.

پرتاب می کند
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd)

Helper method which executes a adb shell command and returns the results as a CommandResult properly populated with the command status output, stdout and stderr.

مولفه های
cmd String : The command that should be run.

برمی گرداند
CommandResult The result in CommandResult .

پرتاب می کند
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                OutputStream pipeToOutput)

Helper method which executes an adb shell command and returns the results as a CommandResult properly populated with the command status output and stderr. stdout is directed to the specified stream.

مولفه های
cmd String : The command that should be run.

pipeToOutput OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null.

برمی گرداند
CommandResult The result in CommandResult .

پرتاب می کند
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput)

Helper method which executes an adb shell command and returns the results as a CommandResult properly populated with the command status output, stdout and stderr.

مولفه های
cmd String : The command that should be run.

pipeAsInput File : A ERROR(/File) that will be piped as input to the command, or null.

برمی گرداند
CommandResult The result in CommandResult .

پرتاب می کند
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Executes a adb shell command, with more parameters to control command behavior.

مولفه های
cmd String : the adb shell command to run

maxTimeoutForCommand long : the maximum timeout for the command to complete; unit as specified in timeUnit

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

retryAttempts int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success.

برمی گرداند
CommandResult

پرتاب می کند
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit)

Executes a adb shell command, with more parameters to control command behavior.

مولفه های
cmd String : the adb shell command to run

maxTimeoutForCommand long : the maximum timeout for the command to complete; unit as specified in timeUnit

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

برمی گرداند
CommandResult

پرتاب می کند
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Executes a adb shell command, with more parameters to control command behavior.

مولفه های
cmd String : the adb shell command to run

pipeAsInput File : A ERROR(/File) that will be piped as input to the command, or null.

pipeToOutput OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null.

maxTimeoutForCommand long : the maximum timeout for the command to complete; unit as specified in timeUnit

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

retryAttempts int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success.

برمی گرداند
CommandResult

پرتاب می کند
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                OutputStream pipeToError, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Executes a adb shell command, with more parameters to control command behavior.

مولفه های
cmd String : the adb shell command to run

pipeAsInput File : A ERROR(/File) that will be piped as input to the command, or null.

pipeToOutput OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null.

pipeToError OutputStream : ERROR(/OutputStream) where the std error will be redirected, or null.

maxTimeoutForCommand long : the maximum timeout for the command to complete; unit as specified in timeUnit

timeUnit TimeUnit : unit for maxTimeToOutputShellResponse

retryAttempts int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success.

برمی گرداند
CommandResult

پرتاب می کند
DeviceNotAvailableException

fastbootWipePartition

public CommandResult fastbootWipePartition (String partition)

Helper method which wipes a partition for the device.

If getUseFastbootErase() is true , then fastboot erase will be used to wipe the partition. The device must then create a filesystem the next time the device boots. Otherwise, fastboot format is used which will create a new filesystem on the device.

Expected to be used when device is already in fastboot mode.

مولفه های
partition String : the partition to wipe

برمی گرداند
CommandResult the CommandResult containing output of command

پرتاب می کند
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Fetch the information about APEXes activated on the device.

برمی گرداند
ERROR(/Set) of ApexInfo currently activated on the device

پرتاب می کند
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Return key value pairs of requested namespace.

مولفه های
namespace String : must be one of {"system", "secure", "global"}

برمی گرداند
the map of key value pairs. Null if namespace is not supported.

پرتاب می کند
DeviceNotAvailableException

getAllocationState

public DeviceAllocationState getAllocationState ()

Return the current allocation state of device

برمی گرداند
DeviceAllocationState

getAndroidId

public String getAndroidId (int userId)

Find and return the android-id associated to a userId, null if not found.

مولفه های
userId int

برمی گرداند
String

پرتاب می کند
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Create a Map of android ids found matching user ids. There is no insurance that each user id will found an android id associated in this function so some user ids may match null.

برمی گرداند
Map of android ids found matching user ids.

پرتاب می کند
DeviceNotAvailableException

getApiLevel

public int getApiLevel ()

Get the device API Level. Defaults to UNKNOWN_API_LEVEL .

برمی گرداند
int an integer indicating the API Level of device

پرتاب می کند
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Fetch information about a package installed on device.

مولفه های
packageName String

برمی گرداند
PackageInfo the PackageInfo or null if information could not be retrieved

پرتاب می کند
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Fetch information of packages installed on the device.

برمی گرداند
ERROR(/List) of PackageInfo s installed on the device.

پرتاب می کند
DeviceNotAvailableException

getBasebandVersion

public String getBasebandVersion ()

Convenience method to get baseband (radio) version of this device. Getting the radio version is device specific, so it might not return the correct information for all devices. This method relies on the gsm.version.baseband propery to return the correct version information. This is not accurate for some CDMA devices and the version returned here might not match the version reported from fastboot and might not return the version for the CDMA radio. TL;DR this method only reports accurate version if the gsm.version.baseband property is the same as the version returned by fastboot getvar version-baseband .

برمی گرداند
String the ERROR(/String) baseband version or null if it cannot be determined (device has no radio or version string cannot be read)

پرتاب می کند
DeviceNotAvailableException

getBattery

public Integer getBattery ()

Returns the current battery level of a device or Null if battery level unavailable.

برمی گرداند
Integer

getBooleanProperty

public boolean getBooleanProperty (String name, 
                boolean defaultValue)

Returns boolean value of the given property.

مولفه های
name String : the property name

defaultValue boolean : default value to return if property is empty or doesn't exist.

برمی گرداند
boolean true if the property has value "1" , "y" , "yes" , "on" , or "true" , false if the property has value of "0" , "n" , "no" , "off" , "false" , or defaultValue otherwise.

پرتاب می کند
DeviceNotAvailableException

getBootHistory

public  getBootHistory ()

Helper method collects the boot history map with boot time and boot reason.

برمی گرداند
Map of boot time (UTC time in second since Epoch) and boot reason

پرتاب می کند
DeviceNotAvailableException

getBootHistorySince

public  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

Helper method collects the boot history map with boot time and boot reason since the given time since epoch from device and the time unit specified. The current device utcEpochTime in Millisecond can be obtained by method getDeviceDate() .

مولفه های
utcEpochTime long : the device time since Epoch.

timeUnit TimeUnit : the time unit TimeUnit .

برمی گرداند
Map of boot time (UTC time in second since Epoch) and boot reason

پرتاب می کند
DeviceNotAvailableException

getBootloaderVersion

public String getBootloaderVersion ()

Convenience method to get the bootloader version of this device.

Will attempt to retrieve bootloader version from the device's current state. (ie if device is in fastboot mode, it will attempt to retrieve version from fastboot)

برمی گرداند
String the ERROR(/String) bootloader version or null if it cannot be found

پرتاب می کند
DeviceNotAvailableException

getBugreport

public InputStreamSource getBugreport ()

Retrieves a bugreport from the device.

The implementation of this is guaranteed to continue to work on a device without an sdcard (or where the sdcard is not yet mounted).

برمی گرداند
InputStreamSource An InputStreamSource which will produce the bugreport contents on demand. In case of failure, the InputStreamSource will produce an empty ERROR(/InputStream) .

getBugreportz

public InputStreamSource getBugreportz ()

Retrieves a bugreportz from the device. Zip format bugreport contains the main bugreport and other log files that are useful for debugging.

Only supported for 'adb version' > 1.0.36

برمی گرداند
InputStreamSource a InputStreamSource of the zip file containing the bugreportz, return null in case of failure.

getBuildAlias

public String getBuildAlias ()

Retrieve the alias of the build that the device is currently running.

Build alias is usually a more readable string than build id (typically a number for Nexus builds). For example, final Android 4.2 release has build alias JDQ39, and build id 573038

برمی گرداند
String the build alias or fall back to build id if it could not be retrieved

پرتاب می کند
DeviceNotAvailableException

getBuildFlavor

public String getBuildFlavor ()

Retrieve the build flavor for the device.

برمی گرداند
String the build flavor or null if it could not be retrieved

پرتاب می کند
DeviceNotAvailableException

getBuildId

public String getBuildId ()

Retrieve the build the device is currently running.

برمی گرداند
String the build id or IBuildInfo#UNKNOWN_BUILD_ID if it could not be retrieved

پرتاب می کند
DeviceNotAvailableException

getBuildSigningKeys

public String getBuildSigningKeys ()

Returns the key type used to sign the device image

Typically Android devices may be signed with test-keys (like in AOSP) or release-keys (controlled by individual device manufacturers)

برمی گرداند
String The signing key if found, null otherwise.

پرتاب می کند
DeviceNotAvailableException

getCachedDeviceDescriptor

public DeviceDescriptor getCachedDeviceDescriptor ()

Returns a cached DeviceDescriptor if the device is allocated, otherwise returns the current DeviceDescriptor .

برمی گرداند
DeviceDescriptor

getCachedDeviceDescriptor

public DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

Returns a cached DeviceDescriptor if the device is allocated, otherwise returns the current DeviceDescriptor .

مولفه های
shortDescriptor boolean : Whether or not to limit descriptor to bare minimum info

برمی گرداند
DeviceDescriptor

getChildren

public String[] getChildren (String path)

Alternative to using IFileEntry that sometimes won't work because of permissions.

مولفه های
path String : is the path on the device where to do the search

برمی گرداند
String[] Array of string containing all the file in a path on the device.

پرتاب می کند
DeviceNotAvailableException

getConnection

public AbstractConnection getConnection ()

The current connection associated with the device.

برمی گرداند
AbstractConnection

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Returns the current foldable state of the device or null if some issues occurred.

برمی گرداند
DeviceFoldableState

پرتاب می کند
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Return the id of the current running user. In case of error, return -10000.

برمی گرداند
int

پرتاب می کند
DeviceNotAvailableException

getDeviceClass

public String getDeviceClass ()

Get the device class.

برمی گرداند
String the ERROR(/String) device class.

getDeviceDate

public long getDeviceDate ()

Return the date of the device in millisecond since epoch.

برمی گرداند
long the date of the device in epoch format.

پرتاب می کند
DeviceNotAvailableException

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor ()

یک DeviceDescriptor را از اطلاعات دستگاه برگردانید تا اطلاعات مربوط به آن را بدون عبور از شی دستگاه واقعی دریافت کنید.

برمی گرداند
DeviceDescriptor

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

یک DeviceDescriptor را از اطلاعات دستگاه برگردانید تا اطلاعات مربوط به آن را بدون عبور از شی دستگاه واقعی دریافت کنید.

مولفه های
shortDescriptor boolean : Whether or not to limit descriptor to bare minimum info

برمی گرداند
DeviceDescriptor

getDeviceState

public TestDeviceState getDeviceState ()

Get the device's state.

برمی گرداند
TestDeviceState

getDeviceTimeOffset

public long getDeviceTimeOffset (Date date)

Helper to get the time difference between the device and a given ERROR(/Date) . Use Epoch time internally.

مولفه های
date Date

برمی گرداند
long the difference in milliseconds

پرتاب می کند
DeviceNotAvailableException

getEmulatorOutput

public InputStreamSource getEmulatorOutput ()

Get the stream of emulator stdout and stderr

برمی گرداند
InputStreamSource emulator output

getEmulatorProcess

public Process getEmulatorProcess ()

Return the ERROR(/Process) corresponding to this emulator.

برمی گرداند
Process the ERROR(/Process) or null

getExecuteShellCommandLog

public final File getExecuteShellCommandLog ()

The log that contains all the executeShellCommand(String) logs.

برمی گرداند
File

getExternalStoreFreeSpace

public long getExternalStoreFreeSpace ()

Helper method to determine amount of free space on device external storage.

برمی گرداند
long the amount of free space in KB

پرتاب می کند
DeviceNotAvailableException

getFastbootPath

public String getFastbootPath ()

Returns the path of the fastboot binary being used. Still requires isFastbootEnabled() to be true, to have fastboot functions enabled.

برمی گرداند
String

getFastbootProductType

public String getFastbootProductType ()

Convenience method to get the product type of this device when its in fastboot mode.

This method should only be used if device should be in fastboot. Its a bit safer variant than the generic getProductType() method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.

برمی گرداند
String the ERROR(/String) product type name or null if it cannot be determined

پرتاب می کند
DeviceNotAvailableException

getFastbootProductVariant

public String getFastbootProductVariant ()

Convenience method to get the product type of this device when its in fastboot mode.

This method should only be used if device should be in fastboot. Its a bit safer variant than the generic getProductType() method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.

برمی گرداند
String the ERROR(/String) product type name or null if it cannot be determined

پرتاب می کند
DeviceNotAvailableException

getFastbootSerialNumber

public String getFastbootSerialNumber ()

Returns the fastboot mode serial number.

برمی گرداند
String

getFastbootVariable

public String getFastbootVariable (String variableName)

Retrieve the given fastboot variable value from the device.

مولفه های
variableName String : the variable name

برمی گرداند
String the property value or null if it does not exist

پرتاب می کند
DeviceNotAvailableException

getFastbootVersion

public String getFastbootVersion ()

Returns the version string of the fastboot binary being used. Or null if something goes wrong.

برمی گرداند
String

getFileEntry

public IFileEntry getFileEntry (String path)

Retrieve a reference to a remote file on device.

مولفه های
path String : the file path to retrieve. Can be an absolute path or path relative to '/'. (ie both "/system" and "system" syntax is supported)

برمی گرداند
IFileEntry the IFileEntry or null if file at given path cannot be found

پرتاب می کند
DeviceNotAvailableException

getFileEntry

public IFileEntry getFileEntry (FileListingService.FileEntry entry)

Unofficial helper to get a FileEntry from a non-root path. FIXME: Refactor the FileEntry system to have it available from any path. (even non root).

مولفه های
entry FileListingService.FileEntry : a FileEntry not necessarily root as Ddmlib requires.

برمی گرداند
IFileEntry a FileEntryWrapper representing the FileEntry.

پرتاب می کند
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Returns the list of foldable states on the device. Can be obtained with "cmd device_state print-states".

برمی گرداند

پرتاب می کند
DeviceNotAvailableException

getIDevice

public IDevice getIDevice ()

Returns a reference to the associated ddmlib IDevice .

A new IDevice may be allocated by DDMS each time the device disconnects and reconnects from adb. Thus callers should not keep a reference to the IDevice , because that reference may become stale.

برمی گرداند
IDevice the IDevice

getInstalledPackageNames

public  getInstalledPackageNames ()

Fetch the application package names present on the device.

برمی گرداند
ERROR(/Set) of ERROR(/String) package names currently installed on the device.

پرتاب می کند
DeviceNotAvailableException

getIntProperty

public long getIntProperty (String name, 
                long defaultValue)

Returns integer value of the given property from the device.

مولفه های
name String : the property name

defaultValue long : default value to return if property is empty or doesn't exist.

برمی گرداند
long the property value or defaultValue if the property is empty, doesn't exist, or doesn't have an integer value.

پرتاب می کند
DeviceNotAvailableException

getIpAddress

public String getIpAddress ()

Gets the device's IP address.

برمی گرداند
String the device's IP address, or null if device has no IP address

پرتاب می کند
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Return an object to get the current state of the keyguard or null if not supported.

برمی گرداند
KeyguardControllerState a KeyguardControllerState containing a snapshot of the state of the keyguard and returns Null if the Keyguard query is not supported.

پرتاب می کند
DeviceNotAvailableException

getLastExpectedRebootTimeMillis

public long getLastExpectedRebootTimeMillis ()

Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by ERROR(/System#currentTimeMillis()) .

برمی گرداند
long

getLaunchApiLevel

public int getLaunchApiLevel ()

Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL .

برمی گرداند
int an integer indicating the first launched API Level of device

پرتاب می کند
DeviceNotAvailableException

getLogcat

public InputStreamSource getLogcat ()

Grabs a snapshot stream of the logcat data.

Works in two modes:

  • If the logcat is currently being captured in the background, will return up to TestDeviceOptions.getMaxLogcatDataSize() bytes of the current contents of the background logcat capture
  • Otherwise, will return a static dump of the logcat data if device is currently responding

    برمی گرداند
    InputStreamSource

  • getLogcat

    public InputStreamSource getLogcat (int maxBytes)

    Grabs a snapshot stream of the last maxBytes of captured logcat data.

    Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat() snapshot.

    مولفه های
    maxBytes int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory

    برمی گرداند
    InputStreamSource

    getLogcatDump

    public InputStreamSource getLogcatDump ()

    Get a dump of the current logcat for device. Unlike getLogcat() , this method will always return a static dump of the logcat.

    Has the disadvantage that nothing will be returned if device is not reachable.

    برمی گرداند
    InputStreamSource a InputStreamSource of the logcat data. An empty stream is returned if fail to capture logcat data.

    getLogcatSince

    public InputStreamSource getLogcatSince (long date)

    Grabs a snapshot stream of captured logcat data starting the date provided. The time on the device should be used getDeviceDate() .

    مولفه های
    date long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s')

    برمی گرداند
    InputStreamSource

    getMacAddress

    public String getMacAddress ()

    Returns the MAC address of the device, null if it fails to query from the device.

    برمی گرداند
    String

    getMainUserId

    public Integer getMainUserId ()

    Returns the main user id.

    برمی گرداند
    Integer the userId of the main user if there is one, and null if there is no main user.

    پرتاب می کند
    DeviceNotAvailableException

    getMainlineModuleInfo

    public  getMainlineModuleInfo ()

    Get the information about the mainline modules installed on the device.

    برمی گرداند
    ERROR(/Set) of ERROR(/String) mainline modules currently installed on the device.

    پرتاب می کند
    DeviceNotAvailableException

    getMaxNumberOfRunningUsersSupported

    public int getMaxNumberOfRunningUsersSupported ()

    Get the maximum number of supported simultaneously running users. Defaults to 0.

    برمی گرداند
    int an integer indicating the number of simultaneously running users

    پرتاب می کند
    DeviceNotAvailableException

    getMaxNumberOfUsersSupported

    public int getMaxNumberOfUsersSupported ()

    Get the maximum number of supported users. Defaults to 0.

    برمی گرداند
    int an integer indicating the number of supported users

    پرتاب می کند
    DeviceNotAvailableException

    getMicrodroidProcess

    public Process getMicrodroidProcess ()

    برمی گرداند
    Process Returns the Process of the Microdroid VM. If TestDevice is not a Microdroid, returns null.

    getMonitor

    public IDeviceStateMonitor getMonitor ()

    Return the IDeviceStateMonitor associated with device.

    برمی گرداند
    IDeviceStateMonitor

    getMountPoint

    public String getMountPoint (String mountName)

    Returns a mount point.

    Queries the device directly if the cached info in IDevice is not available.

    TODO: move this behavior to IDevice#getMountPoint(String)

    مولفه های
    mountName String : the name of the mount point

    برمی گرداند
    String the mount point or null

    getMountPointInfo

    public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

    Returns a MountPointInfo corresponding to the specified mountpoint path, or null if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.

    مولفه های
    mountpoint String

    برمی گرداند
    ITestDevice.MountPointInfo A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts"

    پرتاب می کند
    DeviceNotAvailableException

    getMountPointInfo

    public  getMountPointInfo ()

    Returns a parsed version of the information in /proc/mounts on the device

    برمی گرداند
    A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts"

    پرتاب می کند
    DeviceNotAvailableException

    getOptions

    public TestDeviceOptions getOptions ()

    Fetch the test options for the device.

    برمی گرداند
    TestDeviceOptions TestDeviceOptions related to the device under test.

    getPartitionFreeSpace

    public long getPartitionFreeSpace (String partition)

    Helper method to determine amount of free space on device partition.

    مولفه های
    partition String

    برمی گرداند
    long the amount of free space in KB

    پرتاب می کند
    DeviceNotAvailableException

    getPrimaryUserId

    public Integer getPrimaryUserId ()

    Returns the primary user id.

    برمی گرداند
    Integer the userId of the primary user if there is one, and null if there is no primary user.

    پرتاب می کند
    DeviceNotAvailableException

    getProcessByName

    public ProcessInfo getProcessByName (String processName)

    Helper method runs the "pidof" and "stat" command and returns ProcessInfo object with PID and process start time of the given process.

    مولفه های
    processName String : the proces name String.

    برمی گرداند
    ProcessInfo ProcessInfo of given processName

    پرتاب می کند
    DeviceNotAvailableException

    getProcessPid

    public String getProcessPid (String process)

    Returns the pid of the service or null if something went wrong.

    مولفه های
    process String : The proces name String.

    برمی گرداند
    String

    پرتاب می کند
    DeviceNotAvailableException

    getProductType

    public String getProductType ()

    Convenience method to get the product type of this device.

    This method will work if device is in either adb or fastboot mode.

    برمی گرداند
    String the ERROR(/String) product type name. Will not be null

    پرتاب می کند
    DeviceNotAvailableException

    getProductVariant

    public String getProductVariant ()

    Convenience method to get the product variant of this device.

    This method will work if device is in either adb or fastboot mode.

    برمی گرداند
    String the ERROR(/String) product variant name or null if it cannot be determined

    پرتاب می کند
    DeviceNotAvailableException

    getProperty

    public String getProperty (String name)

    Retrieve the given property value from the device.

    مولفه های
    name String : the property name

    برمی گرداند
    String the property value or null if it does not exist

    پرتاب می کند
    DeviceNotAvailableException

    getRecoveryMode

    public ITestDevice.RecoveryMode getRecoveryMode ()

    Get the current recovery mode used for the device.

    برمی گرداند
    ITestDevice.RecoveryMode the current recovery mode used for the device.

    getScreenshot

    public InputStreamSource getScreenshot (String format)

    Grabs a screenshot from the device. Recommended to use getScreenshot(format) instead with JPEG encoding for smaller size

    مولفه های
    format String : supported PNG, JPEG

    برمی گرداند
    InputStreamSource a InputStreamSource of the screenshot in format, or null if the screenshot was not successful.

    پرتاب می کند
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot (long displayId)

    Grabs a screenshot from the device given display id. Format is PNG.

    TODO: extend the implementations above to support 'format' and 'rescale'

    مولفه های
    displayId long : the display id of the screen to get screenshot from.

    برمی گرداند
    InputStreamSource a InputStreamSource of the screenshot in format, or null if the screenshot was not successful.

    پرتاب می کند
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot (String format, 
                    boolean rescale)

    Grabs a screenshot from the device. Recommended to use getScreenshot(String) instead with JPEG encoding for smaller size.

    مولفه های
    format String : supported PNG, JPEG

    rescale boolean : if screenshot should be rescaled to reduce the size of resulting image

    برمی گرداند
    InputStreamSource a InputStreamSource of the screenshot in format, or null if the screenshot was not successful.

    پرتاب می کند
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot ()

    Grabs a screenshot from the device.

    برمی گرداند
    InputStreamSource a InputStreamSource of the screenshot in png format, or null if the screenshot was not successful.

    پرتاب می کند
    DeviceNotAvailableException

    getSerialNumber

    public String getSerialNumber ()

    Convenience method to get serial number of this device.

    برمی گرداند
    String the ERROR(/String) serial number

    getSetting

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

    Return the value of the requested setting. namespace must be one of: {"system", "secure", "global"}

    مولفه های
    userId int

    namespace String

    key String

    برمی گرداند
    String the value associated with the namespace:key of a user. Null if not found.

    پرتاب می کند
    DeviceNotAvailableException

    getSetting

    public String getSetting (String namespace, 
                    String key)

    See getSetting(int, String, String) and performed on system user.

    مولفه های
    namespace String

    key String

    برمی گرداند
    String

    پرتاب می کند
    DeviceNotAvailableException

    getSimOperator

    public String getSimOperator ()

    Return the SIM card operator or null if not available or if device is not available.

    برمی گرداند
    String

    getSimState

    public String getSimState ()

    Return the SIM card state or null if not available or device is not available.

    برمی گرداند
    String

    گرفتن سنگ قبر

    public  getTombstones ()

    Fetch and return the list of tombstones from the devices. Requires root.

    method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException will terminate the method early.

    برمی گرداند
    لیستی از فایل های سنگ قبر، در صورت عدم وجود سنگ قبر خالی.

    پرتاب می کند
    DeviceNotAvailableException

    getTotalMemory

    public long getTotalMemory ()

    Returns total physical memory size in bytes or -1 in case of internal error

    برمی گرداند
    long

    getUninstallablePackageNames

    public  getUninstallablePackageNames ()

    Fetch the application package names that can be uninstalled. This is presently defined as non-system packages, and updated system packages.

    برمی گرداند
    ERROR(/Set) of uninstallable ERROR(/String) package names currently installed on the device.

    پرتاب می کند
    DeviceNotAvailableException

    getUseFastbootErase

    public boolean getUseFastbootErase ()

    Get whether to use fastboot erase or fastboot format to wipe a partition on the device.

    برمی گرداند
    boolean true if fastboot erase will be used or false if fastboot format will be used.

    getUserFlags

    public int getUserFlags (int userId)

    Find and return the flags of a given user. Flags are defined in "android.content.pm.UserInfo" class in Android Open Source Project.

    مولفه های
    userId int

    برمی گرداند
    int the flags associated with the userId provided if found, -10000 in any other cases.

    پرتاب می کند
    DeviceNotAvailableException

    getUserInfos

    public  getUserInfos ()

    Gets the Map of useId to UserInfo on the device. Will throw DeviceRuntimeException if output from device is not as expected.

    برمی گرداند
    the list of UserInfo objects.

    پرتاب می کند
    DeviceNotAvailableException

    getUserSerialNumber

    public int getUserSerialNumber (int userId)

    Return the serial number associated to the userId if found, -10000 in any other cases.

    مولفه های
    userId int

    برمی گرداند
    int

    پرتاب می کند
    DeviceNotAvailableException

    handleAllocationEvent

    public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

    Process the given DeviceEvent . May transition device to new state. Will inform the IDeviceMonitor of any state transitions.

    Process the DeviceEvent, which may or may not transition this device to a new allocation state.

    مولفه های
    event DeviceEvent

    برمی گرداند
    IManagedTestDevice.DeviceEventResponse

    hasFeature

    public boolean hasFeature (String feature)

    Check if a feature is available on a device.

    مولفه های
    feature String : which format should be "feature: " or " " directly.

    برمی گرداند
    boolean True if feature is found, false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    installPackage

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

    Install an Android package on device.

    مولفه های
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    برمی گرداند
    String a ERROR(/String) with an error code, or null if success.

    پرتاب می کند
    DeviceNotAvailableException

    installPackage

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

    Install an Android package on device.

    Note: Only use cases that requires explicit control of granting runtime permission at install time should call this function.

    مولفه های
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    grantPermissions boolean : if all runtime permissions should be granted at install time

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    برمی گرداند
    String a ERROR(/String) with an error code, or null if success.

    پرتاب می کند
    DeviceNotAvailableException

    installPackageForUser

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

    Install an Android package on device for a given user.

    مولفه های
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    userId int : the integer user id to install for.

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    برمی گرداند
    String a ERROR(/String) with an error code, or null if success.

    پرتاب می کند
    DeviceNotAvailableException

    installPackageForUser

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

    Install an Android package on device for a given user.

    Note: Only use cases that requires explicit control of granting runtime permission at install time should call this function.

    مولفه های
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    grantPermissions boolean : if all runtime permissions should be granted at install time

    userId int : the integer user id to install for.

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    برمی گرداند
    String a ERROR(/String) with an error code, or null if success.

    پرتاب می کند
    DeviceNotAvailableException

    isAdbRoot

    public boolean isAdbRoot ()

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    isAdbTcp

    public boolean isAdbTcp ()

    برمی گرداند
    boolean

    isAppEnumerationSupported

    public boolean isAppEnumerationSupported ()

    Check whether platform on device supports app enumeration

    برمی گرداند
    boolean True if app enumeration is supported, false otherwise

    پرتاب می کند
    DeviceNotAvailableException

    isBypassLowTargetSdkBlockSupported

    public boolean isBypassLowTargetSdkBlockSupported ()

    Check whether platform on device supports bypassing low target sdk block on app installs

    برمی گرداند
    boolean True if bypass low target sdk block is supported, false otherwise

    پرتاب می کند
    DeviceNotAvailableException

    isDeviceEncrypted

    public boolean isDeviceEncrypted ()

    Returns if the device is encrypted.

    برمی گرداند
    boolean true if the device is encrypted.

    پرتاب می کند
    DeviceNotAvailableException

    isDirectory

    public boolean isDirectory (String path)

    Return True if the path on the device is a directory, false otherwise.

    مولفه های
    path String

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    isEnableAdbRoot

    public boolean isEnableAdbRoot ()

    برمی گرداند
    boolean true if adb root should be enabled on device

    isEncryptionSupported

    public boolean isEncryptionSupported ()

    Returns if encryption is supported on the device.

    برمی گرداند
    boolean true if the device supports encryption.

    پرتاب می کند
    DeviceNotAvailableException

    isExecutable

    public boolean isExecutable (String fullPath)

    Returns True if the file path on the device is an executable file, false otherwise.

    مولفه های
    fullPath String

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    isFastbootEnabled

    public boolean isFastbootEnabled ()

    Return if fastboot is available for the device.

    برمی گرداند
    boolean

    isHeadless

    public boolean isHeadless ()

    Return true if the device is headless (no screen), false otherwise.

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    isHeadlessSystemUserMode

    public boolean isHeadlessSystemUserMode ()

    Returns whether the device uses headless system user mode.

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    isMainUserPermanentAdmin

    public boolean isMainUserPermanentAdmin ()

    Returns whether the main user is a permanent admin and can't be deleted or downgraded to non-admin status.

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    isMultiUserSupported

    public boolean isMultiUserSupported ()

    Determines if multi user is supported.

    برمی گرداند
    boolean true if multi user is supported, false otherwise

    پرتاب می کند
    DeviceNotAvailableException

    isPackageInstalled

    public boolean isPackageInstalled (String packageName, 
                    String userId)

    Query the device for a given package name and given user id to check if it's currently installed or not for that user.

    مولفه های
    packageName String : the package we are checking if it's installed.

    userId String : The user id we are checking the package is installed for. If null, primary user zero will be used.

    برمی گرداند
    boolean True if the package is reported as installed. False otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    isPackageInstalled

    public boolean isPackageInstalled (String packageName)

    Query the device for a given package name to check if it's currently installed or not.

    مولفه های
    packageName String

    برمی گرداند
    boolean True if the package is reported as installed. False otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    isRuntimePermissionSupported

    public boolean isRuntimePermissionSupported ()

    Check whether platform on device supports runtime permission granting

    برمی گرداند
    boolean True if runtime permission are supported, false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    isStateBootloaderOrFastbootd

    public boolean isStateBootloaderOrFastbootd ()

    Returns true if device is in TestDeviceState#FASTBOOT or TestDeviceState.FASTBOOTD .

    برمی گرداند
    boolean

    isUserRunning

    public boolean isUserRunning (int userId)

    Check if a given user is running.

    مولفه های
    userId int

    برمی گرداند
    boolean True if the user is running, false in every other cases.

    پرتاب می کند
    DeviceNotAvailableException

    isUserSecondary

    public boolean isUserSecondary (int userId)

    Return whether the specified user is a secondary user according to it's flags.

    مولفه های
    userId int

    برمی گرداند
    boolean true if the user is secondary, false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    isUserVisible

    public boolean isUserVisible (int userId)

    Checks if the given user is visible.

    A "visible" user is a user that is interacting with the "human" user and hence is able to launch launch activities (typically in the default display).

    مولفه های
    userId int

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    isUserVisibleOnDisplay

    public boolean isUserVisibleOnDisplay (int userId, 
                    int displayId)

    Checks if the given user is visible in the given display.

    A "visible" user is a user that is interacting with the "human" user and hence is able to launch launch activities in that display.

    مولفه های
    userId int

    displayId int

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    isVisibleBackgroundUsersOnDefaultDisplaySupported

    public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported ()

    Returns whether the device allow users to be started visible in the background in the ERROR(/java.android.view.Display#DEFAULT_DISPLAY) .

    If it does, you could call startVisibleBackgroundUser(int, int, boolean) , passing a display returned by listDisplayIdsForStartingVisibleBackgroundUsers() (which should include ERROR(/java.android.view.Display#DEFAULT_DISPLAY) ).

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    isVisibleBackgroundUsersSupported

    public boolean isVisibleBackgroundUsersSupported ()

    Returns whether the device allow users to be started visible in the background.

    If it does, you could call startVisibleBackgroundUser(int, int, boolean) , passing a display returned by listDisplayIdsForStartingVisibleBackgroundUsers() .

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    isWifiEnabled

    public boolean isWifiEnabled ()

    Test if wifi is enabled.

    Checks if wifi is enabled on device. Useful for asserting wifi status before tests that shouldn't run with wifi, eg mobile data tests.

    برمی گرداند
    boolean true if wifi is enabled. false if disabled

    پرتاب می کند
    DeviceNotAvailableException

    listDisplayIds

    public  listDisplayIds ()

    Collect the list of available displays id on the device as reported by "dumpsys SurfaceFlinger".

    برمی گرداند
    The list of displays. Default always returns the default display 0.

    پرتاب می کند
    DeviceNotAvailableException

    listDisplayIdsForStartingVisibleBackgroundUsers

    public  listDisplayIdsForStartingVisibleBackgroundUsers ()

    Gets the list of displays that can be used to start a user visible in the background .

    برمی گرداند

    پرتاب می کند
    DeviceNotAvailableException

    listUsers

    public  listUsers ()

    Gets the list of users on the device. Will throw DeviceRuntimeException if output from device is not as expected.

    برمی گرداند
    the list of user ids.

    پرتاب می کند
    DeviceNotAvailableException

    logAnrs

    public boolean logAnrs (ITestLogger logger)

    Collects and log ANRs from the device.

    مولفه های
    logger ITestLogger : an ITestLogger to log the ANRs.

    برمی گرداند
    boolean True if the logging was successful, false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    logBugreport

    public boolean logBugreport (String dataName, 
                    ITestLogger listener)

    Helper method to take a bugreport and log it to the reporters.

    مولفه های
    dataName String : name under which the bugreport will be reported.

    listener ITestLogger : an ITestLogger to log the bugreport.

    برمی گرداند
    boolean True if the logging was successful, false otherwise.

    logOnDevice

    public void logOnDevice (String tag, 
                    Log.LogLevel level, 
                    String format, 
                    Object... args)

    Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.

    مولفه های
    tag String : The tag under which we log our message in the logcat.

    level Log.LogLevel : The debug level of the message in the logcat.

    format String : The message format.

    args Object : the args to be replaced via String.format().

    nonBlockingReboot

    public void nonBlockingReboot ()

    Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.

    پرتاب می کند
    DeviceNotAvailableException

    postAdbRootAction

    public void postAdbRootAction ()

    Override if the device needs some specific actions to be taken after adb root and before the device is back online. Default implementation doesn't include any addition actions. adb root is not guaranteed to be enabled at this stage.

    پرتاب می کند
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    postAdbUnrootAction

    public void postAdbUnrootAction ()

    Override if the device needs some specific actions to be taken after adb unroot and before the device is back online. Default implementation doesn't include any additional actions. adb root is not guaranteed to be disabled at this stage.

    پرتاب می کند
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    postBootSetup

    public void postBootSetup ()

    Perform instructions to configure device for testing that after every boot.

    Should be called after device is fully booted/available

    In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot.

    Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)

    پرتاب می کند
    DeviceNotAvailableException

    postInvocationTearDown

    public void postInvocationTearDown (Throwable exception)

    مراحل اضافی برای پاکسازی مورد نیاز خاص دستگاه که پس از انجام فراخوانی اجرا می شود.

    مولفه های
    exception Throwable : در صورت وجود، آخرین استثنا ناشی از شکست فراخوانی.

    preInvocationSetup

    public void preInvocationSetup (IBuildInfo info, 
                    MultiMap<String, String> attributes)

    مراحل اضافی برای تنظیم مورد نیاز خاص دستگاه که قبل از جریان فراخوانی روی دستگاه اجرا می شود.

    مولفه های
    info IBuildInfo : IBuildInfo دستگاه.

    attributes MultiMap : ویژگی هایی که در زمینه فراخوانی ذخیره می شوند

    پرتاب می کند
    DeviceNotAvailableException
    TargetSetupError

    pullDir

    public boolean pullDir (String deviceFilePath, 
                    File localDir)

    Recursively pull directory contents from device.

    مولفه های
    deviceFilePath String : the absolute file path of the remote source

    localDir File : the local directory to pull files into

    برمی گرداند
    boolean true if file was pulled successfully. false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    pullFile

    public boolean pullFile (String remoteFilePath, 
                    File localFile)

    Retrieves a file off device.

    مولفه های
    remoteFilePath String : the absolute path to file on device.

    localFile File : the local file to store contents in. If non-empty, contents will be replaced.

    برمی گرداند
    boolean true if file was retrieved successfully. false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    pullFile

    public File pullFile (String remoteFilePath, 
                    int userId)

    Retrieves a file off device, stores it in a local temporary ERROR(/File) , and returns that File .

    مولفه های
    remoteFilePath String : the absolute path to file on device.

    userId int : The user id to pull from

    برمی گرداند
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    پرتاب می کند
    DeviceNotAvailableException

    pullFile

    public File pullFile (String remoteFilePath)

    Retrieves a file off device, stores it in a local temporary ERROR(/File) , and returns that File .

    مولفه های
    remoteFilePath String : the absolute path to file on device.

    برمی گرداند
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    پرتاب می کند
    DeviceNotAvailableException

    pullFile

    public boolean pullFile (String remoteFilePath, 
                    File localFile, 
                    int userId)

    Retrieves a file off device.

    مولفه های
    remoteFilePath String : the absolute path to file on device.

    localFile File : the local file to store contents in. If non-empty, contents will be replaced.

    userId int : The user id to pull from

    برمی گرداند
    boolean true if file was retrieved successfully. false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    pullFileContents

    public String pullFileContents (String remoteFilePath)

    Retrieves a file off device, and returns the contents.

    مولفه های
    remoteFilePath String : the absolute path to file on device.

    برمی گرداند
    String A ERROR(/String) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    پرتاب می کند
    DeviceNotAvailableException

    pullFileFromExternal

    public File pullFileFromExternal (String remoteFilePath)

    A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File) , and return a reference to that File .

    مولفه های
    remoteFilePath String : the path to file on device, relative to the device's external storage mountpoint

    برمی گرداند
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    پرتاب می کند
    DeviceNotAvailableException

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath, 
                     excludedDirectories)

    Recursively push directory contents to device while excluding some directories that are filtered.

    مولفه های
    localFileDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

    excludedDirectories : Set of excluded directories names that shouldn't be pushed.

    برمی گرداند
    boolean true if file was pushed successfully. false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath)

    Recursively push directory contents to device.

    مولفه های
    localFileDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

    برمی گرداند
    boolean true if file was pushed successfully. false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath, 
                    boolean evaluateContentProviderNeeded)

    Variant of pushFile(File, String) which can optionally consider evaluating the need for the content provider.

    مولفه های
    localFile File : the local file to push

    remoteFilePath String : the remote destination absolute file path

    evaluateContentProviderNeeded boolean : whether to check if we need the content provider

    برمی گرداند
    boolean true if file was pushed successfully. false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath)

    Push a file to device. By default using a content provider.

    مولفه های
    localFile File : the local file to push

    remoteFilePath String : the remote destination absolute file path

    برمی گرداند
    boolean true if file was pushed successfully. false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    pushString

    public boolean pushString (String contents, 
                    String remoteFilePath)

    Push file created from a string to device

    مولفه های
    contents String : the contents of the file to push

    remoteFilePath String : the remote destination absolute file path

    برمی گرداند
    boolean true if string was pushed successfully. false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    reboot

    public void reboot (String reason)

    Reboots the device into adb mode with given reason to be persisted across reboot.

    Blocks until device becomes available.

    Last reboot reason can be obtained by querying sys.boot.reason propety.

    مولفه های
    reason String : a reason for this reboot, or null if no reason is specified.

    پرتاب می کند
    DeviceNotAvailableException

    reboot

    public void reboot ()

    Reboots the device into adb mode.

    Blocks until device becomes available.

    پرتاب می کند
    DeviceNotAvailableException

    rebootIntoBootloader

    public void rebootIntoBootloader ()

    Reboots the device into bootloader mode.

    Blocks until device is in bootloader mode.

    پرتاب می کند
    DeviceNotAvailableException

    rebootIntoFastbootd

    public void rebootIntoFastbootd ()

    Reboots the device into fastbootd mode.

    Blocks until device is in fastbootd mode.

    پرتاب می کند
    DeviceNotAvailableException

    rebootIntoRecovery

    public void rebootIntoRecovery ()

    Reboots the device into adb recovery mode.

    Blocks until device enters recovery

    پرتاب می کند
    DeviceNotAvailableException

    rebootIntoSideload

    public void rebootIntoSideload ()

    Reboots the device into adb sideload mode (note that this is a special mode under recovery)

    Blocks until device enters sideload mode

    پرتاب می کند
    DeviceNotAvailableException

    rebootIntoSideload

    public void rebootIntoSideload (boolean autoReboot)

    Reboots the device into adb sideload mode (note that this is a special mode under recovery)

    Blocks until device enters sideload mode

    مولفه های
    autoReboot boolean : whether to automatically reboot the device after sideload

    پرتاب می کند
    DeviceNotAvailableException

    rebootUntilOnline

    public void rebootUntilOnline ()

    An alternate to reboot() that only blocks until device is online ie visible to adb.

    پرتاب می کند
    DeviceNotAvailableException

    rebootUntilOnline

    public void rebootUntilOnline (String reason)

    An alternate to reboot() that only blocks until device is online ie visible to adb.

    مولفه های
    reason String : a reason for this reboot, or null if no reason is specified.

    پرتاب می کند
    DeviceNotAvailableException

    rebootUserspace

    public void rebootUserspace ()

    Reboots only userspace part of device.

    Blocks until device becomes available.

    WARNING. Userspace reboot is currently under active development, use it on your own risk.

    پرتاب می کند
    DeviceNotAvailableException

    rebootUserspaceUntilOnline

    public void rebootUserspaceUntilOnline ()

    An alternate to rebootUserspace() ()} that only blocks until device is online ie visible to adb.

    پرتاب می کند
    DeviceNotAvailableException

    بازیابی دستگاه

    public boolean recoverDevice ()

    تلاش برای بازیابی ارتباطات دستگاه

    برمی گرداند
    boolean اگر بازیابی انجام شود و موفقیت آمیز باشد درست است، اگر بازیابی نادیده گرفته شود، False را برمی‌گرداند

    پرتاب می کند
    DeviceNotAvailableException if device is no longer available

    registerDeviceActionReceiver

    public void registerDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)

    Registers a IDeviceActionReceiver for this device.

    All registered IDeviceActionReceiver s will be notified before a device action starts and after the device action ends.

    مولفه های
    deviceActionReceiver IDeviceActionReceiver : A IDeviceActionReceiver which will be registered.

    remountSystemWritable

    public void remountSystemWritable ()

    Make the system partition on the device writable. May reboot the device.

    پرتاب می کند
    DeviceNotAvailableException

    remountVendorWritable

    public void remountVendorWritable ()

    Make the vendor partition on the device writable. May reboot the device.

    پرتاب می کند
    DeviceNotAvailableException

    removeAdmin

    public boolean removeAdmin (String componentName, 
                    int userId)

    Remove given device admin in given user and return true if it is successful, false otherwise.

    مولفه های
    componentName String : of device admin to be removed.

    userId int : of user that the device admin lives in.

    برمی گرداند
    boolean True if it is successful, false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    removeOwners

    public void removeOwners ()

    Remove all existing device profile owners with the best effort.

    پرتاب می کند
    DeviceNotAvailableException

    removeUser

    public boolean removeUser (int userId)

    Remove a given user from the device.

    مولفه های
    userId int : of the user to remove

    برمی گرداند
    boolean true if we were successful in removing the user, false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    resetContentProviderSetup

    public void resetContentProviderSetup ()

    Reset the flag for content provider setup in order to trigger it again.

    runInstrumentationTests

    public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                    ITestLifeCycleReceiver... listeners)

    Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) with one or more listeners passed as parameters.

    مولفه های
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners ITestLifeCycleReceiver : the test result listener(s)

    برمی گرداند
    boolean true if test command completed. false if it failed to complete, but recovery succeeded

    پرتاب می کند
    DeviceNotAvailableException

    runInstrumentationTests

    public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                     listeners)

    Runs instrumentation tests, and provides device recovery.

    If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.

    If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.

    مولفه های
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners : the test result listeners

    برمی گرداند
    boolean true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded

    پرتاب می کند
    DeviceNotAvailableException

    runInstrumentationTestsAsUser

    public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, 
                    int userId, 
                     listeners)

    Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) but runs the test for the given user.

    مولفه های
    runner IRemoteAndroidTestRunner

    userId int

    listeners

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    runInstrumentationTestsAsUser

    public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, 
                    int userId, 
                    ITestLifeCycleReceiver... listeners)

    Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) but runs the test for a given user.

    مولفه های
    runner IRemoteAndroidTestRunner

    userId int

    listeners ITestLifeCycleReceiver

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    setConfiguration

    public void setConfiguration (IConfiguration configuration)

    Injects the IConfiguration in use.

    مولفه های
    configuration IConfiguration

    setDate

    public void setDate (Date date)

    Sets the date on device

    Note: setting date on device requires root

    مولفه های
    date Date : specify a particular date; will use host date if null

    پرتاب می کند
    DeviceNotAvailableException

    setDeviceOwner

    public boolean setDeviceOwner (String componentName, 
                    int userId)

    Set a device admin component as device owner in given user.

    مولفه های
    componentName String : of device admin to be device owner.

    userId int : of the user that the device owner lives in.

    برمی گرداند
    boolean True if it is successful, false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    setDeviceState

    public void setDeviceState (TestDeviceState deviceState)

    Update the device's state.

    مولفه های
    deviceState TestDeviceState : the TestDeviceState

    setEmulatorOutputStream

    public void setEmulatorOutputStream (SizeLimitedOutputStream output)

    For emulator set SizeLimitedOutputStream to log output

    مولفه های
    output SizeLimitedOutputStream : to log the output

    setEmulatorProcess

    public void setEmulatorProcess (Process p)

    Sets the ERROR(/Process) , when this device is an emulator.

    مولفه های
    p Process

    setFastbootEnabled

    public void setFastbootEnabled (boolean fastbootEnabled)

    Set the fastboot option for the device. Should be set when device is first allocated.

    مولفه های
    fastbootEnabled boolean : whether fastboot is available for the device or not

    setFastbootPath

    public void setFastbootPath (String fastbootPath)

    Sets the path to the fastboot binary that should be used. Still requires isFastbootEnabled() to be true, to have fastboot functions enabled.

    مولفه های
    fastbootPath String

    setIDevice

    public void setIDevice (IDevice newDevice)

    Update the IDevice associated with this ITestDevice.

    The new IDevice must refer the same physical device as the current reference. This method will be called if DDMS has allocated a new IDevice

    مولفه های
    newDevice IDevice : the IDevice

    setLogStartDelay

    public void setLogStartDelay (int delay)

    Sets the time in ms to wait before starting logcat capture for a online device.

    مولفه های
    delay int : the delay in ms

    setOptions

    public void setOptions (TestDeviceOptions options)

    Set the TestDeviceOptions for the device

    مولفه های
    options TestDeviceOptions

    setProperty

    public boolean setProperty (String propKey, 
                    String propValue)

    Sets the given property value on the device. Requires adb root is true.

    مولفه های
    propKey String : The key targeted to be set.

    propValue String : The property value to be set.

    برمی گرداند
    boolean returns True if the setprop command was successful, False otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    setRecovery

    public void setRecovery (IDeviceRecovery recovery)

    Set the IDeviceRecovery to use for this device. Should be set when device is first allocated.

    مولفه های
    recovery IDeviceRecovery : the IDeviceRecovery

    setRecoveryMode

    public void setRecoveryMode (ITestDevice.RecoveryMode mode)

    Set the current recovery mode to use for the device.

    Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etc

    مولفه های
    mode ITestDevice.RecoveryMode : whether 'recover till online only' mode should be on or not.

    setSetting

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

    See setSetting(int, String, String, String) and performed on system user.

    مولفه های
    namespace String

    key String

    value String

    پرتاب می کند
    DeviceNotAvailableException

    setSetting

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

    Add a setting value to the namespace of a given user. Some settings will only be available after a reboot. namespace must be one of: {"system", "secure", "global"}

    مولفه های
    userId int

    namespace String

    key String

    value String

    پرتاب می کند
    DeviceNotAvailableException

    setTestLogger

    public void setTestLogger (ITestLogger testLogger)

    Injects the ITestLogger instance

    مولفه های
    testLogger ITestLogger

    setUseFastbootErase

    public void setUseFastbootErase (boolean useFastbootErase)

    Set whether to use fastboot erase or fastboot format to wipe a partition on the device.

    مولفه های
    useFastbootErase boolean : true if fastboot erase should be used or false if fastboot format should be used.

    startLogcat

    public void startLogcat ()

    Start capturing logcat output from device in the background.

    Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat.

    When the device is no longer in use, stopLogcat() must be called.

    startLogcat() and stopLogcat() do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.

    startUser

    public boolean startUser (int userId)

    Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP.

    مولفه های
    userId int : of the user to start in the background

    برمی گرداند
    boolean true if the user was successfully started in the background.

    پرتاب می کند
    DeviceNotAvailableException

    startUser

    public boolean startUser (int userId, 
                    boolean waitFlag)

    Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP. Possible to provide extra flag to wait for the operation to have effect.

    مولفه های
    userId int : of the user to start in the background

    waitFlag boolean : will make the command wait until user is started and unlocked.

    برمی گرداند
    boolean true if the user was successfully started in the background.

    پرتاب می کند
    DeviceNotAvailableException

    startVisibleBackgroundUser

    public boolean startVisibleBackgroundUser (int userId, 
                    int displayId, 
                    boolean waitFlag)

    Starts a given user in the background, visible in the given display (ie, allowing the user to launch activities in that display).

    NOTE: this command doesn't check if the user exists, display is available, device supports such feature , etc.

    مولفه های
    userId int : of the user to start in the background

    displayId int : display to start user visible on

    waitFlag boolean : will make the command wait until user is started and unlocked.

    برمی گرداند
    boolean true if the user was successfully started visible in the background.

    پرتاب می کند
    DeviceNotAvailableException

    stopEmulatorOutput

    public void stopEmulatorOutput ()

    Close and delete the emulator output.

    stopLogcat

    public void stopLogcat ()

    Stop capturing logcat output from device, and discard currently saved logcat data.

    Will have no effect if logcat output is not being captured.

    stopUser

    public boolean stopUser (int userId)

    Stops a given user. If the user is already stopped, this method is a NOOP. Cannot stop current and system user.

    مولفه های
    userId int : of the user to stop.

    برمی گرداند
    boolean true if the user was successfully stopped.

    پرتاب می کند
    DeviceNotAvailableException

    stopUser

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

    Stop a given user. Possible to provide extra flags to wait for the operation to have effect, and force terminate the user. Cannot stop current and system user.

    مولفه های
    userId int : of the user to stop.

    waitFlag boolean : will make the command wait until user is stopped.

    forceFlag boolean : will force stop the user.

    برمی گرداند
    boolean true if the user was successfully stopped.

    پرتاب می کند
    DeviceNotAvailableException

    switchToAdbTcp

    public String switchToAdbTcp ()

    Switch device to adb-over-tcp mode.

    برمی گرداند
    String the tcp serial number or null if device could not be switched

    پرتاب می کند
    DeviceNotAvailableException

    switchToAdbUsb

    public boolean switchToAdbUsb ()

    Switch device to adb over usb mode.

    برمی گرداند
    boolean true if switch was successful, false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    switchUser

    public boolean switchUser (int userId)

    Switch to another userId with a default timeout. switchUser(int, long) .

    مولفه های
    userId int

    برمی گرداند
    boolean True if the new userId matches the userId provider. False otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    switchUser

    public boolean switchUser (int userId, 
                    long timeout)

    Switch to another userId with the provided timeout as deadline. Attempt to disable keyguard after user change is successful.

    مولفه های
    userId int

    timeout long : to wait before returning false for switch-user failed.

    برمی گرداند
    boolean True if the new userId matches the userId provider. False otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    syncFiles

    public boolean syncFiles (File localFileDir, 
                    String deviceFilePath)

    Incrementally syncs the contents of a local file directory to device.

    Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date.

    Hidden files (with names starting with ".") will be ignored.

    Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.

    مولفه های
    localFileDir File : the local file directory containing files to recursively push.

    deviceFilePath String : the remote destination absolute file path root. All directories in thos file path must be readable. ie pushing to /data/local/tmp when adb is not root will fail

    برمی گرداند
    boolean true if files were synced successfully. false otherwise.

    پرتاب می کند
    DeviceNotAvailableException

    takeBugreport

    public Bugreport takeBugreport ()

    Take a bugreport and returns it inside a Bugreport object to handle it. Return null in case of issue. File referenced in the Bugreport object need to be cleaned via Bugreport.close() .

    برمی گرداند
    Bugreport

    uninstallPackage

    public String uninstallPackage (String packageName)

    Uninstall an Android package from device.

    مولفه های
    packageName String : the Android package to uninstall

    برمی گرداند
    String a ERROR(/String) with an error code, or null if success.

    پرتاب می کند
    DeviceNotAvailableException

    uninstallPackageForUser

    public String uninstallPackageForUser (String packageName, 
                    int userId)

    Uninstall an Android package from device for a given user.

    مولفه های
    packageName String : the Android package to uninstall

    userId int : the integer user id to uninstall for.

    برمی گرداند
    String a ERROR(/String) with an error code, or null if success.

    پرتاب می کند
    DeviceNotAvailableException

    unlockDevice

    public boolean unlockDevice ()

    Unlocks the device if the device is in an encrypted state.

    This method may restart the framework but will not call postBootSetup() . Therefore, the device might not be fully ready to be tested when this method returns.

    برمی گرداند
    boolean true if successful or if the device is unencrypted.

    پرتاب می کند
    DeviceNotAvailableException

    waitForBootComplete

    public boolean waitForBootComplete (long timeOut)

    Blocks until the device's boot complete flag is set.

    مولفه های
    timeOut long : time in msecs to wait for the flag to be set

    برمی گرداند
    boolean true if device's boot complete flag is set within the timeout

    پرتاب می کند
    DeviceNotAvailableException

    waitForDeviceAvailable

    public boolean waitForDeviceAvailable ()

    Waits for the device to be responsive and available for testing. Uses default timeout.

    برمی گرداند
    boolean True if device is available, False if recovery is disabled and unavailable.

    پرتاب می کند
    DeviceNotAvailableException

    waitForDeviceAvailable

    public boolean waitForDeviceAvailable (long waitTime)

    Waits for the device to be responsive and available for testing.

    مولفه های
    waitTime long : the time in ms to wait

    برمی گرداند
    boolean True if device is available, False if recovery is disabled and unavailable.

    پرتاب می کند
    DeviceNotAvailableException

    waitForDeviceAvailableInRecoverPath

    public boolean waitForDeviceAvailableInRecoverPath (long waitTime)

    Waits for the device to be responsive and available without considering recovery path.

    مولفه های
    waitTime long

    برمی گرداند
    boolean True if device is available, False if unavailable.

    پرتاب می کند
    DeviceNotAvailableException

    waitForDeviceBootloader

    public void waitForDeviceBootloader ()

    Blocks until device is visible via fastboot. Use default timeout.

    پرتاب می کند
    DeviceNotAvailableException

    waitForDeviceInRecovery

    public boolean waitForDeviceInRecovery (long waitTime)

    Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery ).

    مولفه های
    waitTime long : the time in ms to wait

    برمی گرداند
    boolean true if device boots into recovery before time expires. false otherwise

    waitForDeviceInSideload

    public boolean waitForDeviceInSideload (long waitTime)

    Blocks for the device to be in the 'adb sideload' state

    مولفه های
    waitTime long : the time in ms to wait

    برمی گرداند
    boolean true if device boots into sideload before time expires. false otherwise

    waitForDeviceNotAvailable

    public boolean waitForDeviceNotAvailable (long waitTime)

    Blocks for the device to be not available ie missing from adb

    مولفه های
    waitTime long : the time in ms to wait

    برمی گرداند
    boolean true if device becomes not available before time expires. false otherwise

    waitForDeviceOnline

    public void waitForDeviceOnline ()

    Blocks until device is visible via adb. Uses default timeout

    Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable() instead.

    پرتاب می کند
    DeviceNotAvailableException

    waitForDeviceOnline

    public void waitForDeviceOnline (long waitTime)

    Blocks until device is visible via adb.

    Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable() instead.

    مولفه های
    waitTime long : the time in ms to wait

    پرتاب می کند
    DeviceNotAvailableException

    waitForDeviceShell

    public boolean waitForDeviceShell (long waitTime)

    Waits for device to be responsive to a basic adb shell command.

    مولفه های
    waitTime long : the time in ms to wait

    برمی گرداند
    boolean true if device becomes responsive before waitTime elapses.

    روش های محافظت شده

    buildAdbShellCommand

    protected String[] buildAdbShellCommand (String command, 
                    boolean forceExitStatusDetection)

    Builds the OS command for the given adb shell command session and args

    مولفه های
    command String

    forceExitStatusDetection boolean

    برمی گرداند
    String[]

    checkApiLevelAgainst

    protected void checkApiLevelAgainst (String feature, 
                    int strictMinLevel)

    مولفه های
    feature String

    strictMinLevel int

    createRebootDeviceAction

    protected NativeDevice.RebootDeviceAction createRebootDeviceAction (NativeDevice.RebootMode rebootMode, 
                    String reason)

    Create a RebootDeviceAction to be used when performing a reboot action.

    مولفه های
    rebootMode NativeDevice.RebootMode : حالتی از این راه‌اندازی مجدد.

    reason String : برای این راه اندازی مجدد.

    برمی گرداند
    NativeDevice.RebootDeviceAction the created RebootDeviceAction .

    createRunUtil

    protected IRunUtil createRunUtil ()

    برمی گرداند
    IRunUtil

    doAdbReboot

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

    یک راه اندازی مجدد adb انجام دهید.

    مولفه های
    rebootMode NativeDevice.RebootMode : حالتی از این راه‌اندازی مجدد.

    reason String : برای این راه اندازی مجدد.

    پرتاب می کند
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    ensureRuntimePermissionSupported

    protected void ensureRuntimePermissionSupported ()

    helper method to throw exception if runtime permission isn't supported

    پرتاب می کند
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    getApiLevelSafe

    protected int getApiLevelSafe ()

    برمی گرداند
    int

    getLogger

    protected ITestLogger getLogger ()

    برمی گرداند
    ITestLogger

    getRunUtil

    protected IRunUtil getRunUtil ()

    Get the RunUtil instance to use.

    برمی گرداند
    IRunUtil

    initializeConnection

    protected void initializeConnection (IBuildInfo info, 
                    MultiMap<String, String> attributes)

    مولفه های
    info IBuildInfo

    attributes MultiMap

    پرتاب می کند
    DeviceNotAvailableException
    TargetSetupError

    internalGetProperty

    protected String internalGetProperty (String propName, 
                    String fastbootVar, 
                    String description)

    Fetch a device property, from the ddmlib cache by default, and falling back to either `adb shell getprop` or `fastboot getvar` depending on whether the device is in Fastboot or not.

    مولفه های
    propName String : The name of the device property as returned by `adb shell getprop`

    fastbootVar String : The name of the equivalent fastboot variable to query. if null , fastboot query will not be attempted

    description String : A simple description of the variable. First letter should be capitalized.

    برمی گرداند
    String A string, possibly null or empty, containing the value of the given property

    پرتاب می کند
    DeviceNotAvailableException

    isInRebootCallback

    protected boolean isInRebootCallback ()

    Returns whether reboot callbacks is currently being executed or not. All public api's for reboot should be disabled if true.

    برمی گرداند
    boolean

    isNewer

    protected boolean isNewer (File localFile, 
                    IFileEntry entry)

    Return true if local file is newer than remote file. IFileEntry being accurate to the minute, in case of equal times, the file will be considered newer.

    مولفه های
    localFile File

    entry IFileEntry

    برمی گرداند
    boolean

    notifyRebootEnded

    protected void notifyRebootEnded ()

    Notifies all IDeviceActionReceiver about reboot end event.

    پرتاب می کند
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    notifyRebootStarted

    protected void notifyRebootStarted ()

    Notifies all IDeviceActionReceiver about reboot start event.

    پرتاب می کند
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    performDeviceAction

    protected boolean performDeviceAction (String actionDescription, 
                    NativeDevice.DeviceAction action, 
                    int retryAttempts)

    Performs an action on this device. Attempts to recover device and optionally retry command if action fails.

    مولفه های
    actionDescription String : a short description of action to be performed. Used for logging purposes only.

    action NativeDevice.DeviceAction : the action to be performed

    retryAttempts int : the retry attempts to make for action if it fails but recovery succeeds

    برمی گرداند
    boolean true if action was performed successfully

    پرتاب می کند
    DeviceNotAvailableException if recovery attempt fails or max attempts done without success

    postAdbReboot

    protected void postAdbReboot ()

    اقدامات اضافی احتمالی که می توان پس از راه اندازی مجدد انجام داد.

    پرتاب می کند
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    prePostBootSetup

    protected void prePostBootSetup ()

    Allows each device type (AndroidNativeDevice, TestDevice) to override this method for specific post boot setup.

    پرتاب می کند
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    pullFileInternal

    protected boolean pullFileInternal (String remoteFilePath, 
                    File localFile)

    مولفه های
    remoteFilePath String

    localFile File

    برمی گرداند
    boolean

    پرتاب می کند
    DeviceNotAvailableException

    setClock

    protected void setClock (Clock clock)

    Set the Clock instance to use.

    مولفه های
    clock Clock

    setMicrodroidProcess

    protected void setMicrodroidProcess (Process process)

    Marks the TestDevice as microdroid and sets its CID.

    مولفه های
    process Process : Process of the Microdroid VM.

    setTestDeviceOptions

    protected void setTestDeviceOptions ( deviceOptions)

    مولفه های
    deviceOptions

    simpleFastbootCommand

    protected CommandResult simpleFastbootCommand (long timeout, 
                     envVarMap, 
                    String[] fullCmd)

    Executes a simple fastboot command with environment variables and report the status of the command.

    مولفه های
    timeout long

    envVarMap

    fullCmd String

    برمی گرداند
    CommandResult

    simpleFastbootCommand

    protected CommandResult simpleFastbootCommand (long timeout, 
                    String[] fullCmd)

    Executes a simple fastboot command and report the status of the command.

    مولفه های
    timeout long

    fullCmd String

    برمی گرداند
    CommandResult

    waitForDeviceNotAvailable

    protected boolean waitForDeviceNotAvailable (String operationDesc, 
                    long time)

    Wait to see the device going unavailable (stop reporting to adb).

    مولفه های
    operationDesc String : The name of the operation that is waiting for unavailable.

    time long : The time to wait for unavailable to occur.

    برمی گرداند
    boolean True if device did become unavailable.