دستگاه بومی

public class NativeDevice
extends Object implements IConfigurationReceiver , IManagedTestDevice , ITestLoggerReceiver

شیء جاوا
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) برای راه اندازی مجدد دستگاه.

ثابت‌ها

String DEBUGFS_PATH

int INVALID_USER_ID

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

long MAX_HOST_DEVICE_TIME_OFFSET

int MAX_RETRY_ATTEMPTS

تعداد پیش‌فرض تلاش‌های مجدد برای اجرای دستور

String SD_CARD

String STORAGE_EMULATED

فیلدها

protected TestDeviceOptions mOptions

protected final IDeviceStateMonitor mStateMonitor

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

NativeDevice ( IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

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

روش‌های عمومی

void batchPrefetchStartupBuildProps ()

بهینه‌سازی میکرو (حدود ۴۰۰ میلی‌ثانیه) با پیش‌واکشی تمام propهایی که نیاز داریم به جای فراخوانی 'adb getprop' برای تک تک آنها.

boolean canSwitchToHeadlessSystemUser ()

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

boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

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

boolean checkConnectivity ()

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

boolean clearErrorDialogs ()

تلاش برای رد کردن هرگونه دیالوگ خطایی که در حال حاضر در رابط کاربری دستگاه نمایش داده می‌شود.

void clearLastConnectedWifiNetwork ()

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

void clearLogcat ()

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

boolean connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid)

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

boolean connectToWifiNetwork (String wifiSsid, String wifiPsk)

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

boolean 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)

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

int createUserNoThrow (String name)

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

DeviceInspectionResult debugDeviceNotAvailable ()

یک دستگاه را بررسی کنید و هنگامی که دستگاه از دسترس خارج می‌شود، اطلاعات دقیقی را برگردانید.

void deleteFile (String deviceFilePath, int userId)

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

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)

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

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

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

String executeAdbCommand (String... cmdArgs)

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

CommandResult executeAdbV2Command (String... cmdArgs)

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

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

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

CommandResult executeAdbV2Command (long timeout, envMap, String... cmdArgs)

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

CommandResult executeFastbootCommand (String... cmdArgs)

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

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

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

CommandResult executeLongFastbootCommand (String... cmdArgs)

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

CommandResult executeLongFastbootCommand ( envVarMap, String... cmdArgs)

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

String executeShellCommand (String command)

متد کمکی که یک دستور shell در adb را اجرا می‌کند و خروجی را به صورت String برمی‌گرداند.

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

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

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

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

void executeShellCommand (String command, IShellOutputReceiver receiver)

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

CommandResult executeShellV2Command (String cmd)

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

CommandResult executeShellV2Command (String cmd, OutputStream pipeToOutput)

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

CommandResult executeShellV2Command (String cmd, File pipeAsInput)

متد کمکی که یک دستور پوسته adb را اجرا می‌کند و نتایج را به عنوان یک CommandResult که به درستی با خروجی وضعیت دستور، stdout و stderr پر شده است، برمی‌گرداند.

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

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

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

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

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

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

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

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

CommandResult fastbootWipePartition (String partition)

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

getActiveApexes ()

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

String getAdbPath ()

مسیر فایل باینری adb مورد استفاده را برمی‌گرداند.

getAllSettings (String namespace)

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

DeviceAllocationState getAllocationState ()

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

String getAndroidId (int userId)

android-id مربوط به یک userId را پیدا کرده و برمی‌گرداند، در صورت عدم یافتن، null.

getAndroidIds ()

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

int getApiLevel ()

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

PackageInfo getAppPackageInfo (String packageName)

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

getAppPackageInfos ()

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

String getBasebandVersion ()

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

Integer getBattery ()

سطح باتری فعلی دستگاه را برمی‌گرداند و در صورت عدم وجود سطح باتری، مقدار Null را برمی‌گرداند.

boolean getBooleanProperty (String name, boolean defaultValue)

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

getBootHistory ()

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

getBootHistorySince (long utcEpochTime, TimeUnit timeUnit)

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

String getBootloaderVersion ()

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

InputStreamSource getBugreport ()

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

InputStreamSource getBugreportz ()

یک گزارش اشکال (bugreportz) را از دستگاه دریافت می‌کند.

String getBuildAlias ()

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

String getBuildFlavor ()

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

String getBuildId ()

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

String getBuildSigningKeys ()

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

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

DeviceDescriptor getCachedDeviceDescriptor ()

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

DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

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

String[] getChildren (String path)

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

AbstractConnection getConnection ()

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

ContentProviderHandler getContentProvider (int userId)

ContentProviderHandler را برمی‌گرداند یا در صورت موجود نبودن، null را برمی‌گرداند.

DeviceFoldableState getCurrentFoldableState ()

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

int getCurrentUser ()

شناسه (id) کاربر در حال اجرای فعلی را برمی‌گرداند.

String getDeviceClass ()

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

long getDeviceDate ()

تاریخ دستگاه را از زمان شروع (epoch) بر حسب میلی ثانیه برمی‌گرداند.

