Google is committed to advancing racial equity for Black communities. See how.

WaitDeviceRecovery

public class WaitDeviceRecovery
extends Object implements IDeviceRecovery

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


A simple implementation of a IDeviceRecovery that waits for device to be online and respond to simple commands.

Summary

Constants

int BOOTLOADER_POLL_ATTEMPTS

The number of attempts to check if device is in bootloader.

long INITIAL_PAUSE_TIME

the time in ms to wait before beginning recovery attempts

Fields

protected long mBootloaderWaitTime

protected boolean mDisableUnresponsiveReboot

protected long mFastbootWaitTime

protected long mOnlineWaitTime

protected int mRequiredMinBattery

protected long mShellWaitTime

protected long mWaitTime

Public constructors

WaitDeviceRecovery()

Public methods

void recoverDevice(IDeviceStateMonitor monitor, boolean recoverUntilOnline)

void recoverDeviceBootloader(IDeviceStateMonitor monitor)

void recoverDeviceFastbootd(IDeviceStateMonitor monitor)

void recoverDeviceRecovery(IDeviceStateMonitor monitor)

void setFastbootPath(String fastbootPath)

Protected methods

void checkMinBatteryLevel(IDevice device)

Checks if device battery level meets min requirement

IRunUtil getRunUtil()

Get the RunUtil instance to use.

void handleDeviceNotAvailable(IDeviceStateMonitor monitor, boolean recoverTillOnline)

Handle situation where device is not available.

void handleDeviceUnresponsive(IDevice device, IDeviceStateMonitor monitor)

Handle situation where device is online but unresponsive.

Constants

BOOTLOADER_POLL_ATTEMPTS

public static final int BOOTLOADER_POLL_ATTEMPTS

The number of attempts to check if device is in bootloader.

Exposed for unit testing

Constant Value: 3 (0x00000003)

INITIAL_PAUSE_TIME

protected static final long INITIAL_PAUSE_TIME

the time in ms to wait before beginning recovery attempts

Constant Value: 5000 (0x0000000000001388)

Fields

mBootloaderWaitTime

protected long mBootloaderWaitTime

mDisableUnresponsiveReboot

protected boolean mDisableUnresponsiveReboot

mFastbootWaitTime

protected long mFastbootWaitTime

mOnlineWaitTime

protected long mOnlineWaitTime

mRequiredMinBattery

protected int mRequiredMinBattery

mShellWaitTime

protected long mShellWaitTime

mWaitTime

protected long mWaitTime

Public constructors

WaitDeviceRecovery

public WaitDeviceRecovery ()

Public methods

recoverDevice

public void recoverDevice (IDeviceStateMonitor monitor, 
                boolean recoverUntilOnline)

Parameters
monitor IDeviceStateMonitor

recoverUntilOnline boolean

Throws
DeviceNotAvailableException

recoverDeviceBootloader

public void recoverDeviceBootloader (IDeviceStateMonitor monitor)

Parameters
monitor IDeviceStateMonitor

Throws
DeviceNotAvailableException

recoverDeviceFastbootd

public void recoverDeviceFastbootd (IDeviceStateMonitor monitor)

Parameters
monitor IDeviceStateMonitor

Throws
DeviceNotAvailableException

recoverDeviceRecovery

public void recoverDeviceRecovery (IDeviceStateMonitor monitor)

Parameters
monitor IDeviceStateMonitor

Throws
DeviceNotAvailableException

setFastbootPath

public void setFastbootPath (String fastbootPath)

Parameters
fastbootPath String

Protected methods

checkMinBatteryLevel

protected void checkMinBatteryLevel (IDevice device)

Checks if device battery level meets min requirement

Throws
DeviceNotAvailableException if battery level cannot be read or lower than min

getRunUtil

protected IRunUtil getRunUtil ()

Get the RunUtil instance to use.

Exposed for unit testing.

Returns
IRunUtil

handleDeviceNotAvailable

protected void handleDeviceNotAvailable (IDeviceStateMonitor monitor, 
                boolean recoverTillOnline)

Handle situation where device is not available.

Parameters
monitor IDeviceStateMonitor: the IDeviceStateMonitor

recoverTillOnline boolean: if true this method should return if device is online, and not check for responsiveness

Throws
DeviceNotAvailableException

handleDeviceUnresponsive

protected void handleDeviceUnresponsive (IDevice device, 
                IDeviceStateMonitor monitor)

Handle situation where device is online but unresponsive.

Parameters
device IDevice

Throws
DeviceNotAvailableException