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

BatteryController

public class BatteryController
extends Object

java.lang.Object
   ↳ com.android.tradefed.device.battery.BatteryController


Utility class that allows to control the battery charging state of a device.

Summary

Public constructors

BatteryController()

Public methods

static IBatteryInfo getBatteryInfoForDevice(ITestDevice device)

Returns the IBatteryInfo of a device.

static IBatteryInfo.BatteryState getDeviceChargingState(ITestDevice device)

Returns the charging state of the device.

Public constructors

BatteryController

public BatteryController ()

Public methods

getBatteryInfoForDevice

public static IBatteryInfo getBatteryInfoForDevice (ITestDevice device)

Returns the IBatteryInfo of a device. Returns null if something goes wrong or if the device is not supported.

Parameters
device ITestDevice

Returns
IBatteryInfo

getDeviceChargingState

public static IBatteryInfo.BatteryState getDeviceChargingState (ITestDevice device)

Returns the charging state of the device. If device is not support it will return IBatteryInfo.BatteryState#UNDEFINED.

Parameters
device ITestDevice

Returns
IBatteryInfo.BatteryState

Throws
DeviceNotAvailableException