StubDevice

public class StubDevice
extends Object implements IDevice

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


IDevice 的存根占位符实现。

摘要

公共构造函数

StubDevice(String serial)
StubDevice(String serial, boolean isEmulator)

公共方法

boolean arePropertiesSet()

void createForward(int localPort, String remoteSocketName, IDevice.DeviceUnixSocketNamespace namespace)

void createForward(int localPort, int remotePort)

void createReverse(int remotePort, int localPort)

void executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputResponse, TimeUnit maxTimeUnits)

void executeShellCommand(String command, IShellOutputReceiver receiver)

void executeShellCommand(String command, IShellOutputReceiver receiver, int maxTimeToOutputResponse)

此方法已废弃。 请使用 executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit)

void executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits)

getAbis()

String getAvdName()

String getAvdPath()

getBattery(long freshnessTime, TimeUnit timeUnit)

getBattery()

Integer getBatteryLevel(long freshnessMs)

此方法已废弃。 请改用 getBattery(long, TimeUnit)

Integer getBatteryLevel()

此方法已废弃。 请改用 getBattery()

Client getClient(String applicationName)

String getClientName(int pid)

Client[] getClients()

int getDensity()

FileListingService getFileListingService()

String getLanguage()

String getMountPoint(String name)

String getName()

getProperties()

此方法已废弃。 请改用 getSystemProperty(String)

String getProperty(String name)

String getPropertyCacheOrSync(String name)

此方法已废弃。 请改用 getProperty(String)

int getPropertyCount()

此方法已废弃。 已在 ddmlib 中废弃,原因为“implementation details”。

String getPropertySync(String name)

此方法已废弃。 请改用 getProperty(String)

String getRegion()

RawImage getScreenshot()

RawImage getScreenshot(long timeout, TimeUnit unit)
String getSerialNumber()

IDevice.DeviceState getState()

SyncService getSyncService()

ListenableFuture<String> getSystemProperty(String name)

AndroidVersion getVersion()

boolean hasClients()

void installPackage(String packageFilePath, boolean reinstall, InstallReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, String... extraArgs)

void installPackage(String packageFilePath, boolean reinstall, InstallReceiver receiver, String... extraArgs)

void installPackage(String packageFilePath, boolean reinstall, String... extraArgs)

void installPackages( apkFilePaths, boolean reinstall, extraArgs, long timeOutInMs, TimeUnit timeunit)

void installRemotePackage(String remoteFilePath, boolean reinstall, InstallReceiver receiver, String... extraArgs)

void installRemotePackage(String remoteFilePath, boolean reinstall, String... extraArgs)

void installRemotePackage(String remoteFilePath, boolean reinstall, InstallReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, String... extraArgs)

boolean isBootLoader()

boolean isEmulator()

boolean isOffline()

boolean isOnline()

boolean isRoot()

void pullFile(String remote, String local)

void pushFile(String local, String remote)

void reboot(String into)

void removeForward(int localPort)

void removeForward(int localPort, int remotePort)

void removeForward(int localPort, String remoteSocketName, IDevice.DeviceUnixSocketNamespace namespace)

void removeRemotePackage(String remoteFilePath)

void removeReverse(int remotePort)

boolean root()

void runEventLogService(LogReceiver receiver)

void runLogService(String logname, LogReceiver receiver)

void setSerial(String serial)
void startScreenRecorder(String remoteFilePath, ScreenRecorderOptions options, IShellOutputReceiver receiver)

boolean supportsFeature(IDevice.HardwareFeature arg0)
boolean supportsFeature(IDevice.Feature feature)

String syncPackageToDevice(String localFilePath)

String uninstallApp(String applicationID, String... extraArgs)

String uninstallPackage(String packageName)

公共构造函数

StubDevice

public StubDevice (String serial)

参数
serial String

StubDevice

public StubDevice (String serial, 
                boolean isEmulator)

参数
serial String

isEmulator boolean

公共方法

arePropertiesSet

public boolean arePropertiesSet ()

返回
boolean

createForward

public void createForward (int localPort, 
                String remoteSocketName, 
                IDevice.DeviceUnixSocketNamespace namespace)

参数
localPort int

remoteSocketName String

namespace IDevice.DeviceUnixSocketNamespace

抛出
AdbCommandRejectedException
TimeoutException

createForward

public void createForward (int localPort, 
                int remotePort)

参数
localPort int

remotePort int

抛出
AdbCommandRejectedException
TimeoutException