DeviceDescriptor getDeviceDescriptor ()

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

DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

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

TestDeviceState getDeviceState ()

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

long getDeviceTimeOffset (Date date)

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

InputStreamSource getEmulatorOutput ()

دریافت جریان خروجی استاندارد و خروجی استاندارد شبیه‌ساز

Process getEmulatorProcess ()

Process مربوط به این شبیه‌ساز را برمی‌گرداند.

final File getExecuteShellCommandLog ()

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

long getExternalStoreFreeSpace ()

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

String getFastbootPath ()

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

String getFastbootProductType ()

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

String getFastbootProductVariant ()

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

String getFastbootSerialNumber ()

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

String getFastbootVariable (String variableName)

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

String getFastbootVersion ()

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

IFileEntry getFileEntry (String path)

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

IFileEntry getFileEntry ( FileListingService.FileEntry entry)

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

getFoldableStates ()

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

IDevice getIDevice ()

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

getInstalledPackageNames ()

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

long getIntProperty (String name, long defaultValue)

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

String getIpAddress ()

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

KeyguardControllerState getKeyguardState ()

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

long getLastExpectedRebootTimeMillis ()

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

int getLaunchApiLevel ()

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

InputStreamSource getLogcat ()

یک جریان snapshot از داده‌های logcat می‌گیرد.

InputStreamSource getLogcat (int maxBytes)

یک جریان snapshot از آخرین maxBytes داده‌های logcat ضبط شده را می‌گیرد.

InputStreamSource getLogcatDump ()

یک نسخه از لاگ‌کت فعلی دستگاه را دریافت کنید.

InputStreamSource getLogcatSince (long date)

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

String getMacAddress ()

آدرس MAC دستگاه را برمی‌گرداند، در صورت عدم موفقیت در پرس‌وجو از دستگاه، مقدار null را برمی‌گرداند.

Integer getMainUserId ()

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

getMainlineModuleInfo ()

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

int getMaxNumberOfRunningUsersSupported ()

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

int getMaxNumberOfUsersSupported ()

حداکثر تعداد کاربران پشتیبانی شده را بدست آورید.

Process getMicrodroidProcess ()
IDeviceStateMonitor getMonitor ()

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

String getMountPoint (String mountName)

یک نقطه اتصال (mount point) را برمی‌گرداند.

ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

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

getMountPointInfo ()

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

TestDeviceOptions getOptions ()

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

long getPartitionFreeSpace (String partition)

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

Integer getPrimaryUserId ()

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

ProcessInfo getProcessByName (String processName)

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

String getProcessPid (String process)

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

String getProductType ()

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

String getProductVariant ()

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

String getProperty (String name)

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

ITestDevice.RecoveryMode getRecoveryMode ()

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

InputStreamSource getScreenshot (long displayId)

با توجه به شناسه نمایشگر (display id)، از دستگاه اسکرین‌شات می‌گیرد.

InputStreamSource getScreenshot (String format)

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

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 ()

اگر سیم‌کارت در دسترس نبود یا دستگاه در دسترس نبود، اپراتور سیم‌کارت یا null را برگردانید.

String getSimState ()

اگر سیم کارت در دسترس نیست یا دستگاه در دسترس نیست، وضعیت سیم کارت یا null را برمی‌گرداند.

getTombstones ()

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

long getTotalMemory ()

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

String getTrackingSerial ()

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

getUninstallablePackageNames ()

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

boolean getUseFastbootErase ()

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

int getUserFlags (int userId)

پرچم‌های یک کاربر مشخص را پیدا کرده و برمی‌گرداند.

getUserInfos ()

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

int getUserSerialNumber (int userId)

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

IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

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

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

boolean hasFeature (String feature)

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

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

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

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 installPackageWithIncrementalMode (File[] apkFiles, String[] extraArgs, String userId)

فایل‌های apk را با حالت افزایشی نصب می‌کند.

void invalidatePropertyCache ()
boolean isAdbRoot ()

boolean isAdbTcp ()
boolean isAppEnumerationSupported ()

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

boolean isBypassLowTargetSdkBlockSupported ()

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

boolean isDebugfsMounted ()

بررسی کنید که آیا debugfs نصب شده است یا خیر.

boolean isDeviceEncrypted ()

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

boolean isDirectory (String path)

اگر مسیر روی دستگاه یک دایرکتوری باشد، مقدار True و در غیر این صورت مقدار False را برمی‌گرداند.

boolean isEnableAdbRoot ()
boolean isEncryptionSupported ()

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

boolean isExecutable (String fullPath)

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

boolean isFastbootEnabled ()

اگر فست‌بوت برای دستگاه در دسترس بود، آن را برگردانید.

boolean isHeadless ()

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

boolean isHeadlessSystemUserMode ()

برمی‌گرداند که آیا دستگاه از حالت کاربر سیستم بدون سر (headless system user mode) استفاده می‌کند یا خیر.

boolean isMainUserPermanentAdmin ()

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

boolean isMultiUserSupported ()

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

