本地設備

public interface INativeDevice

com.android.tradefed.device.INativeDevice


為 ddmlib IDevice提供可靠且等級稍高的 API。

重試設備指令可設定的次數,並為無回應的設備提供設備恢復介面。

概括

常數

int UNKNOWN_API_LEVEL

無法偵測API Level時的預設值

公共方法

abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

檢查目前是否支援給定最低支援等級的功能。

abstract void clearLogcat ()

刪除所有累積的 logcat 資料。

abstract void deleteFile (String deviceFilePath)

用於刪除裝置上的檔案或目錄的幫助程式方法。

abstract boolean deviceSoftRestarted ( ProcessInfo prevSystemServerProcess)

透過將目前 system_server 與先前的 system_server ProcessInfo進行比較來檢查裝置是否軟重啟的幫助程式方法。

abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)

用於檢查設備是否自 UTC 時間以來設備及其ERROR(/TimeUnit)軟重啟的方法。

abstract boolean disableAdbRoot ()

關閉 adb root。

abstract boolean doesFileExist (String deviceFilePath)

確定裝置上的檔案是否存在的幫助程序方法。

abstract boolean enableAdbRoot ()

打開 adb root。

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)

執行 adb shell 指令並以String形式傳回輸出的 Helper 方法。

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

執行 adb shell 指令,使用更多參數來控制指令行為。

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

執行 adb shell 指令,使用更多參數來控制指令行為。

abstract void executeShellCommand (String command, IShellOutputReceiver receiver)

執行給定的 adb shell 命令,如果命令失敗則重試多次。

abstract CommandResult executeShellV2Command (String command)

執行 adb shell 指令並將結果作為CommandResult傳回的幫助程式方法,其中正確填入了指令狀態輸出、stdout 和 stderr。

abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)

執行 adb shell 指令並將結果作為CommandResult傳回的幫助程式方法,其中正確填入了指令狀態輸出和 stderr。

abstract CommandResult executeShellV2Command (String command, File pipeAsInput)

執行 adb shell 指令並將結果作為CommandResult傳回的幫助程式方法,其中正確填入了指令狀態輸出、stdout 和 stderr。

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

執行 adb shell 指令,使用更多參數來控制指令行為。

abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)

執行 adb shell 指令,使用更多參數來控制指令行為。

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

執行 adb shell 指令,使用更多參數來控制指令行為。

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

執行 adb shell 指令,使用更多參數來控制指令行為。

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

Helper 方法收集帶有啟動時間和啟動原因的啟動歷史記錄圖。

abstract getBootHistorySince (long utcEpochTime, TimeUnit timeUnit)

幫助程序方法收集啟動歷史記錄圖,其中包含自設備紀元以來的給定時間和指定的時間單位以來的啟動時間和啟動原因。

abstract String getBootloaderVersion ()

取得該裝置的引導程式版本的便捷方法。

abstract String getBuildAlias ()

檢索設備目前正在運行的建置的別名。

abstract String getBuildFlavor ()

檢索設備的建構風格。

abstract String getBuildId ()

檢索設備目前正在運行的版本。

abstract String getBuildSigningKeys ()

傳回用於簽署裝置映像的金鑰類型

通常,Android 裝置可以使用測試金鑰(如 AOSP 中)或發布金鑰(由各個裝置製造商控制)進行簽名

abstract DeviceDescriptor getCachedDeviceDescriptor ()

如果裝置已分配,則傳回快取的DeviceDescriptor ,否則傳回目前的DeviceDescriptor

abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

如果裝置已分配,則傳回快取的DeviceDescriptor ,否則傳回目前的DeviceDescriptor

abstract String[] getChildren (String deviceFilePath)

使用IFileEntry的替代方案有時會因為權限問題而無法運作。

abstract AbstractConnection getConnection ()

傳回與裝置關聯的連線。

abstract String getDeviceClass ()

取得設備類別。

abstract long getDeviceDate ()

返回設備的日期(自紀元以來的毫秒數)。

abstract DeviceDescriptor getDeviceDescriptor ()

從設備資訊中返回DeviceDescriptor以獲取其訊息,而無需傳遞實際的設備物件。

abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

從設備資訊中返回DeviceDescriptor以獲取其訊息,而無需傳遞實際的設備物件。

abstract TestDeviceState getDeviceState ()

獲取設備的狀態。

abstract long getDeviceTimeOffset (Date date)

幫助取得設備與給定ERROR(/Date)之間的時差。

abstract InputStreamSource getEmulatorOutput ()

取得模擬器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 IDevice的參考。

abstract long getIntProperty (String name, long defaultValue)

從設備傳回給定屬性的整數值。

abstract long getLastExpectedRebootTimeMillis ()

System.currentTimeMillis()傳回的 EPOCH 以來 Tradefed API 上次觸發重新啟動的時間(以毫秒為單位)。

abstract int getLaunchApiLevel ()

取得設備首次啟動的 API 等級。

abstract InputStreamSource getLogcat ()

取得 logcat 資料的快照流。

abstract InputStreamSource getLogcat (int maxBytes)

取得捕獲的 logcat 資料的最後maxBytes的快照流。

abstract InputStreamSource getLogcatDump ()

取得設備目前 logcat 的轉儲。

abstract InputStreamSource getLogcatSince (long date)

取得從提供的日期開始擷取的 logcat 資料的快照流。

abstract String getMountPoint (String mountName)

傳回一個掛載點。

abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

傳回與指定掛載點路徑相對應的MountPointInfo ,如果路徑沒有掛載任何內容,或未以掛載點出現在 /proc/mounts 中,則傳回null

abstract getMountPointInfo ()

傳回裝置上 /proc/mounts 中資訊的已解析版本

abstract long getPartitionFreeSpace (String partition)

確定設備分區上的可用空間量的幫助程序方法。

abstract ProcessInfo getProcessByName (String processName)

Helper 方法執行「pidof」和「stat」指令,並傳回帶有給定進程的 PID 和進程啟動時間的ProcessInfo物件。

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 擦除或 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 ()

如果裝置是無頭的(無螢幕),則傳回 true,否則傳回 false。

abstract boolean isRuntimePermissionSupported ()

檢查設備平台是否支援運行時權限授予

abstract boolean isStateBootloaderOrFastbootd ()

如果裝置處於TestDeviceState#FASTBOOTTestDeviceState.FASTBOOTD狀態,則傳回 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 ()

此方法已被棄用。請改用postInvocationTearDown(Throwable)

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)

從裝置上擷取文件,將其儲存在本機臨時ERROR(/File)中,然後傳回該File

abstract File pullFile (String remoteFilePath)

從裝置上擷取文件,將其儲存在本機臨時ERROR(/File)中,然後傳回該File

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)

一種從裝置的外部儲存檢索檔案、將其儲存在本地臨時ERROR(/File)中並傳回對該File的參考的便捷方法。

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)

pushFile(File, String)的變體,可以選擇考慮評估內容提供者的需求。

abstract boolean pushFile (File localFile, String deviceFilePath)