createReverse

public void createReverse (int remotePort, 
                int localPort)

参数
remotePort int

localPort int

抛出
AdbCommandRejectedException
TimeoutException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeToOutputResponse, 
                TimeUnit maxTimeUnits)

参数
command String

receiver IShellOutputReceiver

maxTimeToOutputResponse long

maxTimeUnits TimeUnit

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver)

参数
command String

receiver IShellOutputReceiver

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                int maxTimeToOutputResponse)

此方法已废弃。
请使用 executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit)

参数
command String

receiver IShellOutputReceiver

maxTimeToOutputResponse int

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeout, 
                long maxTimeToOutputResponse, 
                TimeUnit maxTimeUnits)

参数
command String

receiver IShellOutputReceiver

maxTimeout long

maxTimeToOutputResponse long

maxTimeUnits TimeUnit

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

getAbis

public  getAbis ()

返回

getAvdName

public String getAvdName ()

返回
String

getAvdPath

public String getAvdPath ()

返回
String

getBattery

public  getBattery (long freshnessTime, 
                TimeUnit timeUnit)

参数
freshnessTime long

timeUnit TimeUnit

返回

getBattery

public  getBattery ()

返回

getBatteryLevel

public Integer getBatteryLevel (long freshnessMs)

此方法已废弃。
改用 getBattery(long, TimeUnit)

参数
freshnessMs long

返回
Integer

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

getBatteryLevel

public Integer getBatteryLevel ()

此方法已废弃。
改用 getBattery()

返回
Integer

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

getClient 类中的方法

public Client getClient (String applicationName)

参数
applicationName String

返回
Client

getClientName

public String getClientName (int pid)

参数
pid int

返回
String

getClients

public Client[] getClients ()

返回
Client[]

getDensity

public int getDensity ()

返回
int

getFileListingService

public FileListingService getFileListingService ()

返回
FileListingService

getLanguage

public String getLanguage ()

返回
String

getMountPoint

public String getMountPoint (String name)

参数
name String

返回
String

getName

public String getName ()

返回
String

getProperties

public  getProperties ()

此方法已废弃。
改用 getSystemProperty(String)

返回

getProperty

public String getProperty (String name)

参数
name String

返回
String

getPropertyCacheOrSync

public String getPropertyCacheOrSync (String name)

此方法已废弃。
改用 getProperty(String)

参数
name String

返回
String

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

getPropertyCount

public int getPropertyCount ()

此方法已废弃。
在 ddmlib 中已废弃,原因为“implementation details”。

返回
int

getPropertySync

public String getPropertySync (String name)

此方法已废弃。
改用 getProperty(String)

参数
name String

返回
String

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

getRegion

public String getRegion ()

返回
String

获取屏幕截图

public RawImage getScreenshot ()

返回
RawImage

抛出
AdbCommandRejectedException
TimeoutException

获取屏幕截图

public RawImage getScreenshot (long timeout, 
                TimeUnit unit)

参数
timeout long

unit TimeUnit

返回
RawImage

抛出
AdbCommandRejectedException
TimeoutException

getSerialNumber

public String getSerialNumber ()

返回
String

getState

public IDevice.DeviceState getState ()

返回
IDevice.DeviceState

getSyncService

public SyncService getSyncService ()

返回
SyncService

抛出
AdbCommandRejectedException
TimeoutException

getSystemProperty

public ListenableFuture<String> getSystemProperty (String name)

参数
name String

返回
ListenableFuture<String>

getVersion

public AndroidVersion getVersion ()

返回
AndroidVersion

hasClients

public boolean hasClients ()

返回
boolean

installPackage

public void installPackage (String packageFilePath, 
                boolean reinstall, 
                InstallReceiver receiver, 
                long maxTimeout, 
                long maxTimeToOutputResponse, 
                TimeUnit maxTimeUnits, 
                String... extraArgs)

参数
packageFilePath String

reinstall boolean

receiver InstallReceiver

maxTimeout long

maxTimeToOutputResponse long

maxTimeUnits TimeUnit

extraArgs String

抛出
InstallException

installPackage

public void installPackage (String packageFilePath, 
                boolean reinstall, 
                InstallReceiver receiver, 
                String... extraArgs)

参数
packageFilePath String

reinstall boolean

receiver InstallReceiver

extraArgs String

抛出
InstallException

installPackage

public void installPackage (String packageFilePath, 
                boolean reinstall, 
                String... extraArgs)

参数
packageFilePath String