boolean isPackageInstalled (String packageName, String userId)

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

boolean isPackageInstalled (String packageName)

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

boolean isRuntimePermissionSupported ()

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

boolean isStateBootloaderOrFastbootd ()

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

boolean isUserRunning (int userId)

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

boolean isUserSecondary (int userId)

بر اساس پرچم‌های (flags) کاربر مشخص شده، مشخص می‌کند که آیا او یک کاربر ثانویه است یا خیر.

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 mountDebugfs ()

نصب debugfs.

void nonBlockingReboot ()

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

void postAdbRootAction ()

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

void postAdbUnrootAction ()

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

void postBootSetup ()

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

void postInvocationTearDown (Throwable exception)

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

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

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

boolean pullDir (String deviceFilePath, File localDir, int userId)

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

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)

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

boolean pushDir (File localFileDir, String deviceFilePath)

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

boolean pushDir (File localFileDir, String deviceFilePath, int userId)

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

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

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

boolean pushFile (File localFile, String remoteFilePath)

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

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

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

boolean pushString (String contents, String remoteFilePath)

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

void reboot (String reason)

دستگاه را به حالت adb ریبوت می‌کند و reason داده شده برای ادامه‌ی این حالت در طول ریبوت را ارائه می‌دهد.

void reboot ()

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

void rebootIntoBootloader ()

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

void rebootIntoFastbootd ()

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

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 remountSystemReadOnly ()

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

void remountSystemWritable ()

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

void remountVendorReadOnly ()

پارتیشن vendor را روی دستگاه فقط خواندنی کنید.

void remountVendorWritable ()

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

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)

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

boolean 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 setAdbPath (String adbPath)

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

void setConfiguration ( IConfiguration configuration)

IConfiguration مورد استفاده را تزریق می‌کند.

final void setConnectionAvdInfo ( GceAvdInfo avdInfo)
void setDate (Date date)

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

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

boolean setDeviceOwner (String componentName, int userId)

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

void setDeviceState ( TestDeviceState deviceState)

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

void setEmulatorOutputStream ( SizeLimitedOutputStream output)

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

void setEmulatorProcess (Process p)

وقتی این دستگاه یک شبیه‌ساز است، Process را تنظیم می‌کند.

void setFastbootEnabled (boolean fastbootEnabled)

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

void setFastbootPath (String fastbootPath)

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

void setIDevice ( IDevice newDevice)

شناسه‌ی مرتبط با این 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 setTrackingSerial (String trackingSerial)

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

void setUseFastbootErase (boolean useFastbootErase)

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

void startLogcat ()

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

boolean startTradeInModeTesting (int timeoutMs)

حالت آزمایشی معاوضه را فعال کنید.

boolean startUser (int userId)

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

boolean startUser (int userId, boolean waitFlag)

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

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

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

void stopEmulatorOutput ()

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

void stopLogcat ()

ضبط خروجی logcat از دستگاه را متوقف کنید و داده‌های logcat ذخیره‌شده‌ی فعلی را حذف کنید.

void stopTradeInModeTesting ()

آزمایش حالت معاوضه را متوقف کنید.

boolean stopUser (int userId)

یک کاربر مشخص را متوقف می‌کند.

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

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

String switchToAdbTcp ()

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

boolean switchToAdbUsb ()

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

boolean switchUser (int userId)

به یک شناسه کاربری دیگر با زمان انقضای پیش‌فرض تغییر دهید.

boolean switchUser (int userId, long timeout)

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

boolean syncFiles (File localFileDir, String deviceFilePath)

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

Bugreport takeBugreport ()

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

String uninstallPackage (String packageName)

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

String uninstallPackageForUser (String packageName, int userId)

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

boolean unlockDevice ()

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

void unmountDebugfs ()

اشکال‌زدایی‌ها را از حالت مانت خارج کنید.

boolean waitForBootComplete (long timeOut)

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

boolean waitForDeviceAvailable ()

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

boolean waitForDeviceAvailable (long waitTime)

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

boolean waitForDeviceAvailableInRecoverPath (long waitTime)

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

void waitForDeviceBootloader ()

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

void waitForDeviceFastbootD ()
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 shell پاسخ دهد.

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

void addExtraConnectionBuilderArgs ( DefaultConnection.ConnectionBuilder builder)
String[] buildAdbShellCommand (String command, boolean forceExitStatusDetection)

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

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 را برای استفاده دریافت کنید.

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 ( NativeDevice.RebootMode rebootMode)

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

void prePostBootSetup ()

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

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

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

void setMicrodroidProcess (Process process)

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

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

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

CommandResult simpleFastbootCommand (long timeout, String[] fullCmd)

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

boolean waitForDeviceNotAvailable (String operationDesc, long time)

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

ثابت‌ها

اشکال‌زدایی_مسیر_اشکال‌زدایی

public static final String DEBUGFS_PATH

مقدار ثابت: "/sys/kernel/debug"

شناسه_کاربر_نامعتبر

public static final int INVALID_USER_ID

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

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

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