將檔案推送到裝置。

abstract boolean pushString (String contents, String deviceFilePath)

將根據字串建立的檔案推送到設備

abstract void reboot ()

將設備重新啟動至 adb 模式。

abstract void reboot (String reason)

將設備重新啟動到 adb 模式,並給出在重新啟動後保留的reason

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

reboot()的替代方法,僅在裝置線上(即對 adb 可見)之前阻塞。

abstract void rebootUntilOnline (String reason)

reboot()的替代方法,僅在裝置線上(即對 adb 可見)之前阻塞。

abstract void rebootUserspace ()

僅重新啟動裝置的使用者空間部分。

abstract void rebootUserspaceUntilOnline ()

rebootUserspace() ()} 的替代方案,僅在裝置線上(即對 adb 可見)之前阻塞。

abstract void remountSystemReadOnly ()

將設備上的系統分區設定為唯讀。

abstract void remountSystemWritable ()

使設備上的系統分區可寫入。

abstract void remountVendorReadOnly ()

將設備上的供應商分區設定為唯讀。

abstract void remountVendorWritable ()

使設備上的供應商分區可寫入。

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

使用作為參數傳遞的一個或多個偵聽器來執行ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection))的便利方法。

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

運行儀器測試並提供設備恢復。

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

ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection))對於給定的使用者。

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

ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)相同,但為給定使用者執行測試。

abstract void setDate (Date date)

設定設備上的日期

注意:在裝置上設定日期需要root

abstract void setOptions ( TestDeviceOptions options)

設定設備的TestDeviceOptions

abstract boolean setProperty (String propKey, String propValue)

設定設備上給定的屬性值。

abstract void setRecovery ( IDeviceRecovery recovery)

設定用於此裝置的IDeviceRecovery

abstract void setRecoveryMode ( ITestDevice.RecoveryMode mode)

設定設備使用的目前恢復模式。

abstract void setUseFastbootErase (boolean useFastbootErase)

設定是否使用 fastboot 擦除或 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”狀態(請注意,這與IDeviceRecovery不同)。

abstract boolean waitForDeviceInSideload (long waitTime)

阻止設備處於“adb sideload”狀態

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 Level時的預設值

常量值:-1 (0xffffffff)

公共方法

檢查 ApiLevelAgainstNextRelease

public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

檢查目前是否支援給定最低支援等級的功能。此方法考慮了 API 等級提升之前尚未發布的功能。

參數
strictMinLevel int :支援該功能的嚴格的最小可能等級。

退貨
boolean如果支援該級別,則為 true。否則為假。

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

清除Logcat

public abstract void clearLogcat ()

刪除所有累積的 logcat 資料。

當您想要確保ITestDevice#getLogcat()僅傳回在某個點之後(例如刷新新裝置版本後等)產生的日誌資料時,這非常有用。

刪除文件

public abstract void deleteFile (String deviceFilePath)

用於刪除裝置上的檔案或目錄的幫助程式方法。

參數
deviceFilePath String :裝置上檔案的絕對路徑。

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

設備軟重啟

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

設備軟重啟以來

public abstract boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

用於檢查設備是否自 UTC 時間以來設備及其ERROR(/TimeUnit)軟重啟的方法。軟重啟是指在裝置硬重啟之外重新啟動的 system_server(例如:請求重新啟動)。可以透過getDeviceDate()方法來取得目前裝置的 utcEpochTime(以毫秒為單位)。

參數
utcEpochTime long :自紀元以來的設備時間(以秒為單位)。

timeUnit TimeUnit :給定 utcEpochTime 的時間單位TimeUnit

退貨
boolean如果裝置軟重啟則為true

投擲
RuntimeException如果設備有異常啟動原因
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

禁用AdbRoot

public abstract boolean disableAdbRoot ()

關閉 adb root。

停用 adb root 可能會導致裝置與 adb 斷開連線。此方法將阻塞,直到設備可用。

退貨
boolean如果成功則為true

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

文件是否存在

public abstract boolean doesFileExist (String deviceFilePath)

確定裝置上的檔案是否存在的幫助程序方法。

參數
deviceFilePath String : 要檢查的裝置上檔案的絕對路徑

退貨
boolean如果檔案存在true ,否則為false

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

啟用AdbRoot

public abstract boolean enableAdbRoot ()

打開 adb root。如果“enable-root”設定為“false”,則會記錄一則訊息並傳回而不啟用 root。

啟用 adb root 可能會導致裝置與 adb 斷開連線。此方法將阻塞,直到設備可用。

退貨
boolean如果成功則為true

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行Adb指令

public abstract String executeAdbCommand (long timeout, 
                String... commandArgs)

將 adb 命令作為具有指定逾時的系統命令執行的幫助程序方法。

應盡可能使用executeShellCommand(String) ,因為該方法提供更好的故障檢測和效能。

參數
timeout long :裝置被視為無回應之前的時間(以毫秒為單位),0L 表示無逾時

commandArgs String :要執行的 adb 指令和參數

退貨
String命令的標準輸出。如果指令執行失敗則為null

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行Adb指令

public abstract String executeAdbCommand (String... commandArgs)

將 adb 指令作為系統指令執行的輔助方法。

應盡可能使用executeShellCommand(String) ,因為該方法提供更好的故障檢測和效能。

參數
commandArgs String :要執行的 adb 指令和參數

退貨
String命令的標準輸出。如果指令執行失敗則為null

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行Adb指令

public abstract String executeAdbCommand (long timeout, 
                 envMap, 
                String... commandArgs)

將 adb 命令作為具有指定逾時的系統命令執行的幫助程序方法。

應盡可能使用executeShellCommand(String) ,因為該方法提供更好的故障檢測和效能。

參數
timeout long :裝置被視為無回應之前的時間(以毫秒為單位),0L 表示無逾時

envMap :為指令設定的環境

commandArgs String :要執行的 adb 指令和參數

退貨
String命令的標準輸出。如果指令執行失敗則為null

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行Fastboot命令

public abstract CommandResult executeFastbootCommand (long timeout, 
                String... commandArgs)

將 fastboot 指令作為系統指令執行的幫助程序方法。

預計在設備已處於快速啟動模式時使用。

參數
timeout long :在命令過期前的時間(以毫秒為單位)

commandArgs String :要執行的 fastboot 指令和參數

退貨
CommandResult包含指令輸出的 CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行Fastboot命令

public abstract CommandResult executeFastbootCommand (String... commandArgs)

將 fastboot 指令作為系統指令執行的幫助程序方法,預設逾時為 2 分鐘。

預計在設備已處於快速啟動模式時使用。

參數
commandArgs String :要執行的 fastboot 指令和參數

退貨
CommandResult包含指令輸出的 CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行LongFastboot命令

public abstract CommandResult executeLongFastbootCommand (String... commandArgs)

將長時間運行的 fastboot 命令作為系統命令執行的幫助程序方法。

executeFastbootCommand(String)相同,但使用更長的逾時。

參數
commandArgs String :要執行的 fastboot 指令和參數

