BackgroundDeviceAction

public class BackgroundDeviceAction
extends Thread

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


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

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

方法如下:

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

摘要

常數

String BACKGROUND_DEVICE_ACTION

公用建構函式

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

建立 BackgroundDeviceAction

公用方法

void cancel()

取消指令。

boolean isCancelled()

如果取消指令。

void run()

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

受保護的方法

void waitForDeviceRecovery(String exceptionType)

如果裝置因任何原因離線,系統會從主機觸發復原程序,因此我們只需封鎖,直到裝置復原或因裝置無法使用而導致叫用失敗為止。

常數

BACKGROUND_DEVICE_ACTION

public static final String BACKGROUND_DEVICE_ACTION

常數值: "BackgroundDeviceAction"

公用建構函式

BackgroundDeviceAction

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

參數
command String

descriptor String

device ITestDevice

receiver IShellOutputReceiver

startDelay int

BackgroundDeviceAction

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

建立 BackgroundDeviceAction

參數
command String:要執行的指令

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

device ITestDevice:要在哪個裝置上執行指令

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

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

noRepetitiveLogging boolean:是否要禁止重複記錄

公用方法

取消

public void cancel ()

取消指令。

isCancelled

public boolean isCancelled ()

如果指令已取消。

傳回
boolean

得分

public void run ()

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

受保護的方法

waitForDeviceRecovery

protected void waitForDeviceRecovery (String exceptionType)

如果裝置因任何原因離線,系統會從主機觸發復原程序,因此我們只需封鎖,直到裝置復原或因裝置無法使用而導致叫用失敗為止。