protected static final long MAX_HOST_DEVICE_TIME_OFFSET

مقدار ثابت: ۵۰۰۰ (۰x۰۰۰۰۰۰۰۰۰۰۰۱۳۸۸)

حداکثر زمان تلاش مجدد

protected static final int MAX_RETRY_ATTEMPTS

تعداد پیش‌فرض تلاش‌های مجدد برای اجرای دستور

مقدار ثابت: ۲ (۰x۰۰۰۰۰۰۲)

کارت حافظه

protected static final String SD_CARD

مقدار ثابت: "/sdcard/"

ذخیره‌سازی شبیه‌سازی‌شده

protected static final String STORAGE_EMULATED

مقدار ثابت: "/storage/emulated/"

فیلدها

گزینه‌های m

protected TestDeviceOptions mOptions

مانیتور وضعیت

protected final IDeviceStateMonitor mStateMonitor

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

دستگاه بومی

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

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

پارامترها
device IDevice : شناسه IDevice مرتبط

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

allocationMonitor IDeviceMonitor : IDeviceMonitor برای اطلاع‌رسانی در مورد تغییرات وضعیت تخصیص. می‌تواند تهی باشد.

روش‌های عمومی

batchPrefetchStartupBuildProps

public void batchPrefetchStartupBuildProps ()

بهینه‌سازی میکرو (حدود ۴۰۰ میلی‌ثانیه) با پیش‌واکشی تمام propهایی که نیاز داریم به جای فراخوانی 'adb getprop' برای هر کدام. یعنی واکشی تمام propertyها به همان سرعت واکشی یک property است. چیزهایی مانند device.getApiLevel()، checkApiLevelAgainstNextRelease و getBuildAlias ​​همگی 'adb getprop' را در پشت صحنه فراخوانی می‌کنند. ما آنها را در یک فراخوانی واکشی می‌کنیم و NativeDevice.setProperty را فراخوانی می‌کنیم. حتی اگر این کار را نکنیم، NativeDevice خودش setProperty را فراخوانی می‌کند و نتیجه را برای فراخوانی‌های آینده ذخیره می‌کند. ما فقط کمی زودتر این کار را انجام می‌دهیم. اگر دستگاه در حال بازیابی باشد یا خطاهای دیگری در واکشی propها وجود داشته باشد، آنها را نادیده می‌گیریم.

canSwitchToHeadlessSystemUser

public boolean canSwitchToHeadlessSystemUser ()

برمی‌گرداند که آیا مجاز به تغییر به کاربر headless 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

آخرین اتصالشبکه وای‌فای

public void clearLastConnectedWifiNetwork ()

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

clearLogcat

public void clearLogcat ()

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

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

connectToWifiNetwork

public boolean connectToWifiNetwork ( wifiSsidToPsk, 
                boolean scanSsid)

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

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

پارامترها
wifiSsidToPsk : نقشه‌ای از SSID های وای فای به رمزهای عبور.

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

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

پرتاب‌ها
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk)

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

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

پارامترها
wifiSsid String : شناسه شبکه وای‌فای (ssid) که قرار است به آن متصل شوید

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

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

پرتاب‌ها
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork ( wifiSsidToPsk)

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

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

پارامترها
wifiSsidToPsk : نقشه‌ای از SSID های وای فای به رمزهای عبور.

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

پرتاب‌ها
DeviceNotAvailableException

connectToWifiNetwork

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

ایجادکاربر

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

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

پارامترها
name String : از کاربر برای ایجاد در دستگاه

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

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

بازگشت‌ها
int شناسه کاربر ایجاد شده

پرتاب‌ها
DeviceNotAvailableException

ایجادکاربر

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

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

پارامترها
name String : از کاربر برای ایجاد در دستگاه

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

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

forTesting boolean : فعال کردن پرچم تست --for-testing در حین ایجاد

بازگشت‌ها
int شناسه کاربر ایجاد شده

پرتاب‌ها
DeviceNotAvailableException

ایجادکاربر

public int createUser (String name)

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

پارامترها
name String : از کاربر برای ایجاد در دستگاه

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

پرتاب‌ها
DeviceNotAvailableException

ایجادکاربربدون پرتاب

public int createUserNoThrow (String name)

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

پارامترها
name String : از کاربر برای ایجاد در دستگاه

بازگشت‌ها
int عدد صحیح برای شناسه کاربری ایجاد شده یا -۱ برای خطا.

پرتاب‌ها
DeviceNotAvailableException

اشکال‌زداییدستگاه در دسترس نیست

public DeviceInspectionResult debugDeviceNotAvailable ()

یک دستگاه را بررسی کنید و هنگامی که دستگاه از دسترس خارج می‌شود، اطلاعات دقیقی را برگردانید.

بازگشت‌ها
DeviceInspectionResult

حذف فایل

public void deleteFile (String deviceFilePath, 
                int userId)

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

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

userId int : شناسه کاربری که قرار است از آن حذف شود

پرتاب‌ها
DeviceNotAvailableException

حذف فایل

