Device states in Tradefed

Android devices

Android devices in Tradefed can go through several states made available through the Device Manager. There are two main categories of statesfor Android devices: Allocation state and Online State.

All of these states can be checked in the Tradefed Console using l d or list devices.

tf >l d
Serial        State         Allocation   Product   Variant   Build    Battery
84TX0081B     ONLINE        Available    blueline  blueline  MASTER   100
HT6550300002  ONLINE        Available    sailfish  sailfish  MASTER   94
876X00GNG     UNAUTHORIZED  Unavailable  unknown   unknown   unknown  unknown
HT6570300047  UNAUTHORIZED  Unavailable  unknown   unknown   unknown  unknown

Allocation states

Allocation states are are Tradefed-specific states to monitor device use. They are described by DeviceAllocationState and can be any of:

  • UNKNOWN: An intermediate state used during transitions to decide if the device should be removed from the tracking list. This would happen when a device is disconnected from adb.
  • IGNORED: Device cannot be selected for the TF session because it was filtered out. Most likely TF was started with ANDROID_SERIAL exported, so it limits the scope of devices that can be picked.
  • AVAILABLE: Device is ready to be selected for a test.
  • UNAVAILABLE: Device is connected but not ready to run tests. It usually shows as offline in adb.
  • ALLOCATED: Device is currently running a test and cannot be selected.
  • CHECKING_AVAILABILITY: Device was just connected, and TF checks whether it is properly online and can be made available. If not, it will be made unavailable.

Online states

Oneline states represent the actual state of the device as seen by adb devices. They are described by TestDeviceState and can be:

  • FASTBOOT
  • ONLINE
  • RECOVERY
  • NOT_AVAILABLE

Tradefed online states are linked to the underlying adb library we use, ddmlib. It describes the states with DeviceState.