NativeDevice
public class NativeDevice
extends Object
implements IManagedTestDevice , IConfigurationReceiver
java.lang.Object | |
↳ | com.android.tradefed.device.NativeDevice |
יישום ברירת מחדל של ITestDevice
מכשירי אנדרואיד שאינם מחסנית מלאה.
סיכום
כיתות מקוננות | |
---|---|
class | NativeDevice.AdbAction |
class | NativeDevice.AdbShellAction |
class | NativeDevice.RebootDeviceAction |
enum | NativeDevice.RebootMode מצב של אתחול מחדש. |
קבועים | |
---|---|
int | INVALID_USER_ID ערך שהוחזר עבור כל מזהה משתמש לא חוקי/לא נמצא: UserHandle הגדיר את הערך -10000 |
long | MAX_HOST_DEVICE_TIME_OFFSET |
int | MAX_RETRY_ATTEMPTS מספר ברירת המחדל של ניסיונות ניסיון חוזר של פקודה לבצע |
שדות | |
---|---|
protected static final String | SD_CARD |
protected static final String | STORAGE_EMULATED |
protected TestDeviceOptions | mOptions |
protected final IDeviceStateMonitor | mStateMonitor
|
בנאים ציבוריים | |
---|---|
NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor) יוצר מכשיר |
שיטות ציבוריות | |
---|---|
boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) בדוק אם תכונה נתמכת כרגע או לא בהינתן רמה נתמכת מינימלית. |
boolean | checkConnectivity () בדוק שלמכשיר יש קישוריות רשת. |
boolean | clearErrorDialogs () נסה לבטל את כל תיבת הדו-שיח של שגיאה המוצגת כעת בממשק המשתמש של המכשיר. |
void | clearLastConnectedWifiNetwork () מנקה את רשת ה-WiFi המחוברת האחרונה. |
void | clearLogcat () מוחק כל נתוני logcat שנצברו. |
boolean | connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) מתחבר לרשת wifi. |
boolean | connectToWifiNetwork (String wifiSsid, String wifiPsk) מתחבר לרשת wifi. |
boolean | connectToWifiNetwork ( wifiSsidToPsk) connectToWifiNetwork ( wifiSsidToPsk) מתחבר לרשת wifi.f |
boolean | connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid) מתחבר לרשת wifi. |
boolean | connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid) גרסה של |
boolean | connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk) גרסה של |
int | createUser (String name, boolean guest, boolean ephemeral) צור משתמש עם שם נתון והדגלים שסופקו |
int | createUser (String name) צור משתמש עם שם נתון ודגלי ברירת מחדל 0. |
int | createUserNoThrow (String name) צור משתמש עם שם נתון ודגלי ברירת מחדל 0. |
void | deleteFile (String deviceFilePath) שיטת עוזר למחיקת קובץ או ספרייה במכשיר. |
boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) שיטת עוזר לבדוק אם ההתקן הופעל מחדש על ידי השוואת system_server הנוכחי עם system_server הקודם |
boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) שיטת עוזר לבדוק אם המכשיר הופעל מחדש מאז זמן UTC מאז התקופה מהמכשיר וה- |
boolean | disableAdbRoot () מכבה את ה-adb root. |
void | disableKeyguard () ניסיונות להשבית את מגן המקשים. |
boolean | disableNetworkMonitor () משבית את ניטור הרשת במכשיר. |
boolean | disconnectFromWifi () מתנתק מרשת wifi. |
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 (String... cmdArgs) שיטת עוזר המבצעת פקודת adb כפקודת מערכת. |
CommandResult | executeFastbootCommand (String... cmdArgs) שיטת עוזר המבצעת פקודת fastboot כפקודת מערכת עם פסק זמן ברירת מחדל של 2 דקות. |
CommandResult | executeFastbootCommand (long timeout, String... cmdArgs) שיטת עוזר המבצעת פקודת fastboot בתור פקודת מערכת. |
CommandResult | executeLongFastbootCommand ( envVarMap, String... cmdArgs) executeLongFastbootCommand ( envVarMap, String... cmdArgs) שיטת עוזר המבצעת פקודת fastboot ארוכת שנים כפקודה מערכת עם משתני סביבת מערכת. |
CommandResult | executeLongFastbootCommand (String... cmdArgs) שיטת עוזר המבצעת פקודת fastboot שפועלת לאורך זמן בתור פקודת מערכת. |
String | executeShellCommand (String command) שיטת Helper שמבצעת פקודת adb shell ומחזירה פלט |
void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
void | executeShellCommand (String command, IShellOutputReceiver receiver) מבצע את פקודת ה-adb shell הנתונה, מנסה שוב מספר פעמים אם הפקודה נכשלת. |
CommandResult | executeShellV2Command (String cmd) שיטת Helper אשר מבצעת פקודת adb shell ומחזירה את התוצאות כ- |
CommandResult | executeShellV2Command (String cmd, OutputStream pipeToOutput) שיטת Helper המבצעת פקודת adb shell ומחזירה את התוצאות כ- |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput) שיטת Helper אשר מבצעת פקודת adb shell ומחזירה את התוצאות כ- |
CommandResult | executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
CommandResult | executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
CommandResult | fastbootWipePartition (String partition) שיטת עוזר המנגבת מחיצה למכשיר. |
getActiveApexes () אחזר את המידע על APEXs שהופעלו במכשיר. | |
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 () מאחזר דוח באג מהמכשיר. |
InputStreamSource | getBugreportz () מאחזר דיווח באג מהמכשיר. |
String | getBuildAlias () אחזר את הכינוי של ה-build שהמכשיר פועל כעת. |
String | getBuildFlavor () אחזר את טעם המבנה של המכשיר. |
String | getBuildId () אחזר את ה-build שהמכשיר פועל כעת. |
String | getBuildSigningKeys () מחזירה את סוג המפתח המשמש לחתימה על תמונת המכשיר בדרך כלל מכשירי אנדרואיד עשויים להיות חתומים עם מפתחות בדיקה (כמו ב-AOSP) או מפתחות שחרור (נשלטים על ידי יצרני מכשירים בודדים) |
DeviceDescriptor | getCachedDeviceDescriptor () מחזיר |
DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) מחזיר |
String[] | getChildren (String path) חלופה לשימוש ב- |
DeviceFoldableState | getCurrentFoldableState () מחזיר את המצב המתקפל הנוכחי של המכשיר או null אם התרחשו בעיות מסוימות. |
int | getCurrentUser () החזר את המזהה של המשתמש הנוכחי הפועל. |
String | getDeviceClass () קבל את שיעור המכשיר. |
long | getDeviceDate () החזר את תאריך המכשיר באלפי שניות מאז התקופה. |
DeviceDescriptor | getDeviceDescriptor () החזר |
DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) החזר |
TestDeviceState | getDeviceState () קבל את מצב המכשיר. |
long | getDeviceTimeOffset (Date date) עוזר לקבל את הפרש הזמן בין המכשיר לבין |
InputStreamSource | getEmulatorOutput () קבל את הזרם של emulator stdout ו-stderr |
Process | getEmulatorProcess () החזר את |
final File | getExecuteShellCommandLog () היומן המכיל את כל |
long | getExternalStoreFreeSpace () שיטת עוזר לקביעת כמות השטח הפנוי באחסון החיצוני של המכשיר. |
String | getFastbootPath () מחזירה את הנתיב של ה-fastboot הבינארי שבו נעשה שימוש. |
String | getFastbootProductType () שיטת נוחות לקבל את סוג המוצר של מכשיר זה כשהוא במצב אתחול מהיר. |
String | getFastbootProductVariant () שיטת נוחות לקבל את סוג המוצר של מכשיר זה כשהוא במצב אתחול מהיר. |
String | getFastbootSerialNumber () מחזיר את המספר הסידורי של מצב האתחול המהיר. |
String | getFastbootVariable (String variableName) אחזר את ערך משתנה fastboot הנתון מהמכשיר. |
String | getFastbootVersion () מחזירה את מחרוזת הגרסה של ה-fastboot הבינארי שבו נעשה שימוש. |
IFileEntry | getFileEntry (String path) אחזר הפניה לקובץ מרוחק במכשיר. |
IFileEntry | getFileEntry (FileListingService.FileEntry entry) עוזר לא רשמי לקבל |
getFoldableStates () מחזירה את רשימת המצבים הניתנים לקיפול במכשיר. | |
IDevice | getIDevice () מחזירה הפניה ל- |
getInstalledPackageNames () אחזר את שמות חבילות היישומים הקיימים במכשיר. | |
long | getIntProperty (String name, long defaultValue) מחזירה ערך מספר שלם של המאפיין הנתון מהמכשיר. |
String | getIpAddress () מקבל את כתובת ה-IP של המכשיר. |
KeyguardControllerState | getKeyguardState () החזר אובייקט כדי לקבל את המצב הנוכחי של מגן המקשים או null אם לא נתמך. |
long | getLastExpectedRebootTimeMillis () מחזירה את הפעם האחרונה שבה ממשקי API של Tradefed הפעילו אתחול מחדש באלפיות שניות מאז EPOCH כפי שהוחזר על ידי |
int | getLaunchApiLevel () קבל את רמת ה-API הראשונה שהושקה במכשיר. |
InputStreamSource | getLogcat () תופס זרם תמונת מצב של נתוני logcat. |
InputStreamSource | getLogcat (int maxBytes) תופס זרם תמונת מצב של |
InputStreamSource | getLogcatDump () קבל dump של ה-logcat הנוכחי עבור המכשיר. |
InputStreamSource | getLogcatSince (long date) תופס זרם תמונת מצב של נתוני logcat שנלכדו החל מהתאריך שסופק. |
String | getMacAddress () מחזירה את כתובת ה-MAC של המכשיר, null אם היא לא מצליחה לבצע שאילתה מהמכשיר. |
getMainlineModuleInfo () קבל את המידע על המודולים המרכזיים המותקנים במכשיר. | |
int | getMaxNumberOfRunningUsersSupported () קבל את המספר המרבי של משתמשים שפועלים בו זמנית. |
int | getMaxNumberOfUsersSupported () קבל את המספר המרבי של משתמשים נתמכים. |
IDeviceStateMonitor | getMonitor () החזר את |
String | getMountPoint (String mountName) מחזירה נקודת הרכבה. |
ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) מחזירה |
getMountPointInfo () מחזירה גרסה מנותחת של המידע ב-/proc/mounts במכשיר | |
TestDeviceOptions | getOptions () אחזר את אפשרויות הבדיקה של המכשיר. |
long | getPartitionFreeSpace (String partition) שיטת עוזר לקביעת כמות השטח הפנוי במחיצת המכשיר. |
Integer | getPrimaryUserId () מחזירה את מזהה המשתמש הראשי. |
ProcessInfo | getProcessByName (String processName) שיטת Helper מפעילה את הפקודה "pidof" ו-"stat" ומחזירה אובייקט |
String | getProcessPid (String process) מחזיר את ה-pid של השירות או null אם משהו השתבש. |
String | getProductType () שיטת נוחות לקבל את סוג המוצר של מכשיר זה. |
String | getProductVariant () שיטת נוחות לקבל את גרסת המוצר של מכשיר זה. |
String | getProperty (String name) אחזר את ערך המאפיין הנתון מהמכשיר. |
ITestDevice.RecoveryMode | getRecoveryMode () קבל את מצב השחזור הנוכחי המשמש עבור המכשיר. |
InputStreamSource | getScreenshot (String format) תופס צילום מסך מהמכשיר. |
InputStreamSource | getScreenshot (long displayId) תופס צילום מסך מהמכשיר שקיבל מזהה תצוגה. |
InputStreamSource | getScreenshot (String format, boolean rescale) תופס צילום מסך מהמכשיר. |
InputStreamSource | getScreenshot () תופס צילום מסך מהמכשיר. |
String | getSerialNumber () שיטת נוחות לקבלת מספר סידורי של מכשיר זה. |
String | getSetting (int userId, String namespace, String key) החזר את הערך של ההגדרה המבוקשת. |
String | getSetting (String namespace, String key) ראה |
String | getSimOperator () החזר את מפעיל כרטיס ה-SIM או null אם אינו זמין או אם המכשיר אינו זמין. |
String | getSimState () החזר את מצב כרטיס ה-SIM או null אם אינו זמין או שהמכשיר אינו זמין. |
getTombstones () אחזר והחזר את רשימת המצבות מהמכשירים. | |
long | getTotalMemory () מחזירה את גודל הזיכרון הפיזי הכולל בבתים או -1 במקרה של שגיאה פנימית |
getUninstallablePackageNames () אחזר את שמות חבילות האפליקציות שניתן להסיר. | |
boolean | getUseFastbootErase () בדוק אם להשתמש בפורמט Fastboot Erase או Fastboot כדי למחוק מחיצה במכשיר. |
int | getUserFlags (int userId) מצא והחזר את הדגלים של משתמש נתון. |
getUserInfos () מקבל את מפת useId ל- | |
int | getUserSerialNumber (int userId) החזר את המספר הסידורי המשויך ל-userId אם נמצא, -10000 בכל מקרה אחר. |
IManagedTestDevice.DeviceEventResponse | handleAllocationEvent (DeviceEvent event) עבד את ה- עבד את DeviceEvent, שעשוי להעביר את המכשיר הזה למצב הקצאה חדש או לא. |
boolean | hasFeature (String feature) בדוק אם תכונה זמינה במכשיר. |
String | installPackage (File packageFile, boolean reinstall, String... extraArgs) התקן חבילת אנדרואיד במכשיר. |
String | installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs) התקן חבילת אנדרואיד במכשיר. |
String | installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs) התקן חבילת אנדרואיד במכשיר עבור משתמש נתון. |
String | installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) התקן חבילת אנדרואיד במכשיר עבור משתמש נתון. |
boolean | isAdbRoot () |
boolean | isAdbTcp () |
boolean | isAppEnumerationSupported () בדוק אם הפלטפורמה במכשיר תומכת בספירת אפליקציות |
boolean | isDeviceEncrypted () חוזר אם המכשיר מוצפן. |
boolean | isDirectory (String path) החזר True אם הנתיב במכשיר הוא ספרייה, אחרת false. |
boolean | isEnableAdbRoot () |
boolean | isEncryptionSupported () חוזר אם ההצפנה נתמכת במכשיר. |
boolean | isExecutable (String fullPath) מחזירה True אם נתיב הקובץ במכשיר הוא קובץ הפעלה, אחרת false. |
boolean | isFastbootEnabled () חזור אם fastboot זמין עבור המכשיר. |
boolean | isHeadless () החזר אמת אם המכשיר חסר ראש (ללא מסך), אחרת שקר. |
boolean | isMultiUserSupported () קובע אם ריבוי משתמשים נתמך. |
boolean | isPackageInstalled (String packageName, String userId) שאל את המכשיר עבור שם חבילה נתון ומזהה משתמש נתון כדי לבדוק אם הוא מותקן כעת או לא עבור אותו משתמש. |
boolean | isPackageInstalled (String packageName) שאל את המכשיר עבור שם חבילה נתון כדי לבדוק אם הוא מותקן כעת או לא. |
boolean | isRuntimePermissionSupported () בדוק אם הפלטפורמה במכשיר תומכת בהענקת הרשאות זמן ריצה |
boolean | isStateBootloaderOrFastbootd () מחזירה true אם המכשיר נמצא ב- |
boolean | isUserRunning (int userId) בדוק אם משתמש נתון פועל. |
boolean | isUserSecondary (int userId) החזר אם המשתמש שצוין הוא משתמש משני לפי הדגלים שלו. |
boolean | isWifiEnabled () בדוק אם wifi מופעל. |
listDisplayIds () אסוף את הרשימה של מזהה תצוגות זמין במכשיר כפי שדווח על ידי "dumpsys SurfaceFlinger". | |
listUsers () מקבל את רשימת המשתמשים במכשיר. | |
boolean | logAnrs ( ITestLogger logger) אוסף ורישום ANR מהמכשיר. |
boolean | logBugreport (String dataName, ITestLogger listener) שיטת עוזר לקחת דוח באג ולהתחבר לכתבים. |
void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) התחבר הודעה ב-logcat של המכשיר. |
void | nonBlockingReboot () מוציא פקודה לאתחול מחדש של המכשיר ומחזיר כאשר הפקודה הושלמה וכאשר המכשיר אינו גלוי עוד ל-adb. |
void | postAdbRootAction () תעקוף אם המכשיר זקוק לפעולות ספציפיות שיבוצעו לאחר ה-adb root ולפני שהמכשיר חוזר למצב מקוון. |
void | postAdbUnrootAction () תעקוף אם המכשיר צריך לבצע פעולות ספציפיות לאחר ביטול השורש של adb ולפני שהמכשיר חוזר למצב מקוון. |
void | postBootSetup () בצע הוראות להגדרת ההתקן לבדיקה זאת לאחר כל אתחול. |
void | postInvocationTearDown (Throwable exception) שלבים נוספים עבור ניקוי נדרש ספציפי למכשיר שיבוצעו לאחר ביצוע ההזמנה. |
void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) שלבים נוספים עבור הגדרה נדרשת ספציפית למכשיר שיבוצעו במכשיר לפני זרימת הפנייה. |
boolean | pullDir (String deviceFilePath, File localDir) משוך באופן רקורסיבי את תוכן הספרייה מהמכשיר. |
boolean | pullFile (String remoteFilePath, File localFile) מאחזר קובץ מחוץ למכשיר. |
File | pullFile (String remoteFilePath, int userId) מאחזר קובץ מחוץ להתקן, מאחסן אותו ב- |
File | pullFile (String remoteFilePath) מאחזר קובץ מחוץ להתקן, מאחסן אותו ב- |
boolean | pullFile (String remoteFilePath, File localFile, int userId) מאחזר קובץ מחוץ למכשיר. |
String | pullFileContents (String remoteFilePath) מאחזר קובץ מחוץ למכשיר ומחזיר את התוכן. |
File | pullFileFromExternal (String remoteFilePath) שיטת נוחות לאחזור קובץ מהאחסון החיצוני של המכשיר, מאחסנת אותו ב- |
boolean | pushDir (File localFileDir, String deviceFilePath, excludedDirectories) pushDir (File localFileDir, String deviceFilePath, excludedDirectories) דחוף באופן רקורסיבי את תוכן הספרייה למכשיר תוך אי הכללה של מספר ספריות שמסוננות. |
boolean | pushDir (File localFileDir, String deviceFilePath) דחוף באופן רקורסיבי את תוכן הספרייה למכשיר. |
boolean | pushFile (File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded) וריאנט של |
boolean | pushFile (File localFile, String remoteFilePath) דחוף קובץ למכשיר. |
boolean | pushString (String contents, String remoteFilePath) דחיפה של קובץ שנוצר ממחרוזת למכשיר |
void | reboot (String reason) מאתחל את המכשיר למצב adb עם |
void | reboot () מאתחל את המכשיר למצב adb. |
void | rebootIntoBootloader () מאתחל את המכשיר למצב טוען אתחול. |
void | rebootIntoFastbootd () מאתחל את המכשיר למצב fastbootd. |
void | rebootIntoRecovery () מאתחל את המכשיר למצב שחזור adb. |
void | rebootIntoSideload () מאתחל את המכשיר למצב adb sideload (שים לב שזהו מצב מיוחד תחת שחזור) חוסם עד שהמכשיר נכנס למצב עומס צד |
void | rebootIntoSideload (boolean autoReboot) מאתחל את המכשיר למצב adb sideload (שים לב שזהו מצב מיוחד תחת שחזור) חוסם עד שהמכשיר נכנס למצב עומס צד |
void | rebootUntilOnline () חלופי ל- |
void | rebootUntilOnline (String reason) חלופי ל- |
void | rebootUserspace () מאתחל רק חלק ממרחב המשתמש של המכשיר. |
void | rebootUserspaceUntilOnline () חלופי ל- |
boolean | recoverDevice () ניסיונות לשחזר את התקשורת במכשיר. |
void | remountSystemWritable () הפוך את מחיצת המערכת במכשיר לניתנת לכתיבה. |
void | remountVendorWritable () הפוך את מחיצת הספק במכשיר לניתנת לכתיבה. |
boolean | removeAdmin (String componentName, int userId) הסר מנהל מכשיר נתון במשתמש נתון והחזר |
void | removeOwners () הסר את כל בעלי פרופיל המכשירים הקיימים במאמץ הטוב ביותר. |
boolean | removeUser (int userId) הסר משתמש נתון מהמכשיר. |
void | resetContentProviderSetup () אפס את הדגל עבור הגדרת ספק התוכן כדי להפעיל אותו שוב. |
boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) שיטת נוחות לביצוע |
boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) מפעיל בדיקות מכשור ומספק שחזור מכשיר. |
boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) זהה ל- |
boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) |
void | setConfiguration ( IConfiguration configuration) מזריק את |
void | setDate (Date date) מגדיר את התאריך במכשיר הערה: הגדרת התאריך במכשיר דורשת שורש |
boolean | setDeviceOwner (String componentName, int userId) הגדר רכיב ניהול מכשיר כבעל מכשיר במשתמש נתון. |
void | setDeviceState ( TestDeviceState deviceState) עדכן את מצב המכשיר. |
void | setEmulatorOutputStream ( SizeLimitedOutputStream output) עבור אמולטור הגדר את |
void | setEmulatorProcess (Process p) מגדיר את |
void | setFastbootEnabled (boolean fastbootEnabled) הגדר את אפשרות האתחול המהיר עבור המכשיר. |
void | setFastbootPath (String fastbootPath) מגדיר את הנתיב ל-fastboot הבינארי שבו יש להשתמש. |
void | setIDevice (IDevice newDevice) עדכן את ה-IDevice המשויך ל-ITestDevice זה. |
void | setOptions ( TestDeviceOptions options) הגדר את |
boolean | setProperty (String propKey, String propValue) מגדיר את ערך המאפיין הנתון במכשיר. |
void | setRecovery ( IDeviceRecovery recovery) הגדר את |
void | setRecoveryMode ( ITestDevice.RecoveryMode mode) הגדר את מצב השחזור הנוכחי לשימוש עבור המכשיר. |
void | setSetting (String namespace, String key, String value) ראה |
void | setSetting (int userId, String namespace, String key, String value) הוסף ערך הגדרה למרחב השמות של משתמש נתון. |
void | setUseFastbootErase (boolean useFastbootErase) הגדר אם להשתמש בפורמט Fastboot Erase או Fastboot כדי למחוק מחיצה במכשיר. |
void | startLogcat () התחל ללכוד פלט logcat מהמכשיר ברקע. |
boolean | startUser (int userId) מפעיל משתמש נתון ברקע אם הוא מופסק כעת. |
boolean | startUser (int userId, boolean waitFlag) מפעיל משתמש נתון ברקע אם הוא מופסק כעת. |
void | stopEmulatorOutput () סגור ומחק את פלט האמולטור. |
void | stopLogcat () הפסק ללכוד פלט logcat מהמכשיר, והסר את נתוני logcat השמורים כעת. |
boolean | stopUser (int userId) עוצר משתמש נתון. |
boolean | stopUser (int userId, boolean waitFlag, boolean forceFlag) עצור משתמש נתון. |
String | switchToAdbTcp () העבר את המכשיר למצב adb-over-tcp. |
boolean | switchToAdbUsb () העבר את המכשיר למצב adb over usb. |
boolean | switchUser (int userId) עבור ל-userId אחר עם פסק זמן ברירת מחדל. |
boolean | switchUser (int userId, long timeout) עבור ל-userId אחר עם הזמן הקצוב שסופק כתאריך יעד. |
boolean | syncFiles (File localFileDir, String deviceFilePath) מסנכרן בהדרגה את התוכן של ספריית קבצים מקומית למכשיר. |
Bugreport | takeBugreport () קח דוח באג ומחזיר אותו בתוך אובייקט |
String | uninstallPackage (String packageName) הסר התקנה של חבילת אנדרואיד מהמכשיר. |
String | uninstallPackageForUser (String packageName, int userId) הסר התקנה של חבילת אנדרואיד מהמכשיר עבור משתמש נתון. |
boolean | unlockDevice () ביטול נעילת המכשיר אם המכשיר נמצא במצב מוצפן. |
boolean | waitForBootComplete (long timeOut) חסימה עד להגדרת דגל השלמת האתחול של המכשיר. |
boolean | waitForDeviceAvailable () ממתין עד שהמכשיר יהיה מגיב וזמין לבדיקה. |
boolean | waitForDeviceAvailable (long waitTime) ממתין עד שהמכשיר יהיה מגיב וזמין לבדיקה. |
void | waitForDeviceBootloader () חוסם עד שהמכשיר יהיה גלוי באמצעות fastboot. |
boolean | waitForDeviceInRecovery (long waitTime) חוסם שהמכשיר יהיה במצב 'adb recovery' (שים לב שזה שונה מ- |
boolean | waitForDeviceInSideload (long waitTime) חוסם שהמכשיר יהיה במצב 'עומס צד של adb' |
boolean | waitForDeviceNotAvailable (long waitTime) חוסמים שהמכשיר לא יהיה זמין כלומר חסרים ב-adb |
void | waitForDeviceOnline () חסימה עד שהמכשיר יהיה גלוי דרך adb. |
void | waitForDeviceOnline (long waitTime) חסימה עד שהמכשיר יהיה גלוי דרך adb. |
boolean | waitForDeviceShell (long waitTime) ממתין עד שהמכשיר יגיב לפקודה בסיסית של adb shell. |
שיטות מוגנות | |
---|---|
void | checkApiLevelAgainst (String feature, int strictMinLevel) |
NativeDevice.RebootDeviceAction | createRebootDeviceAction ( NativeDevice.RebootMode rebootMode, String reason) צור |
void | doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason) בצע אתחול של adb. |
void | ensureRuntimePermissionSupported () שיטת עוזר לזרוק חריג אם הרשאת זמן ריצה אינה נתמכת |
InputStreamSource | getBugreportInternal () |
File | getBugreportzInternal () שיטת עוזר פנימית לקבל את קובץ ה-zip bugreportz כ- |
IRunUtil | getRunUtil () קבל את מופע |
String | internalGetProperty (String propName, String fastbootVar, String description) אחזר מאפיין מכשיר, מהמטמון ddmlib כברירת מחדל, וחזור ל-'adb shell getprop' או 'fastboot getvar' תלוי אם המכשיר נמצא ב-Fastboot או לא. |
boolean | isNewer (File localFile, IFileEntry entry) החזר |
boolean | performDeviceAction (String actionDescription, com.android.tradefed.device.NativeDevice.DeviceAction action, int retryAttempts) מבצע פעולה במכשיר זה. |
void | postAdbReboot () פעולות נוספות אפשריות שניתן לבצע לאחר אתחול מחדש. |
void | prePostBootSetup () מאפשר לכל סוג מכשיר (AndroidNativeDevice, TestDevice) לעקוף שיטה זו עבור הגדרה ספציפית לאחר האתחול. |
boolean | pullFileInternal (String remoteFilePath, File localFile) |
void | setClock (Clock clock) הגדר את מופע השעון לשימוש. |
void | setLogStartDelay (int delay) מגדיר את הזמן ב-ms להמתין לפני תחילת לכידת logcat עבור מכשיר מקוון. |
CommandResult | simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) מבצע פקודת fastboot פשוטה עם משתני סביבה ודיווח על מצב הפקודה. |
CommandResult | simpleFastbootCommand (long timeout, String[] fullCmd) מבצע פקודת fastboot פשוטה ודווח על מצב הפקודה. |
boolean | waitForDeviceNotAvailable (String operationDesc, long time) המתן לראות שהמכשיר לא זמין (הפסק לדווח ל-adb). |
קבועים
INVALID_USER_ID
public static final int INVALID_USER_ID
ערך שהוחזר עבור כל מזהה משתמש לא חוקי/לא נמצא: UserHandle הגדיר את הערך -10000
ערך קבוע: -10000 (0xffffd8f0)
MAX_HOST_DEVICE_TIME_OFFSET
protected static final long MAX_HOST_DEVICE_TIME_OFFSET
ערך קבוע: 5000 (0x0000000000001388)
MAX_RETRY_ATTEMPTS
protected static final int MAX_RETRY_ATTEMPTS
מספר ברירת המחדל של ניסיונות ניסיון חוזר של פקודה לבצע
ערך קבוע: 2 (0x00000002)
שדות
כרטיס זיכרון
protected static final String SD_CARD
STORAGE_EMULATED
protected static final String STORAGE_EMULATED
mOptions
protected TestDeviceOptions mOptions
בנאים ציבוריים
NativeDevice
public NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
יוצר מכשיר TestDevice
.
פרמטרים | |
---|---|
device | IDevice : ה- IDevice המשויך |
stateMonitor | IDeviceStateMonitor : מנגנון IDeviceStateMonitor לשימוש |
allocationMonitor | IDeviceMonitor : ה- IDeviceMonitor ליידע על שינויים במצב ההקצאה. יכול להיות ריק |
שיטות ציבוריות
checkApiLevelAgainstNextRelease
public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
בדוק אם תכונה נתמכת כרגע או לא בהינתן רמה נתמכת מינימלית. שיטה זו לוקחת בחשבון תכונות שטרם פורסמו, לפני העלאת רמת ה-API.
פרמטרים | |
---|---|
strictMinLevel | int : הרמה המינימלית האפשרית הקפדנית התומכת בתכונה. |
החזרות | |
---|---|
boolean | נכון אם הרמה נתמכת. שקר אחרת. |
זורק | |
---|---|
DeviceNotAvailableException |
לבדוק קישוריות
public boolean checkConnectivity ()
בדוק שלמכשיר יש קישוריות רשת.
החזרות | |
---|---|
boolean | true אם למכשיר יש חיבור רשת עובד, false יתר על המידה. |
זורק | |
---|---|
DeviceNotAvailableException |
clearErrorDialogs
public boolean clearErrorDialogs ()
נסה לבטל את כל תיבת הדו-שיח של שגיאה המוצגת כעת בממשק המשתמש של המכשיר.
החזרות | |
---|---|
boolean | true אם לא היו תיבות דו-שיח או אם תיבות דו-שיח נוקו בהצלחה. false אחרת. |
זורק | |
---|---|
DeviceNotAvailableException |
clearLastConnectedWifiNetwork
public void clearLastConnectedWifiNetwork ()
מנקה את רשת ה-WiFi המחוברת האחרונה. יש לקרוא לזה כאשר מתחילים הזמנה חדשה כדי להימנע מחיבור לרשת ה-WiFi ששימשה בבדיקה הקודמת לאחר אתחול המכשיר.
clearLogcat
public void clearLogcat ()
מוחק כל נתוני logcat שנצברו.
זה שימושי למקרים שבהם אתה רוצה להבטיח ITestDevice#getLogcat()
מחזיר רק נתוני יומן שנוצרו לאחר נקודה מסוימת (כגון לאחר הבזק של בניית מכשיר חדש וכו').
connectToWifiNetwork
public boolean connectToWifiNetwork (wifiSsidToPsk, boolean scanSsid)
מתחבר לרשת wifi.
מפעיל wifi וחוסם עד ליצירת חיבור מוצלח עם אחת מרשתות ה- wifi המפורטות במפת wifiSsidToPsk. לאחר יצירת חיבור, המופע ינסה לשחזר את החיבור לאחר כל אתחול מחדש עד ITestDevice#disconnectFromWifi()
או ITestDevice#clearLastConnectedWifiNetwork()
.
פרמטרים | |
---|---|
wifiSsidToPsk | |
scanSsid | boolean : האם לסרוק SSIDs מוסתרים עבור רשת זו. |
החזרות | |
---|---|
boolean | true אם מחובר לרשת wifi בהצלחה. false אחרת |
זורק | |
---|---|
DeviceNotAvailableException |
connectToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid, String wifiPsk)
מתחבר לרשת wifi.
מפעיל wifi וחוסם עד לחיבור מוצלח לרשת wifi שצוינה. לאחר יצירת חיבור, המופע ינסה לשחזר את החיבור לאחר כל אתחול מחדש עד ITestDevice#disconnectFromWifi()
או ITestDevice#clearLastConnectedWifiNetwork()
.
פרמטרים | |
---|---|
wifiSsid | String : ה-ssid של wifi שאליו יש להתחבר |
wifiPsk | String : ביטוי סיסמה PSK או null אם לא מוצפן |
החזרות | |
---|---|
boolean | true אם מחובר לרשת wifi בהצלחה. false אחרת |
זורק | |
---|---|
DeviceNotAvailableException |
connectToWifiNetwork
public boolean connectToWifiNetwork (wifiSsidToPsk)
מתחבר לרשת wifi.
מפעיל wifi וחוסם עד ליצירת חיבור מוצלח עם אחת מרשתות ה- wifi המפורטות במפת wifiSsidToPsk. לאחר יצירת חיבור, המופע ינסה לשחזר את החיבור לאחר כל אתחול מחדש עד ITestDevice#disconnectFromWifi()
או ITestDevice#clearLastConnectedWifiNetwork()
ייקרא.f
פרמטרים | |
---|---|
wifiSsidToPsk |
החזרות | |
---|---|
boolean | true אם מחובר לרשת wifi בהצלחה. false אחרת |
זורק | |
---|---|
DeviceNotAvailableException |
connectToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid)
מתחבר לרשת wifi.
מפעיל wifi וחוסם עד לחיבור מוצלח לרשת wifi שצוינה. לאחר יצירת חיבור, המופע ינסה לשחזר את החיבור לאחר כל אתחול מחדש עד ITestDevice#disconnectFromWifi()
או ITestDevice#clearLastConnectedWifiNetwork()
.
פרמטרים | |
---|---|
wifiSsid | String : ה-ssid של wifi שאליו יש להתחבר |
wifiPsk | String : ביטוי סיסמה PSK או null אם לא מוצפן |
scanSsid | boolean : האם לסרוק SSID מוסתר עבור רשת זו. |
החזרות | |
---|---|
boolean | true אם מחובר לרשת wifi בהצלחה. false אחרת |
זורק | |
---|---|
DeviceNotAvailableException |
connectToWifiNetworkIfNeeded
public boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid)
גרסה של connectToWifiNetwork(String, String)
שמתחברת רק אם למכשיר אין כרגע קישוריות רשת.
פרמטרים | |
---|---|
scanSsid | boolean : האם לסרוק SSID מוסתר עבור רשת זו |
החזרות | |
---|---|
boolean | true אם מחובר לרשת wifi בהצלחה. false אחרת |
זורק | |
---|---|
DeviceNotAvailableException |
connectToWifiNetworkIfNeeded
public boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk)
גרסה של connectToWifiNetwork(String, String)
שמתחברת רק אם למכשיר אין כרגע קישוריות רשת.
החזרות | |
---|---|
boolean | true אם מחובר לרשת wifi בהצלחה. false אחרת |
זורק | |
---|---|
DeviceNotAvailableException |
צור משתמש
public int createUser (String name, boolean guest, boolean ephemeral)
צור משתמש עם שם נתון והדגלים שסופקו
פרמטרים | |
---|---|
name | String : של המשתמש ליצור במכשיר |
guest | boolean : אפשר את דגל המשתמש --guest במהלך היצירה |
ephemeral | boolean : אפשר את דגל המשתמש - ארעית במהלך היצירה |
החזרות | |
---|---|
int | מזהה המשתמש שנוצר |
זורק | |
---|---|
DeviceNotAvailableException |
צור משתמש
public int createUser (String name)
צור משתמש עם שם נתון ודגלי ברירת מחדל 0.
פרמטרים | |
---|---|
name | String : של המשתמש ליצור במכשיר |
החזרות | |
---|---|
int | המספר השלם עבור מזהה המשתמש שנוצר |
זורק | |
---|---|
DeviceNotAvailableException |
createUserNoThrow
public int createUserNoThrow (String name)
צור משתמש עם שם נתון ודגלי ברירת מחדל 0.
פרמטרים | |
---|---|
name | String : של המשתמש ליצור במכשיר |
החזרות | |
---|---|
int | המספר השלם עבור מזהה המשתמש שנוצר או -1 עבור שגיאה. |
זורק | |
---|---|
DeviceNotAvailableException |
מחק קובץ
public void deleteFile (String deviceFilePath)
שיטת עוזר למחיקת קובץ או ספרייה במכשיר.
פרמטרים | |
---|---|
deviceFilePath | String : הנתיב המוחלט של הקובץ במכשיר. |
זורק | |
---|---|
DeviceNotAvailableException |
deviceSoftRestarted
public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
שיטת עוזר לבדוק אם ההתקן הופעל מחדש על ידי השוואת system_server הנוכחי עם system_server הקודם ProcessInfo
. השתמש getProcessByName(String)
כדי לקבל ProcessInfo
.
פרמטרים | |
---|---|
prevSystemServerProcess | ProcessInfo : תהליך system_server הקודם ProcessInfo . |
החזרות | |
---|---|
boolean | true אם המכשיר מופעל מחדש |
זורק | |
---|---|
DeviceNotAvailableException |
deviceSoftRestartedSince
public boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
שיטת עוזר לבדוק אם המכשיר הופעל מחדש מאז זמן UTC מאז התקופה מהמכשיר וה- ERROR(/TimeUnit)
. Soft-Restart מתייחס ל-system_server שהופעל מחדש מחוץ לאתחול קשיח של התקן (לדוגמה: אתחול מחדש מבוקש). ניתן להשיג את המכשיר הנוכחי utcEpochTime ב-Millisecond באמצעות השיטה getDeviceDate()
.
פרמטרים | |
---|---|
utcEpochTime | long : זמן המכשיר בשנייה מאז התקופה. |
timeUnit | TimeUnit : יחידת הזמן TimeUnit עבור utcEpochTime הנתון. |
החזרות | |
---|---|
boolean | true אם המכשיר מופעל מחדש |
זורק | |
---|---|
DeviceNotAvailableException |
disableAdbRoot
public boolean disableAdbRoot ()
מכבה את ה-adb root.
השבתת ה-adb root עלולה לגרום למכשיר להתנתק מ-adb. שיטה זו תחסום עד שהמכשיר יהיה זמין.
החזרות | |
---|---|
boolean | true אם מצליח. |
זורק | |
---|---|
DeviceNotAvailableException |
disableKeyguard
public void disableKeyguard ()
ניסיונות להשבית את מגן המקשים.
ראשית יש להמתין לשליחת הקלט כדי להיות מוכנה, זה קורה בערך באותו זמן כאשר המכשיר מדווח על BOOT_COMPLETE, ככל הנראה באופן אסינכרוני, מכיוון שליישום המסגרת הנוכחי יש מצב מרוץ מדי פעם. לאחר מכן נשלחת הפקודה כדי לבטל את שמירת המקשים (עובד על אלה שאינם מאובטחים בלבד)
זורק | |
---|---|
DeviceNotAvailableException |
השבת את NetworkMonitor
public boolean disableNetworkMonitor ()
משבית את ניטור הרשת במכשיר.
החזרות | |
---|---|
boolean | true אם הניטור מושבת בהצלחה. false אם זה נכשל. |
זורק | |
---|---|
DeviceNotAvailableException |
disconnectFromWifi
public boolean disconnectFromWifi ()
מתנתק מרשת wifi.
מסיר את כל הרשתות מרשימת הרשתות המוכרות ומשבית את ה-wifi.
החזרות | |
---|---|
boolean | true אם התנתק מרשת wifi בהצלחה. false אם הניתוק נכשל. |
זורק | |
---|---|
DeviceNotAvailableException |
doesFileExist
public boolean doesFileExist (String deviceFilePath, int userId)
שיטת עוזר לקבוע אם קיים קובץ במכשיר עבור משתמש נתון.
פרמטרים | |
---|---|
deviceFilePath | String : הנתיב המוחלט של הקובץ במכשיר שיש לבדוק |
userId | int : מזהה המשתמש שכנגדו יש לבדוק את קיום הקובץ |
החזרות | |
---|---|
boolean | true אם הקובץ קיים, false אחרת. |
זורק | |
---|---|
DeviceNotAvailableException |
doesFileExist
public boolean doesFileExist (String deviceFilePath)
שיטת עוזר לקבוע אם קיים קובץ במכשיר.
פרמטרים | |
---|---|
deviceFilePath | String : הנתיב המוחלט של הקובץ במכשיר שיש לבדוק |
החזרות | |
---|---|
boolean | true אם הקובץ קיים, false אחרת. |
זורק | |
---|---|
DeviceNotAvailableException |
dumpHeap
public File dumpHeap (String process, String devicePath)
נסה לזרוק את הערימה מה-system_server. באחריות המתקשר לנקות את הקובץ שנזרק.
פרמטרים | |
---|---|
process | String : שם תהליך ההתקן שעליו dumpheap. |
devicePath | String : הנתיב במכשיר שבו לשים את המזבלה. זה חייב להיות מיקום שבו ההרשאות מאפשרות זאת. |
החזרות | |
---|---|
File | ה- ERROR(/File) המכילה את הדוח. ריק אם משהו נכשל. |
זורק | |
---|---|
DeviceNotAvailableException |
enableAdbRoot
public boolean enableAdbRoot ()
מפעיל את השורש של adb. אם ההגדרה "enable-root" היא "false", תירשם הודעה ותחזור מבלי להפעיל את ה-root.
הפעלת ה-adb root עלולה לגרום למכשיר להתנתק מ-adb. שיטה זו תחסום עד שהמכשיר יהיה זמין.
החזרות | |
---|---|
boolean | true אם מצליח. |
זורק | |
---|---|
DeviceNotAvailableException |
אפשר NetworkMonitor
public boolean enableNetworkMonitor ()
מאפשר ניטור רשת במכשיר.
החזרות | |
---|---|
boolean | true אם הניטור מופעל בהצלחה. false אם זה נכשל. |
זורק | |
---|---|
DeviceNotAvailableException |
executeAdbCommand
public String executeAdbCommand (long timeout, String... cmdArgs)
שיטת עוזר המבצעת פקודת adb כפקודת מערכת עם פסק זמן מוגדר.
במקום זאת יש להשתמש executeShellCommand(String)
בכל מקום אפשרי, שכן שיטה זו מספקת זיהוי וביצועים טובים יותר של כשלים.
פרמטרים | |
---|---|
timeout | long : הזמן באלפיות שניות לפני שהמכשיר נחשב ללא מגיב, 0L ללא פסק זמן |
cmdArgs | String : פקודת adb והארגומנטים להפעלה |
החזרות | |
---|---|
String | הסטדאוט מהפקודה. null אם הפקודה נכשלה בביצוע. |
זורק | |
---|---|
DeviceNotAvailableException |
executeAdbCommand
public String executeAdbCommand (String... cmdArgs)
שיטת עוזר המבצעת פקודת adb כפקודת מערכת.
במקום זאת יש להשתמש executeShellCommand(String)
בכל מקום אפשרי, שכן שיטה זו מספקת זיהוי וביצועים טובים יותר של כשלים.
פרמטרים | |
---|---|
cmdArgs | String : פקודת adb והארגומנטים להפעלה |
החזרות | |
---|---|
String | הסטדאוט מהפקודה. null אם הפקודה נכשלה בביצוע. |
זורק | |
---|---|
DeviceNotAvailableException |
executeFastbootCommand
public CommandResult executeFastbootCommand (String... cmdArgs)
שיטת עוזר המבצעת פקודת fastboot כפקודת מערכת עם פסק זמן ברירת מחדל של 2 דקות.
צפוי להיות בשימוש כאשר המכשיר כבר נמצא במצב אתחול מהיר.
פרמטרים | |
---|---|
cmdArgs | String : פקודת fastboot והארגומנטים להפעלה |
החזרות | |
---|---|
CommandResult | תוצאת הפקודה המכילה פלט של הפקודה |
זורק | |
---|---|
DeviceNotAvailableException |
executeFastbootCommand
public CommandResult executeFastbootCommand (long timeout, String... cmdArgs)
שיטת עוזר המבצעת פקודת fastboot בתור פקודת מערכת.
צפוי להיות בשימוש כאשר המכשיר כבר נמצא במצב אתחול מהיר.
פרמטרים | |
---|---|
timeout | long : הזמן באלפיות שניות לפני פקיעת הפקודה |
cmdArgs | String : פקודת fastboot והארגומנטים להפעלה |
החזרות | |
---|---|
CommandResult | תוצאת הפקודה המכילה פלט של הפקודה |
זורק | |
---|---|
DeviceNotAvailableException |
executeLongFastbootCommand
public CommandResult executeLongFastbootCommand (envVarMap, String... cmdArgs)
שיטת עוזר המבצעת פקודת fastboot ארוכת שנים כפקודה מערכת עם משתני סביבת מערכת.
זהה ל- executeFastbootCommand(String)
למעט שימוש בפסק זמן ארוך יותר.
פרמטרים | |
---|---|
envVarMap | |
cmdArgs | String : פקודת fastboot והארגומנטים להפעלה |
החזרות | |
---|---|
CommandResult | תוצאת הפקודה המכילה פלט של הפקודה |
זורק | |
---|---|
DeviceNotAvailableException |
executeLongFastbootCommand
public CommandResult executeLongFastbootCommand (String... cmdArgs)
שיטת עוזר המבצעת פקודת fastboot שפועלת לאורך זמן בתור פקודת מערכת.
זהה ל- executeFastbootCommand(String)
למעט שימוש בפסק זמן ארוך יותר.
פרמטרים | |
---|---|
cmdArgs | String : פקודת fastboot והארגומנטים להפעלה |
החזרות | |
---|---|
CommandResult | תוצאת הפקודה המכילה פלט של הפקודה |
זורק | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public String executeShellCommand (String command)
שיטת Helper שמבצעת פקודת adb shell ומחזירה פלט String
.
פרמטרים | |
---|---|
command | String : פקודת ה-adb shell להפעלה |
החזרות | |
---|---|
String | פלט המעטפת |
זורק | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה.
פרמטרים | |
---|---|
command | String : פקודת ה-adb shell להפעלה |
receiver | IShellOutputReceiver : IShellOutputReceiver יש לכוון פלט מעטפת. |
maxTimeToOutputShellResponse | long : משך הזמן המקסימלי שבמהלכו מותר לפקודה לא להוציא שום תגובה; יחידה כפי שצוין ב- timeUnit |
timeUnit | TimeUnit : יחידה עבור maxTimeToOutputShellResponse |
retryAttempts | int : מספר הפעמים המרבי לניסיון חוזר בפקודה אם היא נכשלת עקב חריג. DeviceNotResponsiveException retryAttempts אם יתבצעו ניסיון חוזר ללא הצלחה. |
זורק | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה.
פרמטרים | |
---|---|
command | String : פקודת ה-adb shell להפעלה |
receiver | IShellOutputReceiver : IShellOutputReceiver יש לכוון פלט מעטפת. |
maxTimeoutForCommand | long : הזמן הקצוב המרבי להשלמת הפקודה; יחידה כפי שצוין ב- timeUnit |
maxTimeToOutputShellResponse | long : משך הזמן המקסימלי שבמהלכו מותר לפקודה לא להוציא שום תגובה; יחידה כפי שצוין ב- timeUnit |
timeUnit | TimeUnit : יחידה עבור maxTimeToOutputShellResponse |
retryAttempts | int : מספר הפעמים המרבי לניסיון חוזר בפקודה אם היא נכשלת עקב חריג. DeviceNotResponsiveException retryAttempts אם יתבצעו ניסיון חוזר ללא הצלחה. |
זורק | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver)
מבצע את פקודת ה-adb shell הנתונה, מנסה שוב מספר פעמים אם הפקודה נכשלת.
צורה פשוטה יותר של executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
עם ערכי ברירת מחדל.
פרמטרים | |
---|---|
command | String : פקודת ה-adb shell להפעלה |
receiver | IShellOutputReceiver : IShellOutputReceiver יש לכוון פלט מעטפת. |
זורק | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd)
שיטת Helper אשר מבצעת פקודת adb shell ומחזירה את התוצאות כ- CommandResult
המאוכלסת כהלכה בפלט סטטוס הפקודה, stdout ו-stderr.
פרמטרים | |
---|---|
cmd | String : הפקודה שצריך להפעיל. |
החזרות | |
---|---|
CommandResult | התוצאה ב- CommandResult . |
זורק | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, OutputStream pipeToOutput)
שיטת Helper המבצעת פקודת adb shell ומחזירה את התוצאות כ- CommandResult
המאוכלסת כהלכה בפלט סטטוס הפקודה וב-stderr. stdout מופנה לזרם שצוין.
פרמטרים | |
---|---|
cmd | String : הפקודה שצריך להפעיל. |
pipeToOutput | OutputStream : ERROR(/OutputStream) שבו הפלט std יופנה מחדש, או null. |
החזרות | |
---|---|
CommandResult | התוצאה ב- CommandResult . |
זורק | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput)
שיטת Helper אשר מבצעת פקודת adb shell ומחזירה את התוצאות כ- CommandResult
המאוכלסת כהלכה בפלט סטטוס הפקודה, stdout ו-stderr.
פרמטרים | |
---|---|
cmd | String : הפקודה שצריך להפעיל. |
pipeAsInput | File : ERROR(/File) שיועבר כקלט לפקודה, או null. |
החזרות | |
---|---|
CommandResult | התוצאה ב- CommandResult . |
זורק | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה.
פרמטרים | |
---|---|
cmd | String : פקודת ה-adb shell להפעלה |
maxTimeoutForCommand | long : הזמן הקצוב המרבי להשלמת הפקודה; יחידה כפי שצוין ב- timeUnit |
timeUnit | TimeUnit : יחידה עבור maxTimeToOutputShellResponse |
retryAttempts | int : מספר הפעמים המרבי לניסיון חוזר בפקודה אם היא נכשלת עקב חריג. DeviceNotResponsiveException retryAttempts אם יתבצעו ניסיון חוזר ללא הצלחה. |
החזרות | |
---|---|
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
publicgetActiveApexes ()
Fetch the information about APEXes activated on the device.
החזרות | |
---|---|
ERROR(/Set) of ApexInfo currently activated on the device |
זורק | |
---|---|
DeviceNotAvailableException |
getAllSettings
publicgetAllSettings (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
publicgetAndroidIds ()
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
publicgetAppPackageInfos ()
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
publicgetBootHistory ()
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
publicgetBootHistorySince (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 |
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 |
getDeviceState
public TestDeviceState getDeviceState ()
Get the device's state.
החזרות | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public long getDeviceTimeOffset (Date date)
Helper to get the time difference between the device and a given ERROR(/Date)
. Use Epoch time internally.
פרמטרים | |
---|---|
date | Date |
החזרות | |
---|---|
long | the difference in milliseconds |
זורק | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public InputStreamSource getEmulatorOutput ()
Get the stream of emulator stdout and stderr
החזרות | |
---|---|
InputStreamSource | emulator output |
getEmulatorProcess
public Process getEmulatorProcess ()
Return the 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 |
getFastbootSerialNumber
public String getFastbootSerialNumber ()
Returns the fastboot mode serial number.
החזרות | |
---|---|
String |
getFastbootVariable
public String getFastbootVariable (String variableName)
Retrieve the given fastboot variable value from the device.
פרמטרים | |
---|---|
variableName | String : the variable name |
החזרות | |
---|---|
String | the property value or null if it does not exist |
זורק | |
---|---|
DeviceNotAvailableException |
getFastbootVersion
public String getFastbootVersion ()
Returns the version string of the fastboot binary being used. Or null if something goes wrong.
החזרות | |
---|---|
String |
getFileEntry
public IFileEntry getFileEntry (String path)
Retrieve a reference to a remote file on device.
פרמטרים | |
---|---|
path | String : the file path to retrieve. Can be an absolute path or path relative to '/'. (ie both "/system" and "system" syntax is supported) |
החזרות | |
---|---|
IFileEntry | the IFileEntry or null if file at given path cannot be found |
זורק | |
---|---|
DeviceNotAvailableException |
getFileEntry
public IFileEntry getFileEntry (FileListingService.FileEntry entry)
Unofficial helper to get a FileEntry
from a non-root path. FIXME: Refactor the FileEntry system to have it available from any path. (even non root).
פרמטרים | |
---|---|
entry | FileListingService.FileEntry : a FileEntry not necessarily root as Ddmlib requires. |
החזרות | |
---|---|
IFileEntry | a FileEntryWrapper representing the FileEntry. |
זורק | |
---|---|
DeviceNotAvailableException |
getFoldableStates
publicgetFoldableStates ()
Returns the list of foldable states on the device. Can be obtained with "cmd device_state print-states".
החזרות | |
---|---|
זורק | |
---|---|
DeviceNotAvailableException |
getIDevice
public IDevice getIDevice ()
Returns a reference to the associated ddmlib IDevice
.
A new IDevice
may be allocated by DDMS each time the device disconnects and reconnects from adb. Thus callers should not keep a reference to the IDevice
, because that reference may become stale.
החזרות | |
---|---|
IDevice | the IDevice |
getInstalledPackageNames
publicgetInstalledPackageNames ()
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:
TestDeviceOptions.getMaxLogcatDataSize()
bytes of the current contents of the background logcat captureהחזרות | |
---|---|
InputStreamSource |
getLogcat
public InputStreamSource getLogcat (int maxBytes)
Grabs a snapshot stream of the last maxBytes
of captured logcat data.
Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat()
snapshot.
פרמטרים | |
---|---|
maxBytes | int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory |
החזרות | |
---|---|
InputStreamSource |
getLogcatDump
public InputStreamSource getLogcatDump ()
Get a dump of the current logcat for device. Unlike getLogcat()
, this method will always return a static dump of the logcat.
Has the disadvantage that nothing will be returned if device is not reachable.
החזרות | |
---|---|
InputStreamSource | a InputStreamSource of the logcat data. An empty stream is returned if fail to capture logcat data. |
getLogcatSince
public InputStreamSource getLogcatSince (long date)
Grabs a snapshot stream of captured logcat data starting the date provided. The time on the device should be used getDeviceDate()
.
פרמטרים | |
---|---|
date | long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s') |
החזרות | |
---|---|
InputStreamSource |
getMacAddress
public String getMacAddress ()
Returns the MAC address of the device, null if it fails to query from the device.
החזרות | |
---|---|
String |
getMainlineModuleInfo
publicgetMainlineModuleInfo ()
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 |
getMonitor
public IDeviceStateMonitor getMonitor ()
Return the IDeviceStateMonitor
associated with device.
החזרות | |
---|---|
IDeviceStateMonitor |
getMountPoint
public String getMountPoint (String mountName)
Returns a mount point.
Queries the device directly if the cached info in IDevice
is not available.
TODO: move this behavior to IDevice#getMountPoint(String)
פרמטרים | |
---|---|
mountName | String : the name of the mount point |
החזרות | |
---|---|
String | the mount point or null |
getMountPointInfo
public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
Returns a MountPointInfo
corresponding to the specified mountpoint path, or null
if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.
פרמטרים | |
---|---|
mountpoint | String |
החזרות | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
זורק | |
---|---|
DeviceNotAvailableException |
getMountPointInfo
publicgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
החזרות | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
זורק | |
---|---|
DeviceNotAvailableException |
getOptions
public TestDeviceOptions getOptions ()
Fetch the test options for the device.
החזרות | |
---|---|
TestDeviceOptions | TestDeviceOptions related to the device under test. |
getPartitionFreeSpace
public long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
פרמטרים | |
---|---|
partition | String |
החזרות | |
---|---|
long | the amount of free space in KB |
זורק | |
---|---|
DeviceNotAvailableException |
getPrimaryUserId
public Integer getPrimaryUserId ()
Returns the primary user id.
החזרות | |
---|---|
Integer | the userId of the primary user if there is one, and null if there is no primary user. |
זורק | |
---|---|
DeviceNotAvailableException |
getProcessByName
public ProcessInfo getProcessByName (String processName)
Helper method runs the "pidof" and "stat" command and returns ProcessInfo
object with PID and process start time of the given process.
פרמטרים | |
---|---|
processName | String : the proces name String. |
החזרות | |
---|---|
ProcessInfo | ProcessInfo of given processName |
זורק | |
---|---|
DeviceNotAvailableException |
getProcessPid
public String getProcessPid (String process)
Returns the pid of the service or null if something went wrong.
פרמטרים | |
---|---|
process | String : The proces name String. |
החזרות | |
---|---|
String |
זורק | |
---|---|
DeviceNotAvailableException |
getProductType
public String getProductType ()
Convenience method to get the product type of this device.
This method will work if device is in either adb or fastboot mode.
החזרות | |
---|---|
String | the 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 (String format)
Grabs a screenshot from the device. Recommended to use getScreenshot(format) instead with JPEG encoding for smaller size
פרמטרים | |
---|---|
format | String : supported PNG, JPEG |
החזרות | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in format, or null if the screenshot was not successful. |
זורק | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (long displayId)
Grabs a screenshot from the device given display id. Format is PNG.
TODO: extend the implementations above to support 'format' and 'rescale'
פרמטרים | |
---|---|
displayId | long : the display id of the screen to get screenshot from. |
החזרות | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in format, or null if the screenshot was not successful. |
זורק | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (String format, boolean rescale)
Grabs a screenshot from the device. Recommended to use getScreenshot(String)
instead with JPEG encoding for smaller size.
פרמטרים | |
---|---|
format | String : supported PNG, JPEG |
rescale | boolean : if screenshot should be rescaled to reduce the size of resulting image |
החזרות | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in format, or null if the screenshot was not successful. |
זורק | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot ()
Grabs a screenshot from the device.
החזרות | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in png format, or null if the screenshot was not successful. |
זורק | |
---|---|
DeviceNotAvailableException |
getSerialNumber
public String getSerialNumber ()
Convenience method to get serial number of this device.
החזרות | |
---|---|
String | the 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
publicgetTombstones ()
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 |
getUninstallablePackageNames
publicgetUninstallablePackageNames ()
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
publicgetUserInfos ()
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: |
החזרות | |
---|---|
boolean | True if feature is found, false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
installPackage
public String installPackage (File packageFile, boolean reinstall, String... extraArgs)
Install an Android package on device.
פרמטרים | |
---|---|
packageFile | File : the apk file to install |
reinstall | boolean : true if a reinstall should be performed |
extraArgs | String : optional extra arguments to pass. See 'adb shell pm -h' for available options. |
החזרות | |
---|---|
String | a 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 |
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 |
isDeviceEncrypted
public boolean isDeviceEncrypted ()
Returns if the device is encrypted.
החזרות | |
---|---|
boolean | true if the device is encrypted. |
זורק | |
---|---|
DeviceNotAvailableException |
isDirectory
public boolean isDirectory (String path)
Return True if the path on the device is a directory, false otherwise.
פרמטרים | |
---|---|
path | String |
החזרות | |
---|---|
boolean |
זורק | |
---|---|
DeviceNotAvailableException |
isEnableAdbRoot
public boolean isEnableAdbRoot ()
החזרות | |
---|---|
boolean | true if adb root should be enabled on device |
isEncryptionSupported
public boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
החזרות | |
---|---|
boolean | true if the device supports encryption. |
זורק | |
---|---|
DeviceNotAvailableException |
isExecutable
public boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
פרמטרים | |
---|---|
fullPath | String |
החזרות | |
---|---|
boolean |
זורק | |
---|---|
DeviceNotAvailableException |
isFastbootEnabled
public boolean isFastbootEnabled ()
Return if fastboot is available for the device.
החזרות | |
---|---|
boolean |
isHeadless
public boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
החזרות | |
---|---|
boolean |
זורק | |
---|---|
DeviceNotAvailableException |
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. שקר אחרת. |
זורק | |
---|---|
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. שקר אחרת. |
זורק | |
---|---|
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 |
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
publiclistDisplayIds ()
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 |
listUsers
publiclistUsers ()
Gets the list of users on the device. Will throw DeviceRuntimeException
if output from device is not as expected.
החזרות | |
---|---|
the list of user ids. |
זורק | |
---|---|
DeviceNotAvailableException |
logAnrs
public boolean logAnrs (ITestLogger logger)
Collects and log ANRs from the device.
פרמטרים | |
---|---|
logger | ITestLogger : an ITestLogger to log the ANRs. |
החזרות | |
---|---|
boolean | True if the logging was successful, false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
logBugreport
public boolean logBugreport (String dataName, ITestLogger listener)
Helper method to take a bugreport and log it to the reporters.
פרמטרים | |
---|---|
dataName | String : name under which the bugreport will be reported. |
listener | ITestLogger : an ITestLogger to log the bugreport. |
החזרות | |
---|---|
boolean | True if the logging was successful, false otherwise. |
logOnDevice
public void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)
Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.
פרמטרים | |
---|---|
tag | String : The tag under which we log our message in the logcat. |
level | Log.LogLevel : The debug level of the message in the logcat. |
format | String : The message format. |
args | Object : the args to be replaced via String.format(). |
nonBlockingReboot
public void nonBlockingReboot ()
Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.
זורק | |
---|---|
DeviceNotAvailableException |
postAdbRootAction
public void postAdbRootAction ()
Override if the device needs some specific actions to be taken after adb root and before the device is back online. Default implementation doesn't include any addition actions. adb root is not guaranteed to be enabled at this stage.
זורק | |
---|---|
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.
זורק | |
---|---|
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)
Recursively pull directory contents from device.
פרמטרים | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
החזרות | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
pullFile
public boolean pullFile (String remoteFilePath, File localFile)
Retrieves a file off device.
פרמטרים | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
החזרות | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
pullFile
public File pullFile (String remoteFilePath, int userId)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
פרמטרים | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
userId | int : The user id to pull from |
החזרות | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
זורק | |
---|---|
DeviceNotAvailableException |
pullFile
public File pullFile (String remoteFilePath)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
פרמטרים | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
החזרות | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
זורק | |
---|---|
DeviceNotAvailableException |
pullFile
public boolean pullFile (String remoteFilePath, File localFile, int userId)
Retrieves a file off device.
פרמטרים | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
userId | int : The user id to pull from |
החזרות | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
pullFileContents
public String pullFileContents (String remoteFilePath)
Retrieves a file off device, and returns the contents.
פרמטרים | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
החזרות | |
---|---|
String | A String containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
זורק | |
---|---|
DeviceNotAvailableException |
pullFileFromExternal
public File pullFileFromExternal (String remoteFilePath)
A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File)
, and return a reference to that File
.
פרמטרים | |
---|---|
remoteFilePath | String : the path to file on device, relative to the device's external storage mountpoint |
החזרות | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
זורק | |
---|---|
DeviceNotAvailableException |
pushDir
public boolean pushDir (File localFileDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
פרמטרים | |
---|---|
localFileDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
החזרות | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
pushDir
public boolean pushDir (File localFileDir, String deviceFilePath)
Recursively push directory contents to device.
פרמטרים | |
---|---|
localFileDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
החזרות | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
pushFile
public boolean pushFile (File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded)
Variant of pushFile(File, String)
which can optionally consider evaluating the need for the content provider.
פרמטרים | |
---|---|
localFile | File : the local file to push |
remoteFilePath | String : the remote destination absolute file path |
evaluateContentProviderNeeded | boolean : whether to check if we need the content provider |
החזרות | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
pushFile
public boolean pushFile (File localFile, String remoteFilePath)
Push a file to device. By default using a content provider.
פרמטרים | |
---|---|
localFile | File : the local file to push |
remoteFilePath | String : the remote destination absolute file path |
החזרות | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
pushString
public boolean pushString (String contents, String remoteFilePath)
Push file created from a string to device
פרמטרים | |
---|---|
contents | String : the contents of the file to push |
remoteFilePath | String : the remote destination absolute file path |
החזרות | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
reboot
public void reboot (String reason)
Reboots the device into adb mode with given reason
to be persisted across reboot.
Blocks until device becomes available.
Last reboot reason can be obtained by querying sys.boot.reason
propety.
פרמטרים | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
זורק | |
---|---|
DeviceNotAvailableException |
reboot
public void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.
זורק | |
---|---|
DeviceNotAvailableException |
rebootIntoBootloader
public void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.
זורק | |
---|---|
DeviceNotAvailableException |
rebootIntoFastbootd
public void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
זורק | |
---|---|
DeviceNotAvailableException |
rebootIntoRecovery
public void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recovery
זורק | |
---|---|
DeviceNotAvailableException |
rebootIntoSideload
public void rebootIntoSideload ()
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
זורק | |
---|---|
DeviceNotAvailableException |
rebootIntoSideload
public void rebootIntoSideload (boolean autoReboot)
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
פרמטרים | |
---|---|
autoReboot | boolean : whether to automatically reboot the device after sideload |
זורק | |
---|---|
DeviceNotAvailableException |
rebootUntilOnline
public void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
זורק | |
---|---|
DeviceNotAvailableException |
rebootUntilOnline
public void rebootUntilOnline (String reason)
An alternate to reboot()
that only blocks until device is online ie visible to adb.
פרמטרים | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
זורק | |
---|---|
DeviceNotAvailableException |
rebootUserspace
public void rebootUserspace ()
Reboots only userspace part of device.
Blocks until device becomes available.
WARNING. Userspace reboot is currently under active development, use it on your own risk.
זורק | |
---|---|
DeviceNotAvailableException |
rebootUserspaceUntilOnline
public void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
זורק | |
---|---|
DeviceNotAvailableException |
recoverDevice
public boolean recoverDevice ()
Attempts to recover device communication.
החזרות | |
---|---|
boolean | True if recovery attempted and successful, returns False if recovery was skipped |
זורק | |
---|---|
DeviceNotAvailableException | if device is no longer available |
remountSystemWritable
public void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
זורק | |
---|---|
DeviceNotAvailableException |
remountVendorWritable
public void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
זורק | |
---|---|
DeviceNotAvailableException |
removeAdmin
public boolean removeAdmin (String componentName, int userId)
Remove given device admin in given user and return true
if it is successful, false
otherwise.
פרמטרים | |
---|---|
componentName | String : of device admin to be removed. |
userId | int : of user that the device admin lives in. |
החזרות | |
---|---|
boolean | True if it is successful, false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
removeOwners
public void removeOwners ()
Remove all existing device profile owners with the best effort.
זורק | |
---|---|
DeviceNotAvailableException |
removeUser
public boolean removeUser (int userId)
Remove a given user from the device.
פרמטרים | |
---|---|
userId | int : of the user to remove |
החזרות | |
---|---|
boolean | true if we were successful in removing the user, false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
resetContentProviderSetup
public void resetContentProviderSetup ()
Reset the flag for content provider setup in order to trigger it again.
runInstrumentationTests
public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)
Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection))
with one or more listeners passed as parameters.
פרמטרים | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners | ITestLifeCycleReceiver : the test result listener(s) |
החזרות | |
---|---|
boolean | true if test command completed. false if it failed to complete, but recovery succeeded |
זורק | |
---|---|
DeviceNotAvailableException |
runInstrumentationTests
public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner,listeners)
Runs instrumentation tests, and provides device recovery.
If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.
If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.
פרמטרים | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners |
החזרות | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
זורק | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)
Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)
but runs the test for a given user.
פרמטרים | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
החזרות | |
---|---|
boolean |
זורק | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId,listeners)
Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection))
but runs the test for the given user.
פרמטרים | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
החזרות | |
---|---|
boolean |
זורק | |
---|---|
DeviceNotAvailableException |
setConfiguration
public void setConfiguration (IConfiguration configuration)
Injects the IConfiguration
in use.
פרמטרים | |
---|---|
configuration | IConfiguration |
setDate
public void setDate (Date date)
Sets the date on device
Note: setting date on device requires root
פרמטרים | |
---|---|
date | Date : specify a particular date; will use host date if null |
זורק | |
---|---|
DeviceNotAvailableException |
setDeviceOwner
public boolean setDeviceOwner (String componentName, int userId)
Set a device admin component as device owner in given user.
פרמטרים | |
---|---|
componentName | String : of device admin to be device owner. |
userId | int : of the user that the device owner lives in. |
החזרות | |
---|---|
boolean | True if it is successful, false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
setDeviceState
public void setDeviceState (TestDeviceState deviceState)
Update the device's state.
פרמטרים | |
---|---|
deviceState | TestDeviceState : the TestDeviceState |
setEmulatorOutputStream
public void setEmulatorOutputStream (SizeLimitedOutputStream output)
For emulator set SizeLimitedOutputStream
to log output
פרמטרים | |
---|---|
output | SizeLimitedOutputStream : to log the output |
setEmulatorProcess
public void setEmulatorProcess (Process p)
Sets the Process
, when this device is an emulator.
פרמטרים | |
---|---|
p | Process |
setFastbootEnabled
public void setFastbootEnabled (boolean fastbootEnabled)
Set the fastboot option for the device. Should be set when device is first allocated.
פרמטרים | |
---|---|
fastbootEnabled | boolean : whether fastboot is available for the device or not |
setFastbootPath
public void setFastbootPath (String fastbootPath)
Sets the path to the fastboot binary that should be used. Still requires isFastbootEnabled()
to be true, to have fastboot functions enabled.
פרמטרים | |
---|---|
fastbootPath | String |
setIDevice
public void setIDevice (IDevice newDevice)
Update the IDevice associated with this ITestDevice.
The new IDevice must refer the same physical device as the current reference. This method will be called if DDMS has allocated a new IDevice
פרמטרים | |
---|---|
newDevice | IDevice : the IDevice |
setOptions
public void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
פרמטרים | |
---|---|
options | TestDeviceOptions |
setProperty
public boolean setProperty (String propKey, String propValue)
Sets the given property value on the device. Requires adb root is true.
פרמטרים | |
---|---|
propKey | String : The key targeted to be set. |
propValue | String : The property value to be set. |
החזרות | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
setRecovery
public void setRecovery (IDeviceRecovery recovery)
Set the IDeviceRecovery
to use for this device. Should be set when device is first allocated.
פרמטרים | |
---|---|
recovery | IDeviceRecovery : the IDeviceRecovery |
setRecoveryMode
public void setRecoveryMode (ITestDevice.RecoveryMode mode)
Set the current recovery mode to use for the device.
Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etc
פרמטרים | |
---|---|
mode | ITestDevice.RecoveryMode : whether 'recover till online only' mode should be on or not. |
setSetting
public void setSetting (String namespace, String key, String value)
See setSetting(int, String, String, String)
and performed on system user.
פרמטרים | |
---|---|
namespace | String |
key | String |
value | String |
זורק | |
---|---|
DeviceNotAvailableException |
setSetting
public void setSetting (int userId, String namespace, String key, String value)
Add a setting value to the namespace of a given user. Some settings will only be available after a reboot. namespace must be one of: {"system", "secure", "global"}
פרמטרים | |
---|---|
userId | int |
namespace | String |
key | String |
value | String |
זורק | |
---|---|
DeviceNotAvailableException |
setUseFastbootErase
public void setUseFastbootErase (boolean useFastbootErase)
Set whether to use fastboot erase or fastboot format to wipe a partition on the device.
פרמטרים | |
---|---|
useFastbootErase | boolean : true if fastboot erase should be used or false if fastboot format should be used. |
startLogcat
public void startLogcat ()
Start capturing logcat output from device in the background.
Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat.
When the device is no longer in use, stopLogcat()
must be called.
startLogcat()
and stopLogcat()
do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.
startUser
public boolean startUser (int userId)
Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP.
פרמטרים | |
---|---|
userId | int : of the user to start in the background |
החזרות | |
---|---|
boolean | true if the user was successfully started in the background. |
זורק | |
---|---|
DeviceNotAvailableException |
startUser
public boolean startUser (int userId, boolean waitFlag)
Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP. Possible to provide extra flag to wait for the operation to have effect.
פרמטרים | |
---|---|
userId | int : of the user to start in the background |
waitFlag | boolean : will make the command wait until user is started and unlocked. |
החזרות | |
---|---|
boolean | true if the user was successfully started in the background. |
זורק | |
---|---|
DeviceNotAvailableException |
stopEmulatorOutput
public void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public void stopLogcat ()
Stop capturing logcat output from device, and discard currently saved logcat data.
Will have no effect if logcat output is not being captured.
stopUser
public boolean stopUser (int userId)
Stops a given user. If the user is already stopped, this method is a NOOP. Cannot stop current and system user.
פרמטרים | |
---|---|
userId | int : of the user to stop. |
החזרות | |
---|---|
boolean | true if the user was successfully stopped. |
זורק | |
---|---|
DeviceNotAvailableException |
stopUser
public boolean stopUser (int userId, boolean waitFlag, boolean forceFlag)
Stop a given user. Possible to provide extra flags to wait for the operation to have effect, and force terminate the user. Cannot stop current and system user.
פרמטרים | |
---|---|
userId | int : of the user to stop. |
waitFlag | boolean : will make the command wait until user is stopped. |
forceFlag | boolean : will force stop the user. |
החזרות | |
---|---|
boolean | true if the user was successfully stopped. |
זורק | |
---|---|
DeviceNotAvailableException |
switchToAdbTcp
public String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
החזרות | |
---|---|
String | the tcp serial number or null if device could not be switched |
זורק | |
---|---|
DeviceNotAvailableException |
switchToAdbUsb
public boolean switchToAdbUsb ()
Switch device to adb over usb mode.
החזרות | |
---|---|
boolean | true if switch was successful, false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException |
switchUser
public boolean switchUser (int userId)
Switch to another userId with a default timeout. switchUser(int, long)
.
פרמטרים | |
---|---|
userId | int |
החזרות | |
---|---|
boolean | True if the new userId matches the userId provider. שקר אחרת. |
זורק | |
---|---|
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. שקר אחרת. |
זורק | |
---|---|
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.
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. |
זורק | |
---|---|
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. |
זורק | |
---|---|
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 callpostBootSetup()
. Therefore, the device might not be fully ready to be tested when this method returns.החזרות | |
---|---|
boolean | true if successful or if the device is unencrypted. |
זורק | |
---|---|
DeviceNotAvailableException |
waitForBootComplete
public boolean waitForBootComplete (long timeOut)
Blocks until the device's boot complete flag is set.
פרמטרים | |
---|---|
timeOut | long : time in msecs to wait for the flag to be set |
החזרות | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
זורק | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailable
public boolean waitForDeviceAvailable ()
Waits for the device to be responsive and available for testing. Uses default timeout.
החזרות | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
זורק | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailable
public boolean waitForDeviceAvailable (long waitTime)
Waits for the device to be responsive and available for testing.
פרמטרים | |
---|---|
waitTime | long : the time in ms to wait |
החזרות | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
זורק | |
---|---|
DeviceNotAvailableException |
waitForDeviceBootloader
public void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
זורק | |
---|---|
DeviceNotAvailableException |
waitForDeviceInRecovery
public boolean waitForDeviceInRecovery (long waitTime)
Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery
).
פרמטרים | |
---|---|
waitTime | long : the time in ms to wait |
החזרות | |
---|---|
boolean | true if device boots into recovery before time expires. false otherwise |
waitForDeviceInSideload
public boolean waitForDeviceInSideload (long waitTime)
Blocks for the device to be in the 'adb sideload' state
פרמטרים | |
---|---|
waitTime | long : the time in ms to wait |
החזרות | |
---|---|
boolean | true if device boots into sideload before time expires. false otherwise |
waitForDeviceNotAvailable
public boolean waitForDeviceNotAvailable (long waitTime)
Blocks for the device to be not available ie missing from adb
פרמטרים | |
---|---|
waitTime | long : the time in ms to wait |
החזרות | |
---|---|
boolean | true if device becomes not available before time expires. false otherwise |
waitForDeviceOnline
public void waitForDeviceOnline ()
Blocks until device is visible via adb. Uses default timeout
Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable()
instead.
זורק | |
---|---|
DeviceNotAvailableException |
waitForDeviceOnline
public void waitForDeviceOnline (long waitTime)
Blocks until device is visible via adb.
Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable()
instead.
פרמטרים | |
---|---|
waitTime | long : the time in ms to wait |
זורק | |
---|---|
DeviceNotAvailableException |
waitForDeviceShell
public boolean waitForDeviceShell (long waitTime)
Waits for device to be responsive to a basic adb shell command.
פרמטרים | |
---|---|
waitTime | long : the time in ms to wait |
החזרות | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |
Protected methods
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 . |
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. |
זורק | |
---|---|
DeviceNotAvailableException |
ensureRuntimePermissionSupported
protected void ensureRuntimePermissionSupported ()
helper method to throw exception if runtime permission isn't supported
זורק | |
---|---|
DeviceNotAvailableException |
getBugreportzInternal
protected File getBugreportzInternal ()
Internal Helper method to get the bugreportz zip file as a ERROR(/File)
.
החזרות | |
---|---|
File |
internalGetProperty
protected String internalGetProperty (String propName, String fastbootVar, String description)
Fetch a device property, from the ddmlib cache by default, and falling back to either `adb shell getprop` or `fastboot getvar` depending on whether the device is in Fastboot or not.
פרמטרים | |
---|---|
propName | String : The name of the device property as returned by `adb shell getprop` |
fastbootVar | String : The name of the equivalent fastboot variable to query. if null , fastboot query will not be attempted |
description | String : A simple description of the variable. First letter should be capitalized. |
החזרות | |
---|---|
String | A string, possibly null or empty, containing the value of the given property |
זורק | |
---|---|
DeviceNotAvailableException |
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 |
performDeviceAction
protected boolean performDeviceAction (String actionDescription, com.android.tradefed.device.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 | com.android.tradefed.device.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 ()
Possible extra actions that can be taken after a reboot.
זורק | |
---|---|
DeviceNotAvailableException |
prePostBootSetup
protected void prePostBootSetup ()
Allows each device type (AndroidNativeDevice, TestDevice) to override this method for specific post boot setup.
זורק | |
---|---|
DeviceNotAvailableException |
pullFileInternal
protected boolean pullFileInternal (String remoteFilePath, File localFile)
פרמטרים | |
---|---|
remoteFilePath | String |
localFile | File |
החזרות | |
---|---|
boolean |
זורק | |
---|---|
DeviceNotAvailableException |
setClock
protected void setClock (Clock clock)
Set the Clock instance to use.
פרמטרים | |
---|---|
clock | Clock |
setLogStartDelay
protected 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 |
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. |
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2022-11-07 (שעון UTC).