BackgroundDeviceAction

public class BackgroundDeviceAction
extends Object

java.lang.Object
   ↳ com.android.tradefed.device.BackgroundDeviceAction


在特定裝置上執行指令,並視需要重複執行,直到動作取消為止。

執行類別時,系統會在裝置上以個別執行緒執行指令,並在暫時主機檔案中收集輸出內容。

這麼做的原因如下:

  • 如果裝置在測試期間永久離線,系統會保留記錄資料。
  • 擷取的資料量可能超過裝置循環記錄的容量。

摘要

欄位

public static final String BACKGROUND_DEVICE_ACTION

公用建構函式

BackgroundDeviceAction(String command, String descriptor, ITestDevice device, IShellOutputReceiver receiver, int startDelay)

建立 BackgroundDeviceAction

公用方法

void cancel()

取消指令。

boolean isCancelled()

如果指令已取消。

void run()

重複執行指令,直到取消為止。

受保護的方法

void waitForDeviceRecovery(String exceptionType)

如果裝置因任何原因而離線,復原程序會從主機觸發,因此我們只需在復原完成或因裝置無法使用而導致叫用失敗前,將其封鎖即可。

欄位

BACKGROUND_DEVICE_ACTION

public static final String BACKGROUND_DEVICE_ACTION

公用建構函式

BackgroundDeviceAction

public BackgroundDeviceAction (String command, 
                String descriptor, 
                ITestDevice device, 
                IShellOutputReceiver receiver, 
                int startDelay)

建立 BackgroundDeviceAction

參數
command String:要執行的指令

descriptor String:指令的說明。僅供記錄。

device ITestDevice:要執行指令的裝置

receiver IShellOutputReceiver:用於收集指令輸出的接收器

startDelay int:裝置上線後的等待時間

公用方法

cancel

public void cancel ()

取消指令。

isCancelled

public boolean isCancelled ()

如果指令已取消。

傳回
boolean

得分

public void run ()

重複執行指令,直到取消為止。

受保護的方法

waitForDeviceRecovery

protected void waitForDeviceRecovery (String exceptionType)

如果裝置因任何原因而離線,復原程序會從主機觸發,因此我們只需在復原完成或裝置不可用而叫用失敗前,將其封鎖即可。