public void deleteFile (String deviceFilePath)

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

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

پرتاب‌ها
DeviceNotAvailableException

لغو ثبت نام دستگاه اقدام گیرنده

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

deviceSoftRestartشدهاز

public boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

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

پارامترها
utcEpochTime long : زمان دستگاه از زمان شروع به کار (epoch) به ثانیه.

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

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

پرتاب‌ها
DeviceNotAvailableException

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

public boolean disableAdbRoot ()

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

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

بازگشت‌ها
boolean در صورت موفقیت، true .

پرتاب‌ها
DeviceNotAvailableException

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

public void disableKeyguard ()

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

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

پرتاب‌ها
DeviceNotAvailableException

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

public boolean disableNetworkMonitor ()

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

بازگشت‌ها
boolean اگر مانیتورینگ با موفقیت غیرفعال شود، true و اگر ناموفق باشد false برمی‌گرداند.

پرتاب‌ها
DeviceNotAvailableException

قطع ارتباط از وای‌فای

public boolean disconnectFromWifi ()

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

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

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

پرتاب‌ها
DeviceNotAvailableException

آیافایل‌موجود است؟

public boolean doesFileExist (String deviceFilePath, 
                int userId)

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

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

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

بازگشت‌ها
boolean اگر فایل وجود داشته باشد، true و در غیر این صورت false .

پرتاب‌ها
DeviceNotAvailableException

آیافایل‌موجود است؟

public boolean doesFileExist (String deviceFilePath)

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

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

بازگشت‌ها
boolean اگر فایل وجود داشته باشد، true و در غیر این صورت false .

پرتاب‌ها
DeviceNotAvailableException

دامپ هیپ

public File dumpHeap (String process, 
                String devicePath)

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

پارامترها
process String : نام فرآیند دستگاهی که dumpheap روی آن اجرا می‌شود.

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

بازگشت‌ها
File ERROR(/File) حاوی گزارش. اگر چیزی با شکست مواجه شد، null.

پرتاب‌ها
DeviceNotAvailableException

فعال کردنAdbRoot

public boolean enableAdbRoot ()

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

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

بازگشت‌ها
boolean در صورت موفقیت، true .

پرتاب‌ها
DeviceNotAvailableException

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

public boolean enableNetworkMonitor ()

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

بازگشت‌ها
boolean اگر مانیتورینگ با موفقیت فعال شود، true اگر ناموفق باشد false برمی‌گرداند.

پرتاب‌ها
DeviceNotAvailableException

اجرای دستور Adb

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

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

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

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

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

بازگشت‌ها
String خروجی استاندارد از دستور. null اگر دستور اجرا نشد.

پرتاب‌ها
DeviceNotAvailableException

اجرای دستور Adb

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

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

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

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

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

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

بازگشت‌ها
String خروجی استاندارد از دستور. null اگر دستور اجرا نشد.

پرتاب‌ها
DeviceNotAvailableException

اجرای دستور Adb

public String executeAdbCommand (String... cmdArgs)

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

executeShellCommand(String) should be used instead wherever possible, as that method provides better failure detection and performance.

پارامترها
cmdArgs String : the adb command and arguments to run

بازگشت‌ها
String the stdout from command. null if command failed to execute.

پرتاب‌ها
DeviceNotAvailableException

executeAdbV2Command

public CommandResult executeAdbV2Command (String... cmdArgs)

Helper method which executes a adb command as a system command.

executeShellCommand(String) should be used instead wherever possible, as that method provides better failure detection and performance.

پارامترها
cmdArgs String : the adb command and arguments to run

بازگشت‌ها
CommandResult the CommandResult containing output of command.

پرتاب‌ها
DeviceNotAvailableException

executeAdbV2Command

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

Helper method which executes a adb command as a system command with a specified timeout.

executeShellCommand(String) should be used instead wherever possible, as that method provides better failure detection and performance.

پارامترها
timeout long : the time in milliseconds before the device is considered unresponsive, 0L for no timeout

cmdArgs String : the adb command and arguments to run

بازگشت‌ها
CommandResult the CommandResult containing output of command.

پرتاب‌ها
DeviceNotAvailableException

executeAdbV2Command

public CommandResult executeAdbV2Command (long timeout, 
                 envMap, 
                String... cmdArgs)

Helper method which executes a adb command as a system command with a specified timeout.

executeShellCommand(String) should be used instead wherever possible, as that method provides better failure detection and performance.

پارامترها
timeout long : the time in milliseconds before the device is considered unresponsive, 0L for no timeout

envMap : environment to set for the command

cmdArgs String : the adb command and arguments to run

بازگشت‌ها
CommandResult the CommandResult containing output of command.

پرتاب‌ها
DeviceNotAvailableException

executeFastbootCommand

public CommandResult executeFastbootCommand (String... cmdArgs)

Helper method which executes a fastboot command as a system command with a default timeout of 2 minutes.

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

پارامترها
cmdArgs String : the fastboot command and arguments to run

بازگشت‌ها
CommandResult the CommandResult containing output of command

