INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
מספק API אמין וברמה מעט גבוהה יותר ל-ddmlib IDevice
.
מנסה שוב פקודות מכשיר בכמות הניתנת להגדרה, ומספקת ממשק שחזור מכשיר למכשירים שאינם מגיבים.
סיכום
קבועים | |
---|---|
int | UNKNOWN_API_LEVEL ערך ברירת מחדל כאשר לא ניתן לזהות את רמת ה-API |
שיטות ציבוריות | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) בדוק אם תכונה נתמכת כרגע או לא בהינתן רמה נתמכת מינימלית. |
abstract void | clearLogcat () מוחק כל נתוני logcat שנצברו. |
abstract void | deleteFile (String deviceFilePath) שיטת עוזר למחיקת קובץ או ספרייה במכשיר. |
abstract boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) שיטת עוזר לבדוק אם ההתקן הופעל מחדש על ידי השוואת system_server הנוכחי עם system_server הקודם |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) שיטת עוזר לבדוק אם המכשיר הופעל מחדש מאז זמן UTC מאז התקופה מהמכשיר וה- |
abstract boolean | disableAdbRoot () מכבה את ה-adb root. |
abstract boolean | doesFileExist (String deviceFilePath) שיטת עוזר לקבוע אם קיים קובץ במכשיר. |
abstract boolean | enableAdbRoot () מפעיל את השורש של adb. |
abstract String | executeAdbCommand (long timeout, String... commandArgs) שיטת עוזר המבצעת פקודת adb כפקודת מערכת עם פסק זמן מוגדר. |
abstract String | executeAdbCommand (String... commandArgs) שיטת עוזר המבצעת פקודת adb כפקודת מערכת. |
abstract String | executeAdbCommand (long timeout, envMap, String... commandArgs) executeAdbCommand (long timeout, envMap, String... commandArgs) שיטת עוזר המבצעת פקודת adb כפקודת מערכת עם פסק זמן מוגדר. |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) שיטת עוזר המבצעת פקודת fastboot בתור פקודת מערכת. |
abstract CommandResult | executeFastbootCommand (String... commandArgs) שיטת עוזר המבצעת פקודת fastboot כפקודת מערכת עם פסק זמן ברירת מחדל של 2 דקות. |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) שיטת עוזר המבצעת פקודת fastboot שפועלת לאורך זמן בתור פקודת מערכת. |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) שיטת עוזר המבצעת פקודת fastboot ארוכת שנים כפקודה מערכת עם משתני סביבת מערכת. |
abstract String | executeShellCommand (String command) שיטת Helper שמבצעת פקודת adb shell ומחזירה |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) מבצע את פקודת ה-adb shell הנתונה, מנסה שוב מספר פעמים אם הפקודה נכשלת. |
abstract CommandResult | executeShellV2Command (String command) שיטת Helper אשר מבצעת פקודת adb shell ומחזירה את התוצאות כ- |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) שיטת Helper המבצעת פקודת adb shell ומחזירה את התוצאות כ- |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) שיטת Helper אשר מבצעת פקודת adb shell ומחזירה את התוצאות כ- |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה. |
abstract CommandResult | fastbootWipePartition (String partition) שיטת עוזר המנגבת מחיצה למכשיר. |
abstract int | getApiLevel () קבל את רמת ה-API של המכשיר. |
abstract String | getBasebandVersion () שיטת נוחות לקבל את גרסת פס הבסיס (רדיו) של מכשיר זה. |
abstract Integer | getBattery () מחזירה את רמת הסוללה הנוכחית של מכשיר או Null אם רמת הסוללה אינה זמינה. |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) מחזירה ערך בוליאני של המאפיין הנתון. |
abstract | getBootHistory () שיטת העזר אוספת את מפת היסטוריית האתחול עם זמן האתחול וסיבת האתחול. |
abstract | getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) שיטת העזר אוספת את מפת היסטוריית האתחול עם זמן האתחול וסיבת האתחול מאז הזמן הנתון מאז התקופה מהמכשיר ויחידת הזמן שצוינה. |
abstract String | getBootloaderVersion () שיטת נוחות לקבל את גרסת טוען האתחול של מכשיר זה. |
abstract String | getBuildAlias () אחזר את הכינוי של ה-build שהמכשיר פועל כעת. |
abstract String | getBuildFlavor () אחזר את טעם המבנה של המכשיר. |
abstract String | getBuildId () אחזר את ה-build שהמכשיר פועל כעת. |
abstract String | getBuildSigningKeys () מחזירה את סוג המפתח המשמש לחתימה על תמונת המכשיר בדרך כלל מכשירי אנדרואיד עשויים להיות חתומים עם מפתחות בדיקה (כמו ב-AOSP) או מפתחות שחרור (נשלטים על ידי יצרני מכשירים בודדים) |
abstract DeviceDescriptor | getCachedDeviceDescriptor () מחזיר |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) מחזיר |
abstract String[] | getChildren (String deviceFilePath) חלופה לשימוש |
abstract AbstractConnection | getConnection () מחזיר את החיבור המשויך למכשיר. |
abstract String | getDeviceClass () קבל את שיעור המכשיר. |
abstract long | getDeviceDate () החזר את תאריך המכשיר באלפי שניות מאז התקופה. |
abstract DeviceDescriptor | getDeviceDescriptor () החזר |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) החזר |
abstract TestDeviceState | getDeviceState () קבל את מצב המכשיר. |
abstract long | getDeviceTimeOffset (Date date) עוזר לקבל את הפרש הזמן בין המכשיר לבין |
abstract InputStreamSource | getEmulatorOutput () קבל את הזרם של emulator stdout ו-stderr |
abstract long | getExternalStoreFreeSpace () שיטת עוזר לקביעת כמות השטח הפנוי באחסון החיצוני של המכשיר. |
abstract String | getFastbootProductType () שיטת נוחות לקבל את סוג המוצר של מכשיר זה כשהוא במצב אתחול מהיר. |
abstract String | getFastbootProductVariant () שיטת נוחות לקבל את סוג המוצר של מכשיר זה כשהוא במצב אתחול מהיר. |
abstract String | getFastbootSerialNumber () מחזיר את המספר הסידורי של מצב האתחול המהיר. |
abstract String | getFastbootVariable (String variableName) אחזר את ערך משתנה fastboot הנתון מהמכשיר. |
abstract IFileEntry | getFileEntry (String path) אחזר הפניה לקובץ מרוחק במכשיר. |
abstract IDevice | getIDevice () מחזירה הפניה ל-ddmlib |
abstract long | getIntProperty (String name, long defaultValue) מחזירה ערך מספר שלם של המאפיין הנתון מהמכשיר. |
abstract long | getLastExpectedRebootTimeMillis () מחזירה את הפעם האחרונה שבה ממשקי API של Tradefed הפעילו אתחול מחדש באלפיות שניות מאז EPOCH כפי שהוחזר על ידי |
abstract int | getLaunchApiLevel () קבל את רמת ה-API הראשונה שהושקה במכשיר. |
abstract InputStreamSource | getLogcat () תופס זרם תמונת מצב של נתוני logcat. |
abstract InputStreamSource | getLogcat (int maxBytes) תופס זרם תמונת מצב של |
abstract InputStreamSource | getLogcatDump () קבל dump של ה-logcat הנוכחי עבור המכשיר. |
abstract InputStreamSource | getLogcatSince (long date) תופס זרם תמונת מצב של נתוני logcat שנלכדו החל מהתאריך שסופק. |
abstract String | getMountPoint (String mountName) מחזירה נקודת הרכבה. |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) מחזירה |
abstract | getMountPointInfo () מחזירה גרסה מנותחת של המידע ב-/proc/mounts במכשיר |
abstract long | getPartitionFreeSpace (String partition) שיטת עוזר לקביעת כמות השטח הפנוי במחיצת המכשיר. |
abstract ProcessInfo | getProcessByName (String processName) שיטת Helper מפעילה את הפקודה "pidof" ו-"stat" ומחזירה אובייקט |
abstract String | getProcessPid (String process) מחזיר את ה-pid של השירות או null אם משהו השתבש. |
abstract String | getProductType () שיטת נוחות לקבל את סוג המוצר של מכשיר זה. |
abstract String | getProductVariant () שיטת נוחות לקבל את גרסת המוצר של מכשיר זה. |
abstract String | getProperty (String name) אחזר את ערך המאפיין הנתון מהמכשיר. |
abstract ITestDevice.RecoveryMode | getRecoveryMode () קבל את מצב השחזור הנוכחי המשמש עבור המכשיר. |
abstract String | getSerialNumber () שיטת נוחות לקבלת מספר סידורי של מכשיר זה. |
abstract | getTombstones () אחזר והחזר את רשימת המצבות מהמכשירים. |
abstract long | getTotalMemory () מחזירה את גודל הזיכרון הפיזי הכולל בבתים או -1 במקרה של שגיאה פנימית |
abstract boolean | getUseFastbootErase () בדוק אם להשתמש בפורמט Fastboot Erase או Fastboot כדי למחוק מחיצה במכשיר. |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () בדוק אם הפלטפורמה במכשיר תומכת בספירת אפליקציות |
abstract boolean | isBypassLowTargetSdkBlockSupported () בדוק אם הפלטפורמה במכשיר תומכת בעקיפה של חסימת יעד נמוך של SDK בהתקנות אפליקציה |
abstract boolean | isDeviceEncrypted () חוזר אם המכשיר מוצפן. |
abstract boolean | isDirectory (String deviceFilePath) החזר True אם הנתיב במכשיר הוא ספרייה, אחרת false. |
abstract boolean | isEncryptionSupported () חוזר אם ההצפנה נתמכת במכשיר. |
abstract boolean | isExecutable (String fullPath) מחזירה True אם נתיב הקובץ במכשיר הוא קובץ הפעלה, אחרת false. |
abstract boolean | isHeadless () החזר אמת אם המכשיר חסר ראש (ללא מסך), אחרת שקר. |
abstract boolean | isRuntimePermissionSupported () בדוק אם הפלטפורמה במכשיר תומכת בהענקת הרשאות זמן ריצה |
abstract boolean | isStateBootloaderOrFastbootd () מחזירה true אם המכשיר נמצא ב- |
abstract boolean | logAnrs ( ITestLogger logger) אוסף ורישום ANR מהמכשיר. |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) התחבר הודעה ב-logcat של המכשיר. |
abstract void | nonBlockingReboot () מוציא פקודה לאתחול מחדש של המכשיר ומחזיר כאשר הפקודה הושלמה וכאשר המכשיר אינו גלוי עוד ל-adb. |
abstract void | postBootSetup () בצע הוראות להגדרת ההתקן לבדיקה זאת לאחר כל אתחול. |
default void | postInvocationTearDown () שיטה זו הוצאה משימוש. השתמש במקום זאת |
abstract void | postInvocationTearDown (Throwable invocationException) שלבים נוספים עבור ניקוי נדרש ספציפי למכשיר שיבוצעו לאחר ביצוע ההזמנה. |
default void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) שלבים נוספים עבור הגדרה נדרשת ספציפית למכשיר שיבוצעו במכשיר לפני זרימת הפנייה. |
abstract boolean | pullDir (String deviceFilePath, File localDir) משוך באופן רקורסיבי את תוכן הספרייה מהמכשיר. |
abstract File | pullFile (String remoteFilePath, int userId) מאחזר קובץ מחוץ להתקן, מאחסן אותו ב- |
abstract File | pullFile (String remoteFilePath) מאחזר קובץ מחוץ להתקן, מאחסן אותו ב- |
abstract boolean | pullFile (String remoteFilePath, File localFile) מאחזר קובץ מחוץ למכשיר. |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) מאחזר קובץ מחוץ למכשיר. |
abstract String | pullFileContents (String remoteFilePath) מאחזר קובץ מחוץ למכשיר ומחזיר את התוכן. |
abstract File | pullFileFromExternal (String remoteFilePath) שיטת נוחות לאחזור קובץ מהאחסון החיצוני של המכשיר, מאחסנת אותו ב- |
abstract boolean | pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories) דחוף באופן רקורסיבי את תוכן הספרייה למכשיר תוך אי הכללה של מספר ספריות שמסוננות. |
abstract boolean | pushDir (File localDir, String deviceFilePath) דחוף באופן רקורסיבי את תוכן הספרייה למכשיר. |
abstract boolean | pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded) וריאנט של |
abstract boolean | pushFile (File localFile, String deviceFilePath) דחוף קובץ למכשיר. |
abstract boolean | pushString (String contents, String deviceFilePath) דחיפה של קובץ שנוצר ממחרוזת למכשיר |
abstract void | reboot () מאתחל את המכשיר למצב adb. |
abstract void | reboot (String reason) מאתחל את המכשיר למצב adb עם |
abstract void | rebootIntoBootloader () מאתחל את המכשיר למצב טוען אתחול. |
abstract void | rebootIntoFastbootd () מאתחל את המכשיר למצב fastbootd. |
abstract void | rebootIntoRecovery () מאתחל את המכשיר למצב שחזור adb. |
abstract void | rebootIntoSideload (boolean autoReboot) מאתחל את המכשיר למצב adb sideload (שים לב שזהו מצב מיוחד תחת שחזור) חוסם עד שהמכשיר נכנס למצב עומס צד |
abstract void | rebootIntoSideload () מאתחל את המכשיר למצב adb sideload (שים לב שזהו מצב מיוחד תחת שחזור) חוסם עד שהמכשיר נכנס למצב עומס צד |
abstract void | rebootUntilOnline () חלופי ל- |
abstract void | rebootUntilOnline (String reason) חלופי ל- |
abstract void | rebootUserspace () מאתחל רק חלק ממרחב המשתמש של המכשיר. |
abstract void | rebootUserspaceUntilOnline () חלופי ל- |
abstract void | remountSystemReadOnly () הפוך את מחיצת המערכת במכשיר לקריאה בלבד. |
abstract void | remountSystemWritable () הפוך את מחיצת המערכת במכשיר לניתנת לכתיבה. |
abstract void | remountVendorReadOnly () הפוך את מחיצת הספק במכשיר לקריאה בלבד. |
abstract void | remountVendorWritable () הפוך את מחיצת הספק במכשיר לניתנת לכתיבה. |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) שיטת נוחות לביצוע |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) מפעיל בדיקות מכשור ומספק שחזור מכשיר. |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) זהה |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) זהה ל- |
abstract void | setDate (Date date) מגדיר את התאריך במכשיר הערה: הגדרת התאריך במכשיר דורשת שורש |
abstract void | setOptions ( TestDeviceOptions options) הגדר את |
abstract boolean | setProperty (String propKey, String propValue) מגדיר את ערך המאפיין הנתון במכשיר. |
abstract void | setRecovery ( IDeviceRecovery recovery) הגדר את |
abstract void | setRecoveryMode ( ITestDevice.RecoveryMode mode) הגדר את מצב השחזור הנוכחי לשימוש עבור המכשיר. |
abstract void | setUseFastbootErase (boolean useFastbootErase) הגדר אם להשתמש בפורמט Fastboot Erase או Fastboot כדי למחוק מחיצה במכשיר. |
abstract void | startLogcat () התחל ללכוד פלט logcat מהמכשיר ברקע. |
abstract void | stopEmulatorOutput () סגור ומחק את פלט האמולטור. |
abstract void | stopLogcat () הפסק ללכוד פלט logcat מהמכשיר, והסר את נתוני logcat השמורים כעת. |
abstract String | switchToAdbTcp () העבר את המכשיר למצב adb-over-tcp. |
abstract boolean | switchToAdbUsb () העבר את המכשיר למצב adb over usb. |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) מסנכרן בהדרגה את התוכן של ספריית קבצים מקומית למכשיר. |
abstract boolean | unlockDevice () ביטול נעילת המכשיר אם המכשיר נמצא במצב מוצפן. |
abstract boolean | waitForBootComplete (long timeOut) חסימה עד להגדרת דגל השלמת האתחול של המכשיר. |
abstract boolean | waitForDeviceAvailable () ממתין עד שהמכשיר יהיה מגיב וזמין לבדיקה. |
abstract boolean | waitForDeviceAvailable (long waitTime) ממתין עד שהמכשיר יהיה מגיב וזמין לבדיקה. |
abstract boolean | waitForDeviceAvailableInRecoverPath (long waitTime) ממתין עד שהמכשיר יהיה מגיב וזמין מבלי להתחשב בנתיב השחזור. |
abstract void | waitForDeviceBootloader () חוסם עד שהמכשיר יהיה גלוי באמצעות fastboot. |
abstract boolean | waitForDeviceInRecovery (long waitTime) חוסם שהמכשיר יהיה במצב 'adb recovery' (שים לב שזה שונה מ- |
abstract boolean | waitForDeviceInSideload (long waitTime) חוסם שהמכשיר יהיה במצב 'עומס צד של adb' |
abstract boolean | waitForDeviceNotAvailable (long waitTime) חוסמים שהמכשיר לא יהיה זמין כלומר חסרים ב-adb |
abstract void | waitForDeviceOnline () חסימה עד שהמכשיר יהיה גלוי דרך adb. |
abstract void | waitForDeviceOnline (long waitTime) חסימה עד שהמכשיר יהיה גלוי דרך adb. |
abstract boolean | waitForDeviceShell (long waitTime) ממתין עד שהמכשיר יגיב לפקודה בסיסית של adb shell. |
קבועים
UNKNOWN_API_LEVEL
public static final int UNKNOWN_API_LEVEL
ערך ברירת מחדל כאשר לא ניתן לזהות את רמת ה-API
ערך קבוע: -1 (0xffffffff)
שיטות ציבוריות
checkApiLevelAgainstNextRelease
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
בדוק אם תכונה נתמכת כרגע או לא בהינתן רמה נתמכת מינימלית. שיטה זו לוקחת בחשבון תכונות שטרם פורסמו, לפני העלאת רמת ה-API.
פרמטרים | |
---|---|
strictMinLevel | int : הרמה המינימלית האפשרית הקפדנית התומכת בתכונה. |
החזרות | |
---|---|
boolean | נכון אם הרמה נתמכת. שקר אחרת. |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
clearLogcat
public abstract void clearLogcat ()
מוחק כל נתוני logcat שנצברו.
זה שימושי למקרים שבהם אתה רוצה להבטיח ITestDevice#getLogcat()
מחזיר רק נתוני יומן שנוצרו לאחר נקודה מסוימת (כגון לאחר הבזק של בניית מכשיר חדש וכו').
מחק קובץ
public abstract void deleteFile (String deviceFilePath)
שיטת עוזר למחיקת קובץ או ספרייה במכשיר.
פרמטרים | |
---|---|
deviceFilePath | String : הנתיב המוחלט של הקובץ במכשיר. |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestarted
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
שיטת עוזר לבדוק אם ההתקן הופעל מחדש על ידי השוואת system_server הנוכחי עם system_server הקודם ProcessInfo
. השתמש getProcessByName(String)
כדי לקבל ProcessInfo
.
פרמטרים | |
---|---|
prevSystemServerProcess | ProcessInfo : תהליך system_server הקודם ProcessInfo . |
החזרות | |
---|---|
boolean | true אם המכשיר מופעל מחדש |
זורק | |
---|---|
RuntimeException | אם למכשיר יש סיבה לאתחול חריגה |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestartedSince
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
שיטת עוזר לבדוק אם המכשיר הופעל מחדש מאז זמן UTC מאז התקופה מהמכשיר וה- ERROR(/TimeUnit)
שלו. Soft-Restart מתייחס ל-system_server שהופעל מחדש מחוץ לאתחול קשיח של התקן (לדוגמה: אתחול מחדש מבוקש). ניתן להשיג את המכשיר הנוכחי utcEpochTime ב-Millisecond באמצעות השיטה getDeviceDate()
.
פרמטרים | |
---|---|
utcEpochTime | long : זמן המכשיר בשנייה מאז התקופה. |
timeUnit | TimeUnit : יחידת הזמן TimeUnit עבור utcEpochTime הנתון. |
החזרות | |
---|---|
boolean | true אם המכשיר מופעל מחדש |
זורק | |
---|---|
RuntimeException | אם למכשיר יש סיבה לא תקינה לאתחול |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
disableAdbRoot
public abstract boolean disableAdbRoot ()
מכבה את ה-adb root.
השבתת ה-adb root עלולה לגרום למכשיר להתנתק מ-adb. שיטה זו תחסום עד שהמכשיר יהיה זמין.
החזרות | |
---|---|
boolean | true אם מצליח. |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
doesFileExist
public abstract boolean doesFileExist (String deviceFilePath)
שיטת עוזר לקבוע אם קיים קובץ במכשיר.
פרמטרים | |
---|---|
deviceFilePath | String : הנתיב המוחלט של הקובץ במכשיר שיש לבדוק |
החזרות | |
---|---|
boolean | true אם הקובץ קיים, false אחרת. |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
enableAdbRoot
public abstract boolean enableAdbRoot ()
מפעיל את השורש של adb. אם ההגדרה "enable-root" היא "false", תירשם הודעה ותחזור מבלי להפעיל את ה-root.
הפעלת ה-adb root עלולה לגרום למכשיר להתנתק מ-adb. שיטה זו תחסום עד שהמכשיר יהיה זמין.
החזרות | |
---|---|
boolean | true אם מצליח. |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeAdbCommand
public abstract String executeAdbCommand (long timeout, String... commandArgs)
שיטת עוזר המבצעת פקודת adb כפקודת מערכת עם פסק זמן מוגדר.
במקום זאת יש להשתמש executeShellCommand(String)
בכל מקום אפשרי, שכן שיטה זו מספקת זיהוי וביצועים טובים יותר של כשלים.
פרמטרים | |
---|---|
timeout | long : הזמן באלפיות שניות לפני שהמכשיר נחשב ללא מגיב, 0L ללא פסק זמן |
commandArgs | String : פקודת adb והארגומנטים להפעלה |
החזרות | |
---|---|
String | הסטדאוט מהפקודה. null אם הפקודה נכשלה בביצוע. |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeAdbCommand
public abstract String executeAdbCommand (String... commandArgs)
שיטת עוזר המבצעת פקודת adb כפקודת מערכת.
במקום זאת יש להשתמש executeShellCommand(String)
בכל מקום אפשרי, שכן שיטה זו מספקת זיהוי וביצועים טובים יותר של כשלים.
פרמטרים | |
---|---|
commandArgs | String : פקודת adb והארגומנטים להפעלה |
החזרות | |
---|---|
String | הסטדאוט מהפקודה. null אם הפקודה נכשלה בביצוע. |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeAdbCommand
public abstract String executeAdbCommand (long timeout,envMap, String... commandArgs)
שיטת עוזר המבצעת פקודת adb כפקודת מערכת עם פסק זמן מוגדר.
במקום זאת יש להשתמש executeShellCommand(String)
בכל מקום אפשרי, שכן שיטה זו מספקת זיהוי וביצועים טובים יותר של כשלים.
פרמטרים | |
---|---|
timeout | long : הזמן באלפיות שניות לפני שהמכשיר נחשב ללא מגיב, 0L ללא פסק זמן |
envMap | |
commandArgs | String : פקודת adb והארגומנטים להפעלה |
החזרות | |
---|---|
String | הסטדאוט מהפקודה. null אם הפקודה נכשלה בביצוע. |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeFastbootCommand
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
שיטת עוזר המבצעת פקודת fastboot בתור פקודת מערכת.
צפוי להיות בשימוש כאשר המכשיר כבר נמצא במצב אתחול מהיר.
פרמטרים | |
---|---|
timeout | long : הזמן באלפיות שניות לפני פקיעת הפקודה |
commandArgs | String : פקודת fastboot והארגומנטים להפעלה |
החזרות | |
---|---|
CommandResult | תוצאת הפקודה המכילה פלט של הפקודה |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeFastbootCommand
public abstract CommandResult executeFastbootCommand (String... commandArgs)
שיטת עוזר המבצעת פקודת fastboot כפקודת מערכת עם פסק זמן ברירת מחדל של 2 דקות.
צפוי להיות בשימוש כאשר המכשיר כבר נמצא במצב אתחול מהיר.
פרמטרים | |
---|---|
commandArgs | String : פקודת fastboot והארגומנטים להפעלה |
החזרות | |
---|---|
CommandResult | תוצאת הפקודה המכילה פלט של הפקודה |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
שיטת עוזר המבצעת פקודת fastboot שפועלת לאורך זמן בתור פקודת מערכת.
זהה ל- executeFastbootCommand(String)
למעט שימוש בפסק זמן ארוך יותר.
פרמטרים | |
---|---|
commandArgs | String : פקודת fastboot והארגומנטים להפעלה |
החזרות | |
---|---|
CommandResult | תוצאת הפקודה המכילה פלט של הפקודה |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
שיטת עוזר המבצעת פקודת fastboot ארוכת שנים כפקודה מערכת עם משתני סביבת מערכת.
זהה ל- executeFastbootCommand(String)
למעט שימוש בפסק זמן ארוך יותר.
פרמטרים | |
---|---|
envVarMap | |
commandArgs | String : פקודת fastboot והארגומנטים להפעלה |
החזרות | |
---|---|
CommandResult | תוצאת הפקודה המכילה פלט של הפקודה |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeShellCommand
public abstract String executeShellCommand (String command)
שיטת Helper שמבצעת פקודת adb shell ומחזירה String
כמחרוזת.
פרמטרים | |
---|---|
command | String : פקודת ה-adb shell להפעלה |
החזרות | |
---|---|
String | פלט המעטפת |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeShellCommand
public abstract 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 abstract 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 abstract 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 abstract CommandResult executeShellV2Command (String command)
שיטת Helper אשר מבצעת פקודת adb shell ומחזירה את התוצאות כ- CommandResult
המאוכלסת כהלכה בפלט סטטוס הפקודה, stdout ו-stderr.
פרמטרים | |
---|---|
command | String : הפקודה שצריך להפעיל. |
החזרות | |
---|---|
CommandResult | התוצאה ב- CommandResult . |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
שיטת Helper המבצעת פקודת adb shell ומחזירה את התוצאות כ- CommandResult
המאוכלסת כהלכה בפלט סטטוס הפקודה וב-stderr. stdout מופנה לזרם שצוין.
פרמטרים | |
---|---|
command | String : הפקודה שצריך להפעיל. |
pipeToOutput | OutputStream : ERROR(/OutputStream) שבו הפלט std יופנה מחדש, או null. |
החזרות | |
---|---|
CommandResult | התוצאה ב- CommandResult . |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
שיטת Helper אשר מבצעת פקודת adb shell ומחזירה את התוצאות כ- CommandResult
המאוכלסת כהלכה בפלט סטטוס הפקודה, stdout ו-stderr.
פרמטרים | |
---|---|
command | String : הפקודה שצריך להפעיל. |
pipeAsInput | File : ERROR(/File) שיועבר כקלט לפקודה, או null. |
החזרות | |
---|---|
CommandResult | התוצאה ב- CommandResult . |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה.
פרמטרים | |
---|---|
command | String : פקודת ה-adb shell להפעלה |
maxTimeoutForCommand | long : הזמן הקצוב המרבי להשלמת הפקודה; יחידה כפי שצוין ב- timeUnit |
timeUnit | TimeUnit : יחידה עבור maxTimeToOutputShellResponse |
retryAttempts | int : מספר הפעמים המרבי לניסיון חוזר בפקודה אם היא נכשלת עקב חריג. DeviceNotResponsiveException יושפך אם יתבצעו retryAttempts ללא הצלחה. |
החזרות | |
---|---|
CommandResult |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה.
פרמטרים | |
---|---|
command | String : פקודת ה-adb shell להפעלה |
maxTimeoutForCommand | long : הזמן הקצוב המרבי להשלמת הפקודה; יחידה כפי שצוין ב- timeUnit |
timeUnit | TimeUnit : יחידה עבור maxTimeToOutputShellResponse |
החזרות | |
---|---|
CommandResult |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה.
פרמטרים | |
---|---|
command | String : פקודת ה-adb shell להפעלה |
pipeAsInput | File : ERROR(/File) שיועבר כקלט לפקודה, או null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) שבו הפלט std יופנה מחדש, או null. |
maxTimeoutForCommand | long : הזמן הקצוב המרבי להשלמת הפקודה; יחידה כפי שצוין ב- timeUnit |
timeUnit | TimeUnit : יחידה עבור maxTimeToOutputShellResponse |
retryAttempts | int : מספר הפעמים המרבי לניסיון חוזר בפקודה אם היא נכשלת עקב חריג. DeviceNotResponsiveException יושפך אם יתבצעו retryAttempts ללא הצלחה. |
החזרות | |
---|---|
CommandResult |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
מבצע פקודת מעטפת adb, עם פרמטרים נוספים לשליטה בהתנהגות הפקודה.
פרמטרים | |
---|---|
command | String : פקודת ה-adb shell להפעלה |
pipeAsInput | File : ERROR(/File) שיועבר כקלט לפקודה, או null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) שבו הפלט std יופנה מחדש, או null. |
pipeToError | OutputStream : ERROR(/OutputStream) שבו השגיאה std תופנה מחדש, או null. |
maxTimeoutForCommand | long : הזמן הקצוב המרבי להשלמת הפקודה; יחידה כפי שצוין ב- timeUnit |
timeUnit | TimeUnit : יחידה עבור maxTimeToOutputShellResponse |
retryAttempts | int : מספר הפעמים המרבי לניסיון חוזר בפקודה אם היא נכשלת עקב חריג. DeviceNotResponsiveException יושפך אם יתבצעו retryAttempts ללא הצלחה. |
החזרות | |
---|---|
CommandResult |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
fastbootWipePartition
public abstract CommandResult fastbootWipePartition (String partition)
שיטת עוזר המנגבת מחיצה למכשיר.
אם getUseFastbootErase()
הוא true
, אזי Fastboot erase ישמש למחיקת המחיצה. לאחר מכן, ההתקן חייב ליצור מערכת קבצים בפעם הבאה שהמכשיר מבצע אתחול. אחרת, נעשה שימוש בפורמט fastboot שייצור מערכת קבצים חדשה במכשיר.
צפוי להיות בשימוש כאשר המכשיר כבר נמצא במצב אתחול מהיר.
פרמטרים | |
---|---|
partition | String : המחיצה לניגוב |
החזרות | |
---|---|
CommandResult | תוצאת הפקודה המכילה פלט של הפקודה |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
getApiLevel
public abstract int getApiLevel ()
קבל את רמת ה-API של המכשיר. ברירת המחדל היא UNKNOWN_API_LEVEL
.
החזרות | |
---|---|
int | מספר שלם המציין את רמת ה-API של המכשיר |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBasebandVersion
public abstract String getBasebandVersion ()
שיטת נוחות לקבל את גרסת פס הבסיס (רדיו) של מכשיר זה. קבלת גרסת הרדיו היא ספציפית למכשיר, ולכן ייתכן שהיא לא תחזיר את המידע הנכון עבור כל המכשירים. שיטה זו מסתמכת על המאפיין gsm.version.baseband כדי להחזיר את מידע הגרסה הנכון. זה לא מדויק עבור מכשירי CDMA מסוימים וייתכן שהגרסה המוחזרת כאן לא תתאים לגרסה שדווחה מ-fastboot וייתכן שלא תחזיר את הגרסה עבור רדיו CDMA. TL;DR שיטה זו מדווחת רק על גרסה מדויקת אם המאפיין gsm.version.baseband זהה לגרסה המוחזרת על ידי fastboot getvar version-baseband
.
החזרות | |
---|---|
String | גרסת String הבסיס של מחרוזת או null אם לא ניתן לקבוע אותה (למכשיר אין רדיו או מחרוזת גרסת לא ניתן לקרוא) |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור עם המכשיר אבד ולא ניתן לשחזר אותו. |
getBattery
public abstract Integer getBattery ()
מחזירה את רמת הסוללה הנוכחית של מכשיר או Null אם רמת הסוללה אינה זמינה.
החזרות | |
---|---|
Integer |
get BooleanProperty
public abstract boolean getBooleanProperty (String name, boolean defaultValue)
מחזירה ערך בוליאני של המאפיין הנתון.
פרמטרים | |
---|---|
name | String : שם הנכס |
defaultValue | boolean : ערך ברירת מחדל להחזרה אם המאפיין ריק או לא קיים. |
החזרות | |
---|---|
boolean | true אם למאפיין יש ערך "1" , "y" , "yes" , "on" או "true" , false אם למאפיין יש ערך של "0" , "n" , "no" , "off" , "false" , או defaultValue אחרת. |
זורק | |
---|---|
DeviceNotAvailableException |
getBootHistory
public abstractgetBootHistory ()
שיטת העזר אוספת את מפת היסטוריית האתחול עם זמן האתחול וסיבת האתחול.
החזרות | |
---|---|
מפה של זמן האתחול (זמן UTC בשנייה מאז Epoch) וסיבת האתחול |
זורק | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
שיטת העזר אוספת את מפת היסטוריית האתחול עם זמן האתחול וסיבת האתחול מאז הזמן הנתון מאז התקופה מהמכשיר ויחידת הזמן שצוינה. ניתן להשיג את המכשיר הנוכחי utcEpochTime במילישניות באמצעות השיטה getDeviceDate()
.
פרמטרים | |
---|---|
utcEpochTime | long : זמן המכשיר מאז Epoch. |
timeUnit | TimeUnit : יחידת הזמן TimeUnit . |
החזרות | |
---|---|
מפה של זמן האתחול (זמן UTC בשנייה מאז Epoch) וסיבת האתחול |
זורק | |
---|---|
DeviceNotAvailableException |
getBootloaderVersion
public abstract String getBootloaderVersion ()
שיטת נוחות לקבל את גרסת טוען האתחול של מכשיר זה.
ינסה לאחזר את גרסת טוען האתחול מהמצב הנוכחי של המכשיר. (כלומר, אם המכשיר נמצא במצב מהיר אתחול, הוא ינסה לאחזר גרסה מ-fastboot)
החזרות | |
---|---|
String | גרסת האתחול String או null אם לא ניתן למצוא אותה |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
getBuildAlias
public abstract String getBuildAlias ()
אחזר את הכינוי של ה-build שהמכשיר פועל כעת.
Build alias הוא בדרך כלל מחרוזת קריאה יותר מאשר Build ID (בדרך כלל מספר עבור Nexus builds). לדוגמה, גרסה סופית של אנדרואיד 4.2 כוללת את כינוי ה-build JDQ39, ומזהה ה-build 573038
החזרות | |
---|---|
String | כינוי ה-build או חזור ל-build id אם לא ניתן היה לאחזר אותו |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildFlavor
public abstract String getBuildFlavor ()
אחזר את טעם המבנה של המכשיר.
החזרות | |
---|---|
String | טעם המבנה או ריק אם לא ניתן היה לאחזר אותו |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildId
public abstract String getBuildId ()
אחזר את ה-build שהמכשיר פועל כעת.
החזרות | |
---|---|
String | מזהה ה-build או IBuildInfo#UNKNOWN_BUILD_ID אם לא ניתן היה לאחזר אותו |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildSigningKeys
public abstract String getBuildSigningKeys ()
מחזירה את סוג המפתח המשמש לחתימה על תמונת המכשיר
בדרך כלל מכשירי אנדרואיד עשויים להיות חתומים עם מפתחות בדיקה (כמו ב-AOSP) או מפתחות שחרור (נשלטים על ידי יצרני מכשירים בודדים)
החזרות | |
---|---|
String | מפתח החתימה אם נמצא, ריק אחרת. |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
מחזיר DeviceDescriptor
שמור אם ההתקן מוקצה, אחרת מחזיר את DeviceDescriptor
הנוכחי.
החזרות | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
מחזיר DeviceDescriptor
שמור אם ההתקן מוקצה, אחרת מחזיר את DeviceDescriptor
הנוכחי.
פרמטרים | |
---|---|
shortDescriptor | boolean : האם להגביל את המתאר למידע מינימלי או לא |
החזרות | |
---|---|
DeviceDescriptor |
getChildren
public abstract String[] getChildren (String deviceFilePath)
חלופה לשימוש IFileEntry
שלפעמים לא עובד בגלל הרשאות.
פרמטרים | |
---|---|
deviceFilePath | String : היא הנתיב במכשיר שבו לבצע את החיפוש |
החזרות | |
---|---|
String[] | מערך מחרוזת המכיל את כל הקובץ בנתיב במכשיר. |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getConnection
public abstract AbstractConnection getConnection ()
מחזיר את החיבור המשויך למכשיר.
החזרות | |
---|---|
AbstractConnection |
getDeviceClass
public abstract String getDeviceClass ()
קבל את שיעור המכשיר.
החזרות | |
---|---|
String | מחלקת מכשירי String . |
getDeviceDate
public abstract long getDeviceDate ()
החזר את תאריך המכשיר באלפי שניות מאז התקופה.
החזרות | |
---|---|
long | התאריך של המכשיר בפורמט עידן. |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
החזר DeviceDescriptor
ממידע המכשיר כדי לקבל מידע עליו מבלי להעביר את אובייקט המכשיר בפועל.
החזרות | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
החזר DeviceDescriptor
ממידע המכשיר כדי לקבל מידע עליו מבלי להעביר את אובייקט המכשיר בפועל.
פרמטרים | |
---|---|
shortDescriptor | boolean : האם להגביל את המתאר למידע מינימלי או לא |
החזרות | |
---|---|
DeviceDescriptor |
getDeviceState
public abstract TestDeviceState getDeviceState ()
קבל את מצב המכשיר.
החזרות | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public abstract long getDeviceTimeOffset (Date date)
עוזר לקבל את הפרש הזמן בין המכשיר לבין ERROR(/Date)
. השתמש ב- Epoch Time באופן פנימי.
פרמטרים | |
---|---|
date | Date |
החזרות | |
---|---|
long | ההפרש באלפיות השנייה |
זורק | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public abstract InputStreamSource getEmulatorOutput ()
קבל את הזרם של emulator stdout ו-stderr
החזרות | |
---|---|
InputStreamSource | פלט אמולטור |
getExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
שיטת עוזר לקביעת כמות השטח הפנוי באחסון החיצוני של המכשיר.
החזרות | |
---|---|
long | כמות השטח הפנוי ב-KB |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
getFastbootProductType
public abstract String getFastbootProductType ()
שיטת נוחות לקבל את סוג המוצר של מכשיר זה כשהוא במצב אתחול מהיר.
יש להשתמש בשיטה זו רק אם המכשיר צריך להיות ב-fastboot. זה גרסה קצת יותר בטוחה מהשיטה הגנרית getProductType()
במקרה זה, מכיוון ש-ITestDevice יידע לשחזר את המכשיר לתוך fastboot אם המכשיר במצב שגוי או אינו מגיב.
החזרות | |
---|---|
String | שם סוג המוצר של String או null אם לא ניתן לקבוע זאת |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
getFastbootProductVariant
public abstract String getFastbootProductVariant ()
שיטת נוחות לקבל את סוג המוצר של מכשיר זה כשהוא במצב אתחול מהיר.
יש להשתמש בשיטה זו רק אם המכשיר צריך להיות ב-fastboot. זה גרסה קצת יותר בטוחה מהשיטה הגנרית getProductType()
במקרה זה, מכיוון ש-ITestDevice יידע לשחזר את המכשיר לתוך fastboot אם המכשיר במצב שגוי או אינו מגיב.
החזרות | |
---|---|
String | שם סוג המוצר של String או null אם לא ניתן לקבוע זאת |
זורק | |
---|---|
DeviceNotAvailableException | אם החיבור למכשיר אבד ולא ניתן לשחזר אותו. |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
מחזיר את המספר הסידורי של מצב האתחול המהיר.
החזרות | |
---|---|
String |
getFastbootVariable
public abstract String getFastbootVariable (String variableName)
אחזר את ערך משתנה fastboot הנתון מהמכשיר.
פרמטרים | |
---|---|
variableName | String : שם המשתנה |
החזרות | |
---|---|
String | ערך הנכס או null אם הוא לא קיים |
זורק | |
---|---|
| UnsupportedOperationException |
DeviceNotAvailableException |
getFileEntry
public abstract IFileEntry getFileEntry (String path)
אחזר הפניה לקובץ מרוחק במכשיר.
פרמטרים | |
---|---|
path | String : נתיב הקובץ לאחזור. יכול להיות נתיב מוחלט או נתיב ביחס ל-'/'. (כלומר, גם תחביר "/system" וגם "מערכת" נתמך) |
החזרות | |
---|---|
IFileEntry | ה- IFileEntry או null אם לא ניתן למצוא את הקובץ path נתון |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getIDvice
public abstract IDevice getIDevice ()
מחזירה הפניה ל-ddmlib IDevice
המשויך.
IDevice
חדש עשוי להיות מוקצה על ידי DDMS בכל פעם שהמכשיר מתנתק ומתחבר מחדש מ-adb. לפיכך, מתקשרים לא צריכים לשמור הפניה ל- IDevice
, מכיוון שההפניה הזו עלולה להתייאש.
החזרות | |
---|---|
IDevice | ה- IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
מחזירה ערך מספר שלם של המאפיין הנתון מהמכשיר.
פרמטרים | |
---|---|
name | String : שם הנכס |
defaultValue | long : ערך ברירת מחדל להחזרה אם המאפיין ריק או לא קיים. |
החזרות | |
---|---|
long | ערך המאפיין או defaultValue אם המאפיין ריק, אינו קיים או שאין לו ערך שלם. |
זורק | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by System.currentTimeMillis()
.
החזרות | |
---|---|
long |
getLaunchApiLevel
public abstract 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 |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getLogcat
public abstract 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 abstract 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 abstract 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 abstract 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 |
getMountPoint
public abstract 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 |
See also:
getMountPointInfo
public abstract 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 |
See also:
getMountPointInfo
public abstractgetMountPointInfo ()
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 |
getPartitionFreeSpace
public abstract 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 | if connection with device is lost and cannot be recovered. |
getProcessByName
public abstract 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 abstract 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 abstract 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 | if connection with device is lost and cannot be recovered, or if product type can not be determined |
getProductVariant
public abstract 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 | if connection with device is lost and cannot be recovered. |
getProperty
public abstract 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 |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getRecoveryMode
public abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
החזרות | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
החזרות | |
---|---|
String | the String serial number |
getTombstones
public abstractgetTombstones ()
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 |
See also:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
החזרות | |
---|---|
long |
getUseFastbootErase
public abstract 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. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
החזרות | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isAdbTcp
public abstract boolean isAdbTcp ()
החזרות | |
---|---|
boolean | true if device is connected to adb-over-tcp, false otherwise. |
isAppEnumerationSupported
public abstract boolean isAppEnumerationSupported ()
Check whether platform on device supports app enumeration
החזרות | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isBypassLowTargetSdkBlockSupported
public abstract boolean isBypassLowTargetSdkBlockSupported ()
Check whether platform on device supports bypassing low target sdk block on app installs
החזרות | |
---|---|
boolean | True if bypass low target sdk block is supported, false otherwise |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
החזרות | |
---|---|
boolean | true if the device is encrypted. |
זורק | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isDirectory
public abstract boolean isDirectory (String deviceFilePath)
Return True if the path on the device is a directory, false otherwise.
פרמטרים | |
---|---|
deviceFilePath | String |
החזרות | |
---|---|
boolean |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
החזרות | |
---|---|
boolean | true if the device supports encryption. |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isExecutable
public abstract boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
פרמטרים | |
---|---|
fullPath | String |
החזרות | |
---|---|
boolean |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
החזרות | |
---|---|
boolean |
זורק | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
החזרות | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
החזרות | |
---|---|
boolean |
logAnrs
public abstract 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 |
logOnDevice
public abstract 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 abstract void nonBlockingReboot ()
Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
postBootSetup
public abstract 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 | if connection with device is lost and cannot be recovered. |
postInvocationTearDown
public void postInvocationTearDown ()
This method is deprecated.
Use postInvocationTearDown(Throwable)
instead.
Extra steps for device specific required clean up that will be executed after the invocation is done.
postInvocationTearDown
public abstract void postInvocationTearDown (Throwable invocationException)
Extra steps for device specific required clean up that will be executed after the invocation is done.
פרמטרים | |
---|---|
invocationException | 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 |
זורק | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFileContents
public abstract 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 abstract 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 | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
פרמטרים | |
---|---|
localDir | 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 | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath)
Recursively push directory contents to device.
פרמטרים | |
---|---|
localDir | 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 | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath, 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 |
deviceFilePath | 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 | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath)
Push a file to device. By default using a content provider.
פרמטרים | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
החזרות | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushString
public abstract boolean pushString (String contents, String deviceFilePath)
Push file created from a string to device
פרמטרים | |
---|---|
contents | String : the contents of the file to push |
deviceFilePath | String : the remote destination absolute file path |
החזרות | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
זורק | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
reboot
public abstract void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.
זורק | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
reboot
public abstract 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 | if device is not available after reboot |
rebootIntoBootloader
public abstract void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.
זורק | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoFastbootd
public abstract void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
זורק | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoRecovery
public abstract void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recovery
זורק | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootIntoSideload
public abstract 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 | if device is not in sideload after reboot |
rebootIntoSideload
public abstract 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 | if device is not in sideload after reboot |
rebootUntilOnline
public abstract void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
זורק | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUntilOnline
public abstract 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 | if device is not available after reboot |
See also:
rebootUserspace
public abstract 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 | if device is not available after reboot |
rebootUserspaceUntilOnline
public abstract void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
זורק | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
remountSystemReadOnly
public abstract void remountSystemReadOnly ()
Make the system partition on the device read-only. May reboot the device.
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountSystemWritable
public abstract void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorReadOnly
public abstract void remountVendorReadOnly ()
Make the vendor partition on the device read-only. May reboot the device.
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
runInstrumentationTests
public abstract 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 | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTests
public abstract 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 | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTestsAsUser
public abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId,listeners)
Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection))
but runs the test for the given user.
פרמטרים | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
החזרות | |
---|---|
boolean |
זורק | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public abstract 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 |
setDate
public abstract 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 |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setOptions
public abstract void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
פרמטרים | |
---|---|
options | TestDeviceOptions |
setProperty
public abstract 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. |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setRecovery
public abstract 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 abstract 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. |
setUseFastbootErase
public abstract 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. |
See also:
startLogcat
public abstract 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.
stopEmulatorOutput
public abstract void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public abstract 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.
switchToAdbTcp
public abstract String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
החזרות | |
---|---|
String | the tcp serial number or null if device could not be switched |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
החזרות | |
---|---|
boolean | true if switch was successful, false otherwise. |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
syncFiles
public abstract 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 | if connection with device is lost and cannot be recovered. |
unlockDevice
public abstract 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 | if connection with device is lost and cannot be recovered. |
UnsupportedOperationException | if encryption is not supported on the device. |
waitForBootComplete
public abstract 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 |
זורק | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
waitForDeviceAvailable
public abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceAvailable
public abstract 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 | if device is still unresponsive after waitTime expires. |
waitForDeviceAvailableInRecoverPath
public abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)
Waits for the device to be responsive and available without considering recovery path.
פרמטרים | |
---|---|
waitTime | long |
החזרות | |
---|---|
boolean | True if device is available, False if unavailable. |
זורק | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
זורק | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceInRecovery
public abstract 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 abstract 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 abstract 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 abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceOnline
public abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceShell
public abstract 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. |