退貨
CommandResult包含指令輸出的 CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行LongFastboot命令

public abstract CommandResult executeLongFastbootCommand ( envVarMap, 
                String... commandArgs)

幫助程序方法,將長時間運行的 fastboot 命令作為具有系統環境變數的系統命令執行。

executeFastbootCommand(String)相同,但使用更長的逾時。

參數
envVarMap :fastboot命令運行時使用的系統環境變數

commandArgs String :要執行的 fastboot 指令和參數

退貨
CommandResult包含指令輸出的 CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行Shell命令

public abstract String executeShellCommand (String command)

執行 adb shell 指令並以String形式傳回輸出的 Helper 方法。

參數
command String : 要執行的 adb shell 指令

退貨
String外殼輸出

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行Shell命令

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

執行 adb shell 指令,使用更多參數來控制指令行為。

參數
command String : 要執行的 adb shell 指令

receiver IShellOutputReceiver :將 shell 輸出導向的IShellOutputReceiver

maxTimeToOutputShellResponse long :允許指令不輸出任何回應的最長時間; timeUnit中指定的單位

timeUnit TimeUnit : maxTimeToOutputShellResponse的單位

retryAttempts int :如果因為異常而失敗,重試指令的最大次數。如果執行retryAttempts沒有成功,將會拋出 DeviceNotResponsiveException。

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行Shell命令

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

執行 adb shell 指令,使用更多參數來控制指令行為。

參數
command String : 要執行的 adb shell 指令

receiver IShellOutputReceiver :將 shell 輸出導向的IShellOutputReceiver

maxTimeoutForCommand long :指令完成的最大超時時間; timeUnit中指定的單位

maxTimeToOutputShellResponse long :允許指令不輸出任何回應的最長時間; timeUnit中指定的單位

timeUnit TimeUnit : maxTimeToOutputShellResponse的單位

retryAttempts int :如果因為異常而失敗,重試指令的最大次數。如果執行retryAttempts沒有成功,將會拋出 DeviceNotResponsiveException。

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行Shell命令

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 :將 shell 輸出導向的IShellOutputReceiver

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行ShellV2命令

public abstract CommandResult executeShellV2Command (String command)

執行 adb shell 指令並將結果作為CommandResult傳回的幫助程式方法,其中正確填入了指令狀態輸出、stdout 和 stderr。

參數
command String :應該執行的命令。

退貨
CommandResult結果在CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行ShellV2命令

public abstract CommandResult executeShellV2Command (String command, 
                OutputStream pipeToOutput)

執行 adb shell 指令並將結果作為CommandResult傳回的幫助程式方法,其中正確填入了指令狀態輸出和 stderr。 stdout 定向到指定的流。

參數
command String :應該執行的命令。

pipeToOutput OutputStream : ERROR(/OutputStream)其中 std 輸出將被重定向,或為 null。

退貨
CommandResult結果在CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行ShellV2命令

public abstract CommandResult executeShellV2Command (String command, 
                File pipeAsInput)

執行 adb shell 指令並將結果作為CommandResult傳回的幫助程式方法,其中正確填入了指令狀態輸出、stdout 和 stderr。

參數
command String :應該執行的命令。

pipeAsInput File :將作為命令的輸入透過管道傳輸ERROR(/File) ,或為空。

退貨
CommandResult結果在CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行ShellV2命令

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

執行 adb shell 指令,使用更多參數來控制指令行為。

參數
command String : 要執行的 adb shell 指令

maxTimeoutForCommand long :指令完成的最大超時時間; timeUnit中指定的單位

timeUnit TimeUnit : maxTimeToOutputShellResponse的單位

retryAttempts int :如果因為異常而失敗,重試指令的最大次數。如果執行retryAttempts沒有成功,將會拋出 DeviceNotResponsiveException。

退貨
CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行ShellV2命令

public abstract CommandResult executeShellV2Command (String command, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit)

執行 adb shell 指令,使用更多參數來控制指令行為。

參數
command String : 要執行的 adb shell 指令

maxTimeoutForCommand long :指令完成的最大超時時間; timeUnit中指定的單位

timeUnit TimeUnit : maxTimeToOutputShellResponse的單位

退貨
CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行ShellV2命令

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

執行 adb shell 指令,使用更多參數來控制指令行為。

參數
command String : 要執行的 adb shell 指令

pipeAsInput File :將作為命令的輸入透過管道傳輸ERROR(/File) ,或為空。

pipeToOutput OutputStream : ERROR(/OutputStream)其中 std 輸出將被重定向,或為 null。

maxTimeoutForCommand long :指令完成的最大超時時間; timeUnit中指定的單位

timeUnit TimeUnit : maxTimeToOutputShellResponse的單位

retryAttempts int :如果因為異常而失敗,重試指令的最大次數。如果執行retryAttempts沒有成功,將會拋出 DeviceNotResponsiveException。

退貨
CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

執行ShellV2命令

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

執行 adb shell 指令,使用更多參數來控制指令行為。

參數
command String : 要執行的 adb shell 指令

pipeAsInput File :將作為命令的輸入透過管道傳輸ERROR(/File) ,或為空。

pipeToOutput OutputStream : ERROR(/OutputStream)其中 std 輸出將被重定向,或為 null。

pipeToError OutputStream : ERROR(/OutputStream)其中 std 錯誤將被重定向,或為 null。

maxTimeoutForCommand long :指令完成的最大超時時間; timeUnit中指定的單位

timeUnit TimeUnit : maxTimeToOutputShellResponse的單位

retryAttempts int :如果因為異常而失敗,重試指令的最大次數。如果執行retryAttempts沒有成功,將會拋出 DeviceNotResponsiveException。

退貨
CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

fastboot擦除分割區

public abstract CommandResult fastbootWipePartition (String partition)

擦除設備分割區的輔助方法。

如果getUseFastbootErase()true ,則將使用 fastboot Erase 來擦除分區。然後,設備必須在下次啟動時建立檔案系統。否則,將使用 fastboot 格式,這將在裝置上建立新的檔案系統。

預計在設備已處於快速啟動模式時使用。

參數
partition String : 要清除的分區

退貨
CommandResult包含指令輸出的 CommandResult

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

取得API等級

public abstract int getApiLevel ()

取得設備 API 等級。預設為UNKNOWN_API_LEVEL

退貨
int指示設備 API 等級的整數

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

取得基頻版本

public abstract String getBasebandVersion ()

取得該設備的基頻(無線電)版本的便捷方法。取得無線電版本是特定於裝置的,因此它可能無法傳回所有裝置的正確資訊。此方法依賴 gsm.version.baseband 屬性來傳回正確的版本資訊。這對於某些 CDMA 裝置來說並不準確,且此處傳回的版本可能與 fastboot 報告的版本不匹配,並且可能不會傳回 CDMA 無線電的版本。 TL;DR 如果 gsm.version.baseband 屬性與fastboot getvar version-baseband傳回的版本相同,則此方法僅報告準確的版本。