پرتاب‌ها
DeviceNotAvailableException

executeFastbootCommand

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

Helper method which executes a fastboot command as a system command.

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

پارامترها
timeout long : the time in milliseconds before the command expire

cmdArgs String : the fastboot command and arguments to run

بازگشت‌ها
CommandResult the CommandResult containing output of command

پرتاب‌ها
DeviceNotAvailableException

executeLongFastbootCommand

public CommandResult executeLongFastbootCommand (String... cmdArgs)

Helper method which executes a long running fastboot command as a system command.

Identical to executeFastbootCommand(String) except uses a longer timeout.

پارامترها
cmdArgs String : the fastboot command and arguments to run

بازگشت‌ها
CommandResult the CommandResult containing output of command

پرتاب‌ها
DeviceNotAvailableException

executeLongFastbootCommand

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

Helper method which executes a long running fastboot command as a system command with system environment variables.

Identical to executeFastbootCommand(String) except uses a longer timeout.

پارامترها
envVarMap : the system environment variables that the fastboot command run with

cmdArgs String : the fastboot command and arguments to run

بازگشت‌ها
CommandResult the CommandResult containing output of command

پرتاب‌ها
DeviceNotAvailableException

executeShellCommand

public String executeShellCommand (String command)

Helper method which executes a adb shell command and returns output as a String .

پارامترها
command String : the adb shell command to run

بازگشت‌ها
String the shell output

پرتاب‌ها
DeviceNotAvailableException

executeShellCommand

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

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

پارامترها
command String : the adb shell command to run

receiver IShellOutputReceiver : the IShellOutputReceiver to direct shell output to.

maxTimeToOutputShellResponse long : the maximum amount of time during which the command is allowed to not output any response; 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.

پرتاب‌ها
DeviceNotAvailableException

executeShellCommand

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

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

پارامترها
command String : the adb shell command to run

receiver IShellOutputReceiver : the IShellOutputReceiver to direct shell output to.

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

maxTimeToOutputShellResponse long : the maximum amount of time during which the command is allowed to not output any response; 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.

پرتاب‌ها
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

getAdbPath

public String getAdbPath ()

Returns the path of the adb binary being used.

بازگشت‌ها
String

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 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 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

دریافت اتصال

public AbstractConnection getConnection ()

The current connection associated with the device.

بازگشت‌ها
AbstractConnection

getContentProvider

public ContentProviderHandler getContentProvider (int userId)

Returns the ContentProviderHandler or null if not available.

Content provider can be reused if it was constructed before with the same userId .

پارامترها
userId int : the user id to initialize the content provider with.

بازگشت‌ها
ContentProviderHandler

پرتاب‌ها
DeviceNotAvailableException

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 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 ()

Return a DeviceDescriptor from the device information to get info on it without passing the actual device object.

بازگشت‌ها
DeviceDescriptor

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

Return a DeviceDescriptor from the device information to get info on it without passing the actual device object.

پارامترها
shortDescriptor boolean : Whether or not to limit descriptor to bare minimum info

بازگشت‌ها
DeviceDescriptor

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

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 Process corresponding to this emulator.

بازگشت‌ها
Process the 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 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 String product type name or null if it cannot be determined

پرتاب‌ها
DeviceNotAvailableException

دریافت شماره سریال Fastboot

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