reinstall boolean

extraArgs String

抛出
InstallException

installPackages

public void installPackages ( apkFilePaths, 
                boolean reinstall, 
                 extraArgs, 
                long timeOutInMs, 
                TimeUnit timeunit)

参数
apkFilePaths

reinstall boolean

extraArgs

timeOutInMs long

timeunit TimeUnit

抛出
InstallException

installRemotePackage

public void installRemotePackage (String remoteFilePath, 
                boolean reinstall, 
                InstallReceiver receiver, 
                String... extraArgs)

参数
remoteFilePath String

reinstall boolean

receiver InstallReceiver

extraArgs String

抛出
InstallException

installRemotePackage

public void installRemotePackage (String remoteFilePath, 
                boolean reinstall, 
                String... extraArgs)

参数
remoteFilePath String

reinstall boolean

extraArgs String

抛出
InstallException

installRemotePackage

public void installRemotePackage (String remoteFilePath, 
                boolean reinstall, 
                InstallReceiver receiver, 
                long maxTimeout, 
                long maxTimeToOutputResponse, 
                TimeUnit maxTimeUnits, 
                String... extraArgs)

参数
remoteFilePath String

reinstall boolean

receiver InstallReceiver

maxTimeout long

maxTimeToOutputResponse long

maxTimeUnits TimeUnit

extraArgs String

抛出
InstallException

isBootLoader

public boolean isBootLoader ()

返回
boolean

isEmulator

public boolean isEmulator ()

返回
boolean

处于离线状态

public boolean isOffline ()

返回
boolean

在线

public boolean isOnline ()

返回
boolean

isRoot

public boolean isRoot ()

返回
boolean

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

pullFile

public void pullFile (String remote, 
                String local)

参数
remote String

local String

抛出
AdbCommandRejectedException
SyncException
TimeoutException

pushFile

public void pushFile (String local, 
                String remote)

参数
local String

remote String

抛出
AdbCommandRejectedException
SyncException
TimeoutException

重新启动

public void reboot (String into)

参数
into String

抛出
AdbCommandRejectedException
TimeoutException

移除转发

public void removeForward (int localPort)

参数
localPort int

抛出
AdbCommandRejectedException
TimeoutException

移除转发

public void removeForward (int localPort, 
                int remotePort)

参数
localPort int

remotePort int

抛出
AdbCommandRejectedException
TimeoutException

移除转发

public void removeForward (int localPort, 
                String remoteSocketName, 
                IDevice.DeviceUnixSocketNamespace namespace)

参数
localPort int

remoteSocketName String

namespace IDevice.DeviceUnixSocketNamespace

抛出
AdbCommandRejectedException
TimeoutException

removeRemotePackage

public void removeRemotePackage (String remoteFilePath)

参数
remoteFilePath String

抛出
InstallException

removeReverse

public void removeReverse (int remotePort)

参数
remotePort int

抛出
AdbCommandRejectedException
TimeoutException

public boolean root ()

返回
boolean

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

runEventLogService

public void runEventLogService (LogReceiver receiver)

参数
receiver LogReceiver

抛出
AdbCommandRejectedException
TimeoutException

runLogService

public void runLogService (String logname, 
                LogReceiver receiver)

参数
logname String

receiver LogReceiver

抛出
AdbCommandRejectedException
TimeoutException

setSerial

public void setSerial (String serial)

参数
serial String

startScreenRecorder

public void startScreenRecorder (String remoteFilePath, 
                ScreenRecorderOptions options, 
                IShellOutputReceiver receiver)

参数
remoteFilePath String

options ScreenRecorderOptions

receiver IShellOutputReceiver

抛出
AdbCommandRejectedException
ShellCommandUnresponsiveException
TimeoutException

支持功能

public boolean supportsFeature (IDevice.HardwareFeature arg0)

参数
arg0 IDevice.HardwareFeature

返回
boolean

支持功能

public boolean supportsFeature (IDevice.Feature feature)

参数
feature IDevice.Feature

返回
boolean

syncPackageToDevice 事件

public String syncPackageToDevice (String localFilePath)

参数
localFilePath String

返回
String

抛出
AdbCommandRejectedException
SyncException
TimeoutException

卸载应用

public String uninstallApp (String applicationID, 
                String... extraArgs)

参数
applicationID String

extraArgs String

返回
String

抛出
InstallException

removePackage

public String uninstallPackage (String packageName)

参数
packageName String

返回
String

抛出
InstallException