退貨
String String基頻版本,如果無法確定則為null (裝置沒有無線電或無法讀取版本字串)

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

取得電池

public abstract Integer getBattery ()

返回設備的當前電池電量,如果電池電量不可用,則傳回 Null。

退貨
Integer

取得布爾屬性

public abstract boolean getBooleanProperty (String name, 
                boolean defaultValue)

傳回給定屬性的布林值。

參數
name String : 屬性名稱

defaultValue boolean :如果屬性為空或不存在,則傳回預設值。

退貨
boolean若屬性值為"1""y""yes""on""true" ,則為true ;如果屬性值為"0""n""no""off" ,則為false"false" ,否則為defaultValue

投擲
DeviceNotAvailableException

取得啟動歷史記錄

public abstract  getBootHistory ()

Helper 方法收集帶有啟動時間和啟動原因的啟動歷史記錄圖。

退貨
啟動時間圖(自紀元以來以秒為單位的 UTC 時間)和啟動原因

投擲
DeviceNotAvailableException

取得啟動歷史記錄

public abstract  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

幫助程序方法收集啟動歷史記錄圖,其中包含自設備紀元以來的給定時間和指定的時間單位以來的啟動時間和啟動原因。目前裝置的 utcEpochTime(以毫秒為單位)可以透過方法getDeviceDate()取得。

參數
utcEpochTime long :自 Epoch 以來的設備時間。

timeUnit TimeUnit :時間單位TimeUnit

退貨
啟動時間圖(自紀元以來以秒為單位的 UTC 時間)和啟動原因

投擲
DeviceNotAvailableException

取得Bootloader版本

public abstract String getBootloaderVersion ()

取得該裝置的引導程式版本的便捷方法。

將嘗試從裝置的目前狀態檢索引導程式版本。 (即如果設備處於快速啟動模式,它將嘗試從快速啟動檢索版本)

退貨
String String引導程式版本,如果找不到則為null

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

取得建置別名

public abstract String getBuildAlias ()

檢索設備目前正在運行的建置的別名。

建構別名通常是比建構 ID(通常是 Nexus 建構的數字)更可讀的字串。例如,最終的 Android 4.2 版本的建置別名為 JDQ39,建置 ID 為 573038

退貨
String建置別名或如果無法檢索則回退到建置 ID

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

獲取BuildFlavor

public abstract String getBuildFlavor ()

檢索設備的建構風格。

退貨
String建構風格,如果無法檢索則為 null

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

取得建置ID

public abstract String getBuildId ()

檢索設備目前正在運行的版本。

退貨
String建置 ID 或IBuildInfo#UNKNOWN_BUILD_ID (如果無法檢索)

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

取得建置簽署金鑰

public abstract String getBuildSigningKeys ()

傳回用於簽署裝置映像的金鑰類型

通常,Android 裝置可以使用測試金鑰(如 AOSP 中)或發布金鑰(由各個裝置製造商控制)進行簽名

退貨
String如果找到則為簽章金鑰,否則為 null。

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

取得快取設備描述符

public abstract DeviceDescriptor getCachedDeviceDescriptor ()

如果裝置已分配,則傳回快取的DeviceDescriptor ,否則傳回目前的DeviceDescriptor

退貨
DeviceDescriptor

取得快取設備描述符

public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

如果裝置已分配,則傳回快取的DeviceDescriptor ,否則傳回目前的DeviceDescriptor

參數
shortDescriptor boolean :是否將描述詞限制為最低限度的信息

退貨
DeviceDescriptor

獲取孩子

public abstract String[] getChildren (String deviceFilePath)

使用IFileEntry的替代方案有時會因為權限問題而無法運作。

參數
deviceFilePath String :是裝置上進行搜尋的路徑

退貨
String[]包含裝置上路徑中的所有檔案的字串陣列。

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

取得連接

public abstract AbstractConnection getConnection ()

傳回與裝置關聯的連線。

退貨
AbstractConnection

取得設備類

public abstract String getDeviceClass ()

取得設備類別。

退貨
String String設備類別。

取得設備日期

public abstract long getDeviceDate ()

返回設備的日期(自紀元以來的毫秒數)。

退貨
long設備的日期(紀元格式)。

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

取得設備描述符

public abstract DeviceDescriptor getDeviceDescriptor ()

從設備資訊中返回DeviceDescriptor以獲取其訊息,而無需傳遞實際的設備物件。

退貨
DeviceDescriptor

取得設備描述符

public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

從設備資訊中返回DeviceDescriptor以獲取其訊息,而無需傳遞實際的設備物件。

參數
shortDescriptor boolean :是否將描述詞限制為最低限度的信息

退貨
DeviceDescriptor

取得設備狀態

public abstract TestDeviceState getDeviceState ()

獲取設備的狀態。

退貨
TestDeviceState

取得設備時間偏移

public abstract long getDeviceTimeOffset (Date date)

幫助取得設備與給定ERROR(/Date)之間的時差。內部使用紀元時間。

參數
date Date

退貨
long以毫秒為單位的差異

投擲
DeviceNotAvailableException

取得模擬器輸出

public abstract InputStreamSource getEmulatorOutput ()

取得模擬器stdout和stderr的串流

退貨
InputStreamSource仿真器輸出

取得外部儲存空閒空間

public abstract long getExternalStoreFreeSpace ()

用於確定設備外部儲存上的可用空間量的幫助程序方法。

退貨
long可用空間量(以 KB 為單位)

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

取得FastbootProductType

public abstract String getFastbootProductType ()

當設備處於快速啟動模式時取得該設備的產品類型的便利方法。

僅當設備處於快速啟動狀態時才應使用此方法。在這種情況下,它比通用getProductType()方法更安全一些,因為如果設備處於不正確狀態或無響應,ITestDevice 會知道將設備恢復到快速啟動。

退貨
String String產品類型名稱,如果無法確定則為null

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

取得FastbootProductVariant

public abstract String getFastbootProductVariant ()

當設備處於快速啟動模式時取得該設備的產品類型的便利方法。

僅當設備處於快速啟動狀態時才應使用此方法。在這種情況下,它比通用getProductType()方法更安全一些,因為如果設備處於不正確狀態或無響應,ITestDevice 會知道將設備恢復到快速啟動。

退貨
String String產品類型名稱,如果無法確定則為null

投擲
DeviceNotAvailableException如果與設備的連線遺失且無法恢復。

取得Fastboot序號

public abstract String getFastbootSerialNumber ()

返回快速啟動模式序號。

退貨
String

取得Fastboot變數

public abstract String getFastbootVariable (String variableName)

從裝置檢索給定的 fastboot 變數值。

參數
variableName String :變數名

退貨
String屬性值,如果不存在則為null

投擲
不支援的操作異常
DeviceNotAvailableException

取得文件條目

public abstract IFileEntry getFileEntry (String path)

檢索設備上遠端文件的引用。

參數
path String :要檢索的檔案路徑。可以是絕對路徑或相對於“/”的路徑。 (即支援“/system”和“system”語法)

