背景设备动作

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

公共构造函数

背景设备动作

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

创建一个BackgroundDeviceAction

参数
command String :要运行的命令

descriptor String :命令的描述。仅用于记录。

device ITestDevice :运行命令的设备

receiver IShellOutputReceiver : 收集命令输出的接收器

startDelay int : 设备上线后等待的延迟

公共方法

取消

public void cancel ()

取消命令。

取消

public boolean isCancelled ()

如果命令被取消。

退货
boolean

跑步

public void run ()

重复命令直到取消。

受保护的方法

等待设备恢复

protected void waitForDeviceRecovery (String exceptionType)

如果设备因任何原因掉线,恢复将从主设备触发,所以我们只需要阻塞直到设备恢复或设备不可用导致调用失败。