to top
public class

DeviceBatteryLevelChecker

extends Object
implements IDeviceTest IRemoteTest @OptionClass(alias = "battery-checker")
java.lang.Object
   ↳ com.android.tradefed.testtype.DeviceBatteryLevelChecker

Class Overview

An ITargetPreparer that checks for a minimum battery charge, and waits for the battery to reach a second charging threshold if the minimum charge isn't present.

Summary

Fields
private double mChargingPollTime This is decoupled from the log poll time below specifically to allow this invocation to be killed without having to wait for the full log period to lapse. @Option(name = "poll-time", description = "Time in minutes to wait between battery level polls. Decimal times accepted.")
private double mLoggingPollTime @Option(name = "batt-log-period", description = "Min time in minutes to wait between printing current battery level to log. Decimal times accepted.")
private Integer mMaxBattery We use max-battery here to coincide with a DeviceSelectionOptions option of the same name. @Option(name = "max-battery", description = "Charge level below which we force the device to sit and charge. Range: 0-100.")
private boolean mRebootChargeDevices @Option(name = "reboot-charging-devices", description = "Whether to reboot a device when we detect that it should be held for charging. This would hopefully kill any battery-draining processes and allow the device to charge at its fastest rate.")
private int mResumeLevel @Option(name = "resume-level", description = "Charge level at which we release the device to begin testing again. Range: 0-100.")
private boolean mStopRuntime @Option(name = "stop-runtime", description = "Whether to stop runtime.")
ITestDevice mTestDevice
Public Constructors
DeviceBatteryLevelChecker()
Public Methods
ITestDevice getDevice()
Get the device under test.
void run(ITestInvocationListener listener)
Runs the tests, and reports result to the listener.
void setDevice(ITestDevice device)
Inject the device under test.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.testtype.IDeviceTest
From interface com.android.tradefed.testtype.IRemoteTest

Fields

private double mChargingPollTime

This is decoupled from the log poll time below specifically to allow this invocation to be killed without having to wait for the full log period to lapse.

private double mLoggingPollTime

private Integer mMaxBattery

We use max-battery here to coincide with a DeviceSelectionOptions option of the same name. Thus, DeviceBatteryLevelChecker

private boolean mRebootChargeDevices

private int mResumeLevel

private boolean mStopRuntime

ITestDevice mTestDevice

Public Constructors

public DeviceBatteryLevelChecker ()

Public Methods

public ITestDevice getDevice ()

Get the device under test.

Returns
ITestDevice the ITestDevice

public void run (ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

Parameters
listener ITestInvocationListener: the ITestInvocationListener of test results
Throws
DeviceNotAvailableException

public void setDevice (ITestDevice device)

Inject the device under test.

Parameters
device ITestDevice: the ITestDevice to use