退貨
IFileEntry如果無法找到給定path的文件,則IFileEntrynull

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

取得設備

public abstract IDevice getIDevice ()

傳回關聯 ddmlib IDevice的參考。

每次裝置與 adb 斷開連線並重新連線時,DDMS 可能會指派新的IDevice 。因此,呼叫者不應保留對IDevice引用,因為該引用可能會變得過時。

退貨
IDevice IDevice

取得整數屬性

public abstract long getIntProperty (String name, 
                long defaultValue)

從設備傳回給定屬性的整數值。

參數
name String : 屬性名稱

defaultValue long :如果屬性為空或不存在,則傳回預設值。

退貨
long屬性值或defaultValue (如果屬性為空、不存在或沒有整數值)。

投擲
DeviceNotAvailableException

getLastExpectedRebootTimeMillis

public abstract long getLastExpectedRebootTimeMillis ()

System.currentTimeMillis()傳回的 EPOCH 以來 Tradefed API 上次觸發重新啟動的時間(以毫秒為單位)。

退貨
long

取得LaunchApiLevel

public abstract int getLaunchApiLevel ()

取得設備首次啟動的 API 等級。預設為UNKNOWN_API_LEVEL

退貨
int一個整數,表示設備首次啟動的 API 級別

投擲
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

取得Logcat

public abstract InputStreamSource getLogcat ()

取得 logcat 資料的快照流。