دریافت دستگاه

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 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 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 : حداکثر مقدار داده‌ای که باید برگردانده شود. باید مقداری باشد که به راحتی در حافظه جا شود.

    بازگشت‌ها
    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 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

    دریافت نقطه اتصال

    public String getMountPoint (String mountName)

    یک نقطه اتصال (mount point) را برمی‌گرداند.

    اگر اطلاعات ذخیره شده در IDevice در دسترس نباشد، مستقیماً از دستگاه پرس و جو می‌کند.

    TODO: این رفتار را به IDevice.getMountPoint(String) منتقل کنید

    پارامترها
    mountName String : نام نقطه اتصال

    بازگشت‌ها
    String نقطه اتصال یا 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

    گزینه‌ها را دریافت کنید

    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 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 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 (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)

    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 (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

    دریافت شماره سریال

    public String getSerialNumber ()

    Convenience method to get serial number of this device.

    بازگشت‌ها
    String the 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

    getTombstones

    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.

    بازگشت‌ها
    A list of tombstone files, empty if no tombstone.

    پرتاب‌ها
    DeviceNotAvailableException

    getTotalMemory

    public long getTotalMemory ()

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

    بازگشت‌ها
    long

    getTrackingSerial

    public String getTrackingSerial ()

    For device management purpose get the serial used to track the device.

    بازگشت‌ها
    String

    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 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

    initializeConnection

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

    Initialize the connection to the device. This is called by preInvocationSetup but in rare cases might need to be called separately when creating the connection during device setup.

    پارامترها
    info IBuildInfo

    attributes MultiMap

    پرتاب‌ها
    DeviceNotAvailableException
    TargetSetupError

    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 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 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 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 String with an error code, or null if success.

    پرتاب‌ها
    DeviceNotAvailableException

    installPackageWithIncrementalMode

    public boolean installPackageWithIncrementalMode (File[] apkFiles, 
                    String[] extraArgs, 
                    String userId)

    Installs apks with incremental mode.

    پارامترها
    apkFiles File : the apk files to install.

    extraArgs String

    userId String

    بازگشت‌ها
    boolean

    پرتاب‌ها
    DeviceNotAvailableException

    invalidatePropertyCache

    public void invalidatePropertyCache ()

    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

    isDebugfsMounted

    public boolean isDebugfsMounted ()

    Check if debugfs is mounted.

    بازگشت‌ها
    boolean true if debugfs is mounted

    پرتاب‌ها
    DeviceNotAvailableException

    isDeviceEncrypted

    public boolean isDeviceEncrypted ()

    Returns if the device is encrypted.

    بازگشت‌ها
    boolean true if the device is encrypted.

    پرتاب‌ها
    DeviceNotAvailableException

    ایس دایرکتور

    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().

    mountDebugfs

    public void mountDebugfs ()

    Mount debugfs.

    پرتاب‌ها
    DeviceNotAvailableException

    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)

    Extra steps for device specific required clean up that will be executed after the invocation is done.

    پارامترها
    exception Throwable : if any, the final exception raised by the invocation failure.

    preInvocationSetup

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

    Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.

    پارامترها
    info IBuildInfo : The IBuildInfo of the device.

    attributes MultiMap : The attributes stored in the invocation context

    پرتاب‌ها
    DeviceNotAvailableException
    TargetSetupError

    pullDir

    public boolean pullDir (String deviceFilePath, 
                    File localDir, 
                    int userId)

    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

    userId int : the user id to pull from

    بازگشت‌ها
    boolean true if file was pulled successfully. false otherwise.

    پرتاب‌ها
    DeviceNotAvailableException

    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.

    Throws
    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.

    Throws
    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 String containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

    Throws
    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)

    Throws
    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.

    Throws
    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.

    Throws
    DeviceNotAvailableException

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath, 
                    int userId)

    Recursively push directory contents to device.

    پارامترها
    localFileDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

    userId int : the user id to push to

    بازگشت‌ها
    boolean true if file was pushed successfully. false otherwise.

    Throws
    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.

    Throws
    DeviceNotAvailableException

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath, 
                    int userId)

    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

    userId int : the userId to push to

    بازگشت‌ها
    boolean true if file was pushed successfully. false otherwise.

    Throws
    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.

    Throws
    DeviceNotAvailableException

    راه اندازی مجدد

    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.

    Throws
    DeviceNotAvailableException

    راه اندازی مجدد

    public void reboot ()

    Reboots the device into adb mode.

    Blocks until device becomes available.

    Throws
    DeviceNotAvailableException

    rebootIntoBootloader

    public void rebootIntoBootloader ()

    Reboots the device into bootloader mode.

    Blocks until device is in bootloader mode.

    Throws
    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

    Throws
    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

    Throws
    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

    Throws
    DeviceNotAvailableException

    rebootUntilOnline

    public void rebootUntilOnline ()

    An alternate to reboot() that only blocks until device is online ie visible to adb.

    Throws
    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.

    Throws
    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.

    Throws
    DeviceNotAvailableException

    recoverDevice

    public boolean recoverDevice ()

    Attempts to recover device communication.

    بازگشت‌ها
    boolean True if recovery attempted and successful, returns False if recovery was skipped

    Throws
    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.

    remountSystemReadOnly

    public void remountSystemReadOnly ()

    Make the system partition on the device read-only. May reboot the device.

    Throws
    DeviceNotAvailableException

    remountSystemWritable

    public void remountSystemWritable ()

    Make the system partition on the device writable. May reboot the device.

    Throws
    DeviceNotAvailableException

    remountVendorReadOnly

    public void remountVendorReadOnly ()

    Make the vendor partition on the device read-only. May reboot the device.

    Throws
    DeviceNotAvailableException

    remountVendorWritable

    public void remountVendorWritable ()

    Make the vendor partition on the device writable. May reboot the device.

    Throws
    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.

    Throws
    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.

    Throws
    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

    Throws
    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

    Throws
    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

    Throws
    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

    Throws
    DeviceNotAvailableException

    setAdbPath

    public void setAdbPath (String adbPath)

    Sets the path to the adb binary that should be used.

    پارامترها
    adbPath String

    پیکربندی set

    public void setConfiguration (IConfiguration configuration)

    IConfiguration مورد استفاده را تزریق می‌کند.

    پارامترها
    configuration IConfiguration

    setConnectionAvdInfo

    public final void setConnectionAvdInfo (GceAvdInfo avdInfo)

    پارامترها
    avdInfo GceAvdInfo

    تنظیم تاریخ

    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

    Throws
    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 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

    تنظیم IDevice

    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.

    Throws
    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

    Throws
    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

    Throws
    DeviceNotAvailableException

    setTestLogger

    public void setTestLogger (ITestLogger testLogger)

    Injects the ITestLogger instance

    پارامترها
    testLogger ITestLogger

    setTrackingSerial

    public void setTrackingSerial (String trackingSerial)

    For device management purpose track the serial we use for referencing the device.

    پارامترها
    trackingSerial String

    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.

    startTradeInModeTesting

    public boolean startTradeInModeTesting (int timeoutMs)

    Enable testing trade-in mode. The device will be wiped and will reboot.

    پارامترها
    timeoutMs int

    بازگشت‌ها
    boolean True if we were successful, false otherwise

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    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.

    Throws
    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.

    Throws
    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.

    Throws
    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.

    stopTradeInModeTesting

    public void stopTradeInModeTesting ()

    Stop trade-in mode testing.

    پرتاب‌ها
    DeviceNotAvailableException

    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.

    Throws
    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.

    Throws
    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

    Throws
    DeviceNotAvailableException

    switchToAdbUsb

    public boolean switchToAdbUsb ()

    Switch device to adb over usb mode.

    بازگشت‌ها
    boolean true if switch was successful, false otherwise.

    Throws
    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.

    Throws
    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.

    Throws
    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 String with an error code, or null if success.

    Throws
    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 String with an error code, or null if success.

    Throws
    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.

    Throws
    DeviceNotAvailableException

    unmountDebugfs

    public void unmountDebugfs ()

    Unmount debugfs.

    Throws
    DeviceNotAvailableException

    صبر کن تا بوت کامل شود

    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

    Throws
    DeviceNotAvailableException

    waitForDeviceموجود است

    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.

    Throws
    DeviceNotAvailableException

    waitForDeviceموجود است

    public boolean waitForDeviceAvailable (long waitTime)

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

    پارامترها
    waitTime long : مدت زمان انتظار بر حسب میلی‌ثانیه

    بازگشت‌ها
    boolean True if device is available, False if recovery is disabled and unavailable.

    Throws
    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.

    Throws
    DeviceNotAvailableException

    waitForDeviceبوت‌لودر

    public void waitForDeviceBootloader ()

    Blocks until device is visible via fastboot. Use default timeout.

    پرتاب‌ها
    DeviceNotAvailableException

    waitForDeviceFastbootD

    public void waitForDeviceFastbootD ()

    Throws
    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 : مدت زمان انتظار بر حسب میلی‌ثانیه

    بازگشت‌ها
    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 : مدت زمان انتظار بر حسب میلی‌ثانیه

    بازگشت‌ها
    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 : مدت زمان انتظار بر حسب میلی‌ثانیه

    بازگشت‌ها
    boolean true if device becomes not available before time expires. false otherwise

    waitForDeviceآنلاین

    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.

    Throws
    DeviceNotAvailableException

    waitForDeviceآنلاین

    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 : مدت زمان انتظار بر حسب میلی‌ثانیه

    Throws
    DeviceNotAvailableException

    waitForDeviceShell

    public boolean waitForDeviceShell (long waitTime)

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

    پارامترها
    waitTime long : مدت زمان انتظار بر حسب میلی‌ثانیه

    بازگشت‌ها
    boolean اگر دستگاه قبل از گذشت waitTime پاسخگو شود، true .

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

    addExtraConnectionBuilderArgs

    protected void addExtraConnectionBuilderArgs (DefaultConnection.ConnectionBuilder builder)

    پارامترها
    builder DefaultConnection.ConnectionBuilder

    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 : a mode of this reboot.

    reason String : for this reboot.

    بازگشت‌ها
    NativeDevice.RebootDeviceAction the created RebootDeviceAction .

    createRunUtil

    protected IRunUtil createRunUtil ()

    بازگشت‌ها
    IRunUtil

    doAdbReboot

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

    Perform a adb reboot.

    پارامترها
    rebootMode NativeDevice.RebootMode : a mode of this reboot.

    reason String : for this reboot.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    ensureRuntimePermissionSupported

    protected void ensureRuntimePermissionSupported ()

    helper method to throw exception if runtime permission isn't supported

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    getApiLevelSafe

    protected int getApiLevelSafe ()

    بازگشت‌ها
    int

    getLogger

    protected ITestLogger getLogger ()

    بازگشت‌ها
    ITestLogger

    دریافت RunUtil

    protected IRunUtil getRunUtil ()

    Get the RunUtil instance to use.

    بازگشت‌ها
    IRunUtil

    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

    Throws
    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.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    notifyRebootStarted

    protected void notifyRebootStarted ()

    Notifies all IDeviceActionReceiver about reboot start event.

    Throws
    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 (NativeDevice.RebootMode rebootMode)

    Possible extra actions that can be taken after a reboot.

    پارامترها
    rebootMode NativeDevice.RebootMode

    Throws
    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.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    pullFileInternal

    protected boolean pullFileInternal (String remoteFilePath, 
                    File localFile)

    پارامترها
    remoteFilePath String

    localFile File

    بازگشت‌ها
    boolean

    Throws
    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.