NativeDeviceStateMonitor
public
class
NativeDeviceStateMonitor
extends Object
implements
IDeviceStateMonitor
| java.lang.Object | |
| ↳ | com.android.tradefed.device.NativeDeviceStateMonitor |
Helper class for monitoring the state of a IDevice with no framework support.
Summary
Constants | |
|---|---|
long |
MAX_CHECK_POLL_TIME
|
int |
MAX_OP_TIME
the maximum operation time in ms for a 'poll for responsiveness' command |
Fields | |
|---|---|
protected
static
final
String |
PERM_DENIED_ERROR_PATTERN
|
Public constructors | |
|---|---|
NativeDeviceStateMonitor(IDeviceManager mgr, IDevice device, boolean fastbootEnabled)
|
|
Public methods | |
|---|---|
TestDeviceState
|
getDeviceState()
|
String
|
getFastbootSerialNumber()
|
String
|
getMountPoint(String mountName)
|
String
|
getSerialNumber()
|
boolean
|
isAdbTcp()
|
void
|
setDefaultAvailableTimeout(long timeoutMs)
Set the time in ms to wait for a device to be available in |
void
|
setDefaultOnlineTimeout(long timeoutMs)
Set the time in ms to wait for a device to be online in |
void
|
setFastbootSerialNumber(String serial)
Set the fastboot mode serial number. |
void
|
setIDevice(IDevice newDevice)
|
void
|
setState(TestDeviceState deviceState)
|
boolean
|
waitForBootComplete(long waitTime)
|
IDevice
|
waitForDeviceAvailable(long waitTime)
|
IDevice
|
waitForDeviceAvailable()
|
boolean
|
waitForDeviceBootloader(long time)
|
void
|
waitForDeviceBootloaderStateUpdate()
|
boolean
|
waitForDeviceFastbootd(String fastbootPath, long time)
|
IDevice
|
waitForDeviceInRecovery()
|
boolean
|
waitForDeviceInRecovery(long waitTime)
|
boolean
|
waitForDeviceInSideload(long waitTime)
|
boolean
|
waitForDeviceNotAvailable(long waitTime)
|
IDevice
|
waitForDeviceOnline()
|
IDevice
|
waitForDeviceOnline(long waitTime)
|
boolean
|
waitForDeviceShell(long waitTime)
|
Protected methods | |
|---|---|
CollectingOutputReceiver
|
createOutputReceiver()
Exposed for testing |
long
|
getCheckPollTime()
Exposed for testing |
long
|
getCurrentTime()
Exposed for testing |
IDevice
|
getIDevice()
|
boolean
|
postOnlineCheck(long waitTime)
Additional checks to be done on an Online device |
boolean
|
waitForStoreMount(long waitTime)
Waits for the device's external store to be mounted. |
Constants
MAX_CHECK_POLL_TIME
protected static final long MAX_CHECK_POLL_TIME
Constant Value: 30000 (0x0000000000007530)
MAX_OP_TIME
protected static final int MAX_OP_TIME
the maximum operation time in ms for a 'poll for responsiveness' command
Constant Value: 10000 (0x00002710)
Fields
PERM_DENIED_ERROR_PATTERN
protected static final String PERM_DENIED_ERROR_PATTERN
Public constructors
NativeDeviceStateMonitor
public NativeDeviceStateMonitor (IDeviceManager mgr, IDevice device, boolean fastbootEnabled)
| Parameters | |
|---|---|
mgr |
IDeviceManager |
device |
IDevice |
fastbootEnabled |
boolean |
Public methods
getDeviceState
public TestDeviceState getDeviceState ()
| Returns | |
|---|---|
TestDeviceState |
|
getFastbootSerialNumber
public String getFastbootSerialNumber ()
| Returns | |
|---|---|
String |
|
getMountPoint
public String getMountPoint (String mountName)
| Parameters | |
|---|---|
mountName |
String |
| Returns | |
|---|---|
String |
|
getSerialNumber
public String getSerialNumber ()
| Returns | |
|---|---|
String |
|
isAdbTcp
public boolean isAdbTcp ()
| Returns | |
|---|---|
boolean |
|
setDefaultAvailableTimeout
public void setDefaultAvailableTimeout (long timeoutMs)
Set the time in ms to wait for a device to be available in waitForDeviceAvailable().
| Parameters | |
|---|---|
timeoutMs |
long |
setDefaultOnlineTimeout
public void setDefaultOnlineTimeout (long timeoutMs)
Set the time in ms to wait for a device to be online in waitForDeviceOnline().
| Parameters | |
|---|---|
timeoutMs |
long |
setFastbootSerialNumber
public void setFastbootSerialNumber (String serial)
Set the fastboot mode serial number.
| Parameters | |
|---|---|
serial |
String |
setIDevice
public void setIDevice (IDevice newDevice)
| Parameters | |
|---|---|
newDevice |
IDevice |
setState
public void setState (TestDeviceState deviceState)
| Parameters | |
|---|---|
deviceState |
TestDeviceState |
waitForBootComplete
public boolean waitForBootComplete (long waitTime)
| Parameters | |
|---|---|
waitTime |
long |
| Returns | |
|---|---|
boolean |
|
waitForDeviceAvailable
public IDevice waitForDeviceAvailable (long waitTime)
| Parameters | |
|---|---|
waitTime |
long |
| Returns | |
|---|---|
IDevice |
|
waitForDeviceAvailable
public IDevice waitForDeviceAvailable ()
| Returns | |
|---|---|
IDevice |
|
waitForDeviceBootloader
public boolean waitForDeviceBootloader (long time)
| Parameters | |
|---|---|
time |
long |
| Returns | |
|---|---|
boolean |
|
waitForDeviceBootloaderStateUpdate
public void waitForDeviceBootloaderStateUpdate ()
waitForDeviceFastbootd
public boolean waitForDeviceFastbootd (String fastbootPath,
long time)
| Parameters | |
|---|---|
fastbootPath |
String |
time |
long |
| Returns | |
|---|---|
boolean |
|
waitForDeviceInRecovery
public IDevice waitForDeviceInRecovery ()
| Returns | |
|---|---|
IDevice |
|
waitForDeviceInRecovery
public boolean waitForDeviceInRecovery (long waitTime)
| Parameters | |
|---|---|
waitTime |
long |
| Returns | |
|---|---|
boolean |
|
waitForDeviceInSideload
public boolean waitForDeviceInSideload (long waitTime)
| Parameters | |
|---|---|
waitTime |
long |
| Returns | |
|---|---|
boolean |
|
waitForDeviceNotAvailable
public boolean waitForDeviceNotAvailable (long waitTime)
| Parameters | |
|---|---|
waitTime |
long |
| Returns | |
|---|---|
boolean |
|
waitForDeviceOnline
public IDevice waitForDeviceOnline ()
| Returns | |
|---|---|
IDevice |
|
waitForDeviceOnline
public IDevice waitForDeviceOnline (long waitTime)
| Parameters | |
|---|---|
waitTime |
long |
| Returns | |
|---|---|
IDevice |
|
waitForDeviceShell
public boolean waitForDeviceShell (long waitTime)
| Parameters | |
|---|---|
waitTime |
long |
| Returns | |
|---|---|
boolean |
|
Protected methods
createOutputReceiver
protected CollectingOutputReceiver createOutputReceiver ()
Exposed for testing
| Returns | |
|---|---|
CollectingOutputReceiver |
CollectingOutputReceiver
|
getCheckPollTime
protected long getCheckPollTime ()
Exposed for testing
| Returns | |
|---|---|
long |
|
getCurrentTime
protected long getCurrentTime ()
Exposed for testing
| Returns | |
|---|---|
long |
|
postOnlineCheck
protected boolean postOnlineCheck (long waitTime)
Additional checks to be done on an Online device
| Parameters | |
|---|---|
waitTime |
long: time in ms to wait before giving up |
| Returns | |
|---|---|
boolean |
true if checks are successful before waitTime expires.
false otherwise
|
waitForStoreMount
protected boolean waitForStoreMount (long waitTime)
Waits for the device's external store to be mounted.
| Parameters | |
|---|---|
waitTime |
long: time in ms to wait before giving up |
| Returns | |
|---|---|
boolean |
true if external store is mounted before waitTime expires.
false otherwise
|