有兩種工作模式:

  • 如果logcat目前正在後台捕獲,將傳回最多TestDeviceOptions.getMaxLogcatDataSize()位元組的後台logcat捕獲的目前內容
  • 否則,如果裝置目前正在回應,將傳回 logcat 資料的靜態轉儲

    退貨
    InputStreamSource

  • 取得Logcat

    public abstract InputStreamSource getLogcat (int maxBytes)

    取得捕獲的 logcat 資料的最後maxBytes的快照流。

    當您想要捕獲所捕獲的 logcat 資料的頻繁快照而又不會因獲取整個getLogcat()快照而導致潛在的巨大磁碟空間損失時,該情況非常有用。

    參數
    maxBytes int :要傳回的最大資料量。應該是一個可以輕鬆放入記憶體的數量

    退貨
    InputStreamSource

    取得LogcatDump

    public abstract InputStreamSource getLogcatDump ()

    取得設備目前 logcat 的轉儲。與getLogcat()不同,此方法將始終傳回 logcat 的靜態轉儲。

    缺點是如果設備無法訪問,則不會返回任何內容。

    退貨
    InputStreamSource logcat 資料的InputStreamSource 。如果無法擷取 logcat 數據,則傳回空流。

    取得LogcatSince

    public abstract InputStreamSource getLogcatSince (long date)

    取得從提供的日期開始擷取的 logcat 資料的快照流。設備上的時間應使用getDeviceDate()

    參數
    date long :以毫秒為單位,以紀元格式表示從何時開始快照到現在。 (可以使用“日期+%s”取得)

    退貨
    InputStreamSource

    取得掛載點

    public abstract String getMountPoint (String mountName)

    傳回一個掛載點。

    如果IDevice中的快取資訊不可用,則直接查詢設備。

    TODO:將此行為移至IDevice#getMountPoint(String)

    參數
    mountName String : 掛載點的名稱

    退貨
    String掛載點或null

    也可以看看:

    取得掛載點資訊

    public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

    傳回與指定掛載點路徑相對應的MountPointInfo ,如果路徑沒有掛載任何內容,或未以掛載點出現在 /proc/mounts 中,則傳回null

    參數
    mountpoint String

    退貨
    ITestDevice.MountPointInfo MountPointInfoERROR(/List)包含「/proc/mounts」中的信息

    投擲
    DeviceNotAvailableException

    也可以看看:

    取得掛載點資訊

    public abstract  getMountPointInfo ()

    傳回裝置上 /proc/mounts 中資訊的已解析版本

    退貨
    MountPointInfoERROR(/List)其中包含“/proc/mounts”中的信息

    投擲
    DeviceNotAvailableException

    getPartitionFreespace

    public abstract long getPartitionFreeSpace (String partition)

    助手方法決定設備分區上的可用空間數量。

    參數
    partition String

    退貨
    long KB中的自由空間數量

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    getProcessbyName

    public abstract ProcessInfo getProcessByName (String processName)

    助手方法運行“ pidof”和“ stat”命令,並使用PID返回ProcessInfo對象,並在給定過程的開始時間和過程開始時間。

    參數
    processName String :proces name string。

    退貨
    ProcessInfo給定ProcessName的ProcessInfo

    投擲
    DeviceNotAvailableException

    getProcesspid

    public abstract String getProcessPid (String process)

    如果出現問題,將傳回服務的PID或無效。

    參數
    process String :proces name string。

    退貨
    String

    投擲
    DeviceNotAvailableException

    取得產品類型

    public abstract String getProductType ()

    取得此設備產品類型的便利方法。

    如果設備處於ADB或FastBoot模式,此方法將會起作用。

    退貨
    String String產品類型名稱。不會無效

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法恢復,或無法確定產品類型

    GetProductVariant

    public abstract String getProductVariant ()

    取得此設備產品變體的便利方法。

    如果設備處於ADB或FastBoot模式,此方法將會起作用。

    退貨
    String String產品變體名稱或null如果無法確定

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    取得屬性

    public abstract String getProperty (String name)

    從設備中檢索給定的屬性值。

    參數
    name String :屬性名稱

    退貨
    String屬性值或null (如果不存在)

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    GetRecoveryMode

    public abstract ITestDevice.RecoveryMode getRecoveryMode ()

    取得用於設備的目前恢復模式。

    退貨
    ITestDevice.RecoveryMode設備使用的目前恢復模式。

    getSerialnumber

    public abstract String getSerialNumber ()

    取得此設備序號的便利方法。

    退貨
    String String序號

    GetTombstones

    public abstract  getTombstones ()

    從裝置中取得並返回墓碑清單。需要根。

    方法是最好的效果,因此,如果由於任何原因將一個墓碑未能拉出,則它將缺少清單中的墓碑。只有DeviceNotAvailableException才能儘早終止此方法。

    退貨
    墓碑文件列表,如果沒有墓碑,則空。

    投擲
    DeviceNotAvailableException

    也可以看看:

    getTotalMemory

    public abstract long getTotalMemory ()

    在內部錯誤時傳回位元組中的總物理記憶體大小或-1

    退貨
    long

    GetUseStfastbooterase

    public abstract boolean getUseFastbootErase ()

    取得是使用FastBoot Erase還是FastBoot格式來擦除裝置上的分割區。

    退貨
    boolean如果使用FastBoot擦除,則如果使用FastBoot格式, false true

    也可以看看:

    Isadbroot

    public abstract boolean isAdbRoot ()

    退貨
    boolean如果裝置目前具有ADB root, true ,則為false

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    ISADBTCP

    public abstract boolean isAdbTcp ()

    退貨
    boolean如果裝置連接到ADB-over-TCP, true ,否則為false

    Isappenumerations pupport

    public abstract boolean isAppEnumerationSupported ()

    檢查裝置上的平台是否支援應用程式枚舉

    退貨
    boolean如果支援應用程式枚舉,則為false,否則

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    ISBYPASSLOWTARGETSDKBLOCKSUPTORPORTED

    public abstract boolean isBypassLowTargetSdkBlockSupported ()

    檢查裝置上的平台是否支援繞過應用程式安裝上的低目標SDK區塊

    退貨
    boolean如果支援旁路低目標SDK區塊,則為false,否則為否則

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    ISDEVICEENCHECTPTED

    public abstract boolean isDeviceEncrypted ()

    如果裝置加密,則傳回。

    退貨
    boolean如果對裝置進行了加密,則為true

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    ISDIRECTORY

    public abstract boolean isDirectory (String deviceFilePath)

    如果裝置上的路徑是目錄,則傳回true,否則為false。

    參數
    deviceFilePath String

    退貨
    boolean

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    Isencryptionsupport

    public abstract boolean isEncryptionSupported ()

    如果在裝置上支援加密,則傳回。

    退貨
    boolean如果裝置支援加密,則為true

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    可以確定

    public abstract boolean isExecutable (String fullPath)

    如果裝置上的檔案路徑是可執行文件,則傳回true,否則為false。

    參數
    fullPath String

    退貨
    boolean

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    是無頭的

    public abstract boolean isHeadless ()

    如果裝置無頭(沒有螢幕),則傳回true,否則為false。

    退貨
    boolean

    投擲
    DeviceNotAvailableException

    IsruntimePermissionsupport

    public abstract boolean isRuntimePermissionSupported ()

    檢查設備上的平台是否支援運行時許可授予

    退貨
    boolean是的,如果支援運行時權限,否則為false。

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isstatebootloaderorfastbootd

    public abstract boolean isStateBootloaderOrFastbootd ()

    如果裝置位於TestDeviceState#FASTBOOTTestDeviceState.FASTBOOTD中,則傳回true。

    退貨
    boolean

    Loganrs

    public abstract boolean logAnrs (ITestLogger logger)

    從設備收集並記錄ANRS。

    參數
    logger ITestLoggerITestLogger記錄ANRS。

    退貨
    boolean如果記錄成功,則是真的,否則為錯誤。

    投擲
    DeviceNotAvailableException

    logondevice

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

    在裝置的對數貓中記錄一則訊息。這是一個安全的電話,即使登入失敗也不會投擲。

    參數
    tag String :我們在logcat中記錄訊息的標籤。

    level Log.LogLevel :logcat中訊息的偵錯等級。

    format String :訊息格式。

    args Object :透過string.format()替換的args。

    非BlockingReboot

    public abstract void nonBlockingReboot ()

    發出重新啟動設備並在命令上返回的命令以及ADB不再可見設備時。

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    後啟動

    public abstract void postBootSetup ()

    執行指令以配置每個引導後測試設備。

    設備完全啟動/可用後應調用

    在正常情況下,此方法無需明確調用,因為執行重新啟動時的實作應自動執行這些步驟。

    可能需要呼叫的地方是當裝置重新啟動其他事件時(例如,何時快速啟動更新命令完成)

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    後投資測試

    public void postInvocationTearDown ()

    此方法已被棄用。
    改用後postInvocationTearDown(Throwable)

    設備特定所需的額外步驟清理將在呼叫後將執行。

    後投資測試

    public abstract void postInvocationTearDown (Throwable invocationException)

    設備特定所需的額外步驟清理將在呼叫後將執行。

    參數
    invocationException Throwable :如果有的話,最終例外是由呼叫失敗提出的。

    啟動前

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

    在呼叫流之前將在設備上執行的設備特定所需設定的額外步驟。

    參數
    info IBuildInfo :設備的IBuildInfo

    attributes MultiMap :儲存在呼叫上下文中的屬性

    投擲
    com.android.tradefed.targetprep.TargetSetupError
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException
    TargetSetupError

    plldir

    public abstract boolean pullDir (String deviceFilePath, 
                    File localDir)

    從設備中遞歸從設備中提取目錄內容。

    參數
    deviceFilePath String :遠端來源的絕對檔案路徑

    localDir File :將檔案拉入的本機目錄

    退貨
    boolean如果成功拉出文件,則為true 。否則為false

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    拉文件

    public abstract File pullFile (String remoteFilePath, 
                    int userId)

    檢索離設備的文件,將其儲存在本地臨時ERROR(/File)中,然後返回該File

    參數
    remoteFilePath String :裝置上檔案的絕對路徑。

    userId int :要從

    退貨
    File一個包含裝置檔案內容的ERROR(/File) ,如果因任何原因副本失敗(包括主機檔案系統的問題),則null

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    拉文件

    public abstract File pullFile (String remoteFilePath)

    檢索離設備的文件,將其儲存在本地臨時ERROR(/File)中,然後返回該File

    參數
    remoteFilePath String :裝置上檔案的絕對路徑。

    退貨
    File一個包含裝置檔案內容的ERROR(/File) ,如果因任何原因副本失敗(包括主機檔案系統的問題),則null

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    拉文件

    public abstract boolean pullFile (String remoteFilePath, 
                    File localFile)

    檢索文件設備的文件。

    參數
    remoteFilePath String :裝置上檔案的絕對路徑。

    localFile File :要將內容儲存在中的本機檔案。如果非空,將更換內容。

    退貨
    boolean如果成功檢索文件,則為true 。否則為false

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    拉文件

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

    檢索文件設備的文件。

    參數
    remoteFilePath String :裝置上檔案的絕對路徑。

    localFile File :要將內容儲存在中的本機檔案。如果非空,將更換內容。

    userId int :要從

    退貨
    boolean如果成功檢索文件,則為true 。否則為false

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    Pullfilectents

    public abstract String pullFileContents (String remoteFilePath)

    檢索從裝置上的文件,然後返回內容。

    參數
    remoteFilePath String :裝置上檔案的絕對路徑。

    退貨
    String一個包含裝置檔案內容的String ,如果出於任何原因副本失敗(包括主機檔案系統的問題),則null

    投擲
    DeviceNotAvailableException

    pullfilefromexternal

    public abstract File pullFileFromExternal (String remoteFilePath)

    一種便利方法,可以從設備的外部儲存中檢索文件,將其儲存在本地臨時ERROR(/File)中,然後返回對該File的引用。

    參數
    remoteFilePath String :相對於裝置的外部儲存安裝點,在裝置上檔案的路徑

    退貨
    File一個包含裝置檔案內容的ERROR(/File) ,如果因任何原因副本失敗(包括主機檔案系統的問題),則null

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    pushdir

    public abstract boolean pushDir (File localDir, 
                    String deviceFilePath, 
                     excludedDirectories)

    遞歸將目錄的目錄推向設備,同時排除了一些已過濾的目錄。

    參數
    localDir File :要推的本機目錄

    deviceFilePath String :遠端目標的絕對檔案路徑

    excludedDirectories :一組不應推動的目錄名稱。

    退貨
    boolean如果成功推動文件,則為true 。否則為false

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    pushdir

    public abstract boolean pushDir (File localDir, 
                    String deviceFilePath)

    遞歸將目錄內容的內容推向裝置。

    參數
    localDir File :要推的本機目錄

    deviceFilePath String :遠端目標的絕對檔案路徑

    退貨
    boolean如果成功推動文件,則為true 。否則為false

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    推播檔案

    public abstract boolean pushFile (File localFile, 
                    String deviceFilePath, 
                    boolean evaluateContentProviderNeeded)

    pushFile(File, String)的變體可以選擇考慮評估內容提供者的需求。

    參數
    localFile File :要推的本機文件

    deviceFilePath String :遠端目標絕對檔案路徑

    evaluateContentProviderNeeded boolean :是否要檢查我們是否需要內容提供者

    退貨
    boolean如果成功推動文件,則為true 。否則為false

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    推播檔案

    public abstract boolean pushFile (File localFile, 
                    String deviceFilePath)

    將文件推到設備。預設使用內容提供者。

    參數
    localFile File :要推的本機文件

    deviceFilePath String :遠端目標絕對檔案路徑

    退貨
    boolean如果成功推動文件,則為true 。否則為false

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    推串

    public abstract boolean pushString (String contents, 
                    String deviceFilePath)

    推動文件從字串到設備創建

    參數
    contents String :要推的文件的內容

    deviceFilePath String :遠端目標絕對檔案路徑

    退貨
    boolean如果成功推動字串,則為true 。否則為false

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    重啟

    public abstract void reboot ()

    將設備重新啟動到ADB模式。

    塊直到設備可用。

    投擲
    DeviceNotAvailableException如果重新啟動後無法使用設備

    重啟

    public abstract void reboot (String reason)

    重新啟動設備為ADB模式,並在重新啟動過程中持續存在reason

    塊直到設備可用。

    可以透過查詢sys.boot.reason propety來獲得最後一次重新啟動原因。

    參數
    reason String :重新啟動的原因,或如果未指定原因,則為null

    投擲
    DeviceNotAvailableException如果重新啟動後無法使用設備

    RebootIntobootloader

    public abstract void rebootIntoBootloader ()

    將裝置重新啟動到引導模式。

    區塊,直到裝置處於引導載入模式為止。

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    RebootintofastBootd

    public abstract void rebootIntoFastbootd ()

    將設備重新啟動到FastBootD模式。

    區塊直到裝置處於fastbootd模式為止。

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    重新引導

    public abstract void rebootIntoRecovery ()

    將設備重新啟動到ADB恢復模式。

    區塊直到設備進入恢復

    投擲
    DeviceNotAvailableException如果重新啟動後無法使用設備

    重新啟動sideLoad

    public abstract void rebootIntoSideload (boolean autoReboot)

    將設備重新啟動到ADB SIDELODOD模式(請注意,這是恢復的特殊模式)

    塊直到設備進入側載模式

    參數
    autoReboot boolean :是否在側load後自動重新啟動設備

    投擲
    DeviceNotAvailableException如果裝置在重新啟動後不在側load中

    重新啟動sideLoad

    public abstract void rebootIntoSideload ()

    將設備重新啟動到ADB SIDELODOD模式(請注意,這是恢復的特殊模式)

    塊直到設備進入側載模式

    投擲
    DeviceNotAvailableException如果裝置在重新啟動後不在側load中

    重新引導

    public abstract void rebootUntilOnline ()

    reboot()的替代方法,它僅阻止裝置在線,即ADB可見。

    投擲
    DeviceNotAvailableException如果重新啟動後無法使用設備

    重新引導

    public abstract void rebootUntilOnline (String reason)

    reboot()的替代方法,它僅阻止裝置在線,即ADB可見。

    參數
    reason String :重新啟動的原因,或如果未指定原因,則為null

    投擲
    DeviceNotAvailableException如果重新啟動後無法使用設備

    也可以看看:

    重新啟動空間

    public abstract void rebootUserspace ()

    僅重新啟動裝置的使用者空間部分。

    塊直到設備可用。

    警告。用戶空間重新啟動目前正在積極開發中,請自行使用它。

    投擲
    DeviceNotAvailableException如果重新啟動後無法使用設備

    Rebootusers -paceuntilline

    public abstract void rebootUserspaceUntilOnline ()

    rebootUserspace() ()}的替代方法,它只阻止裝置在線,即ADB可見。

    投擲
    DeviceNotAvailableException如果重新啟動後無法使用設備

    remountsystempookly

    public abstract void remountSystemReadOnly ()

    將系統分割區在設備上讀取。可以重新啟動設備。

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    remountsystemstible

    public abstract void remountSystemWritable ()

    使設備上的系統分區可寫入。可以重新啟動設備。

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    重新啟動

    public abstract void remountVendorReadOnly ()

    將供應商分區在設備上唯讀。可以重新啟動設備。

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    重新安置

    public abstract void remountVendorWritable ()

    在設備上進行供應商分區。可以重新啟動設備。

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    runinStrumentationTests

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

    執行ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection))一個或多個偵聽器作為參數傳遞。

    參數
    runner IRemoteAndroidTestRunner :運行測試的IRemoteAndroidTestRunner

    listeners ITestLifeCycleReceiver :測試結果偵聽器(S)

    退貨
    boolean如果已完成測試命令,則為true 。如果未能完成,則false ,但恢復成功了

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。 IE測試指令無法完成,恢復失敗。

    runinStrumentationTests

    public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                     listeners)

    運行儀表測試,並提供設備恢復。

    如果在測試運行完成之前遺失了與裝置的連接,並且恢復成功,則會傳回所有偵聽器的testrunfailed,並將傳回「 false」。測試命令不會重新運行。如有必要,它留給呼叫者重試。

    如果在測試運行完成之前丟失了與設備的連接,並且恢復失敗,則將拋出所有聽眾的測試和DevicenotavailableException。

    參數
    runner IRemoteAndroidTestRunner :運行測試的IRemoteAndroidTestRunner

    listeners :測試結果聽眾

    退貨
    boolean如果已完成測試命令,則為truefalse ,如果由於設備通訊異常而無法完成,但是恢復成功了

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。 IE測試指令無法完成,恢復失敗。

    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對於給定的使用者。

    參數
    runner IRemoteAndroidTestRunner

    userId int

    listeners

    退貨
    boolean

    投擲
    DeviceNotAvailableException

    runinStrumentationTestSasuser

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

    ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)相同,但為給定用戶運行了測試。

    參數
    runner IRemoteAndroidTestRunner

    userId int

    listeners ITestLifeCycleReceiver

    退貨
    boolean

    投擲
    DeviceNotAvailableException

    設定日期

    public abstract void setDate (Date date)

    設定設備上的日期

    注意:設備上的設定日期需要根

    參數
    date Date :指定特定日期;如果null將使用主機日期

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    設定選項

    public abstract void setOptions (TestDeviceOptions options)

    為設備設定TestDeviceOptions

    參數
    options TestDeviceOptions

    設定屬性

    public abstract boolean setProperty (String propKey, 
                    String propValue)

    在設備上設定給定的屬性值。需要ADB根是正確的。

    參數
    propKey String :要設定的鍵目標。

    propValue String :要設定的屬性值。

    退貨
    boolean如果SetProp指令成功,則傳回True ,否則為false。

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    setRecovery

    public abstract void setRecovery (IDeviceRecovery recovery)

    IDeviceRecovery設定為用於此設備。首先分配設備時應設定。

    參數
    recovery IDeviceRecoveryIDeviceRecovery

    setRecoverymode

    public abstract void setRecoveryMode (ITestDevice.RecoveryMode mode)

    設定目前恢復模式以用於設備。

    用於控制遇到設備通訊問題時所使用的復原方法。建議僅在需要時謹慎使用此方法(例如,框架下降等等,等等

    參數
    mode ITestDevice.RecoveryMode :是否應開啟「恢復直到線上」模式。

    SETUSEFASTBOOTERASE

    public abstract void setUseFastbootErase (boolean useFastbootErase)

    設定使用FastBoot Erase還是FastBoot格式來擦除裝置上的分割區。

    參數
    useFastbootErase boolean true :如果應該使用快速啟動格式,則應使用FastBoot Erase或false

    也可以看看:

    StartLogCat

    public abstract void startLogcat ()

    開始從裝置擷取LogCat輸出。

    如果已經捕獲了LogCat輸出,將無效。可以透過getlogcat檢索資料。

    當不再使用設備時,必須呼叫stopLogcat()

    startLogcat()stopLogcat()在TF調用上下文中通常不需要調用,因為TF框架將啟動和停止LogCat。

    stopemulatorOutput

    public abstract void stopEmulatorOutput ()

    關閉並刪除模擬器輸出。

    stoplogcat

    public abstract void stopLogcat ()

    停止從裝置擷取LogCat輸出,並丟棄目前儲存的LogCat資料。

    如果未捕獲LogCat輸出,將無效。

    switchtoAdbTCP

    public abstract String switchToAdbTcp ()

    將裝置切換為ADB-over-TCP模式。

    退貨
    String如果無法切換設備,則TCP序號或null

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    switchtoadbusb

    public abstract boolean switchToAdbUsb ()

    透過USB模式將設備切換到ADB。

    退貨
    boolean true ,如果開關成功,則否則為false

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    同步文件

    public abstract boolean syncFiles (File localFileDir, 
                    String deviceFilePath)

    逐步將本機檔案目錄的內容同步到裝置。

    透過將本機檔案的時間戳記與其遠端等效物進行比較來決定要推出的檔案。只有“較新”或不存在的文件將被推到設備上。因此,如果裝置上設定的檔案已經是最新的,則開銷應該相對較小。

    隱藏的檔案(以“。”開頭的名稱將被忽略。

    範例用法:SyncFiles(“/tmp/files”,“/sdcard”)如果不存在,將建立A/sdcard/files目錄,並遞歸地將/tmp/files的內容推向/sdcard/files。

    參數
    localFileDir File :包含檔案的本機檔案目錄。

    deviceFilePath String :遠端目標絕對檔案路徑root。 THOS檔案路徑中的所有目錄都必須可讀。 IE推到/data/local/tmp當ADB不是root時會失敗

    退貨
    boolean如果檔案成功同步, true 。否則為false

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    解鎖魔鬼

    public abstract boolean unlockDevice ()

    如果裝置處於加密狀態,則解鎖裝置。

    此方法可能會重新啟動框架,但不會呼叫postBootSetup() 。因此,當此方法返回時,該設備可能無法完全準備好進行測試。

    退貨
    boolean如果成功或裝置未加密, true

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。
    UnsupportedOperationException如果裝置上不支援加密。

    WaitforBootComplete

    public abstract boolean waitForBootComplete (long timeOut)

    塊,直到設定設備的啟動完成標誌為止。

    參數
    timeOut long :在巨大的時間內等待設置標誌

    退貨
    boolean如果裝置的引導完成標誌是在逾時設定的

    投擲
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    WaitfordEviceAdable

    public abstract boolean waitForDeviceAvailable ()

    等待該設備響應迅速並用於測試。使用預設超時。

    退貨
    boolean如果可以使用設備,則為false,如果恢復是停用且無法使用的,則為false。

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    WaitfordEviceAdable

    public abstract boolean waitForDeviceAvailable (long waitTime)

    等待該設備響應迅速並用於測試。

    參數
    waitTime long :MS等待的時間

    退貨
    boolean如果可以使用設備,則為false,如果恢復是停用且無法使用的,則為false。

    投擲
    DeviceNotAvailableException如果設備在Waittime到期後仍無反應。

    Waitfordeviceavailable intrecoverpath

    public abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)

    等待該設備響應迅速並且可以使用,而無需考慮恢復路徑。

    參數
    waitTime long

    退貨
    boolean如果有可用的話,則為fals,如果不可用。

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    Waitfordevicebootloader

    public abstract void waitForDeviceBootloader ()

    塊,直到透過快速啟動可見設備。使用預設超時。

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    Waitfordeviceinrecovery

    public abstract boolean waitForDeviceInRecovery (long waitTime)

    設備處於“ ADB恢復”狀態(請注意,這與IDeviceRecovery不同)。

    參數
    waitTime long :MS等待的時間

    退貨
    boolean如果設備在時間到期之前引導到恢復中, true 。否則為false

    Waitfordeviceinsideload

    public abstract boolean waitForDeviceInSideload (long waitTime)

    裝置處於「 ADB Sideload」狀態的區塊

    參數
    waitTime long :MS等待的時間

    退貨
    boolean如果裝置在時間到期前啟動到側load, true 。否則為false

    WaitfordeviceNotavailable

    public abstract boolean waitForDeviceNotAvailable (long waitTime)

    該設備不可用的區塊,即ADB缺少

    參數
    waitTime long :MS等待的時間

    退貨
    boolean如果設備在時間到期之前無法使用, true 。否則為false

    Waitfordeviceonline

    public abstract void waitForDeviceOnline ()

    塊直到透過ADB看到設備。使用預設超時

    注意該設備可能不一定會回應完成時的命令。代替使用waitForDeviceAvailable()

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    Waitfordeviceonline

    public abstract void waitForDeviceOnline (long waitTime)

    塊直到透過ADB看到設備。

    注意該設備可能不一定會回應完成時的命令。代替使用waitForDeviceAvailable()

    參數
    waitTime long :MS等待的時間

    投擲
    DeviceNotAvailableException如果與裝置的連線遺失且無法復原。

    Waitfordeviceshell

    public abstract boolean waitForDeviceShell (long waitTime)

    等待設備能夠回應基本的ADB Shell指令。

    參數
    waitTime long :MS等待的時間

    退貨
    boolean如果裝置在waitTime播放之前反應迅速, true