Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
DeviceBatteryResourceMetricCollector
public
class
DeviceBatteryResourceMetricCollector
extends Object
implements
IResourceMetricCollector
java.lang.Object
|
↳ |
com.android.tradefed.monitoring.collector.DeviceBatteryResourceMetricCollector
|
This collector collects device battery metrics. It issues adb shell commands and parse the
response, the metrics include status, health, level, scale and temperature.
Summary
Constants
BATTERY_TEMP_DENOMINATOR
public static final float BATTERY_TEMP_DENOMINATOR
Constant Value:
10.0
Fields
BATTERY_CMD
public static final String BATTERY_CMD
BATTERY_PATTERN
public static final Pattern BATTERY_PATTERN
BATTERY_RESOURCE_NAME
public static final String BATTERY_RESOURCE_NAME
FIELD_GROUP
public static final String FIELD_GROUP
TEMPERATURE
public static final String TEMPERATURE
VALUE_GROUP
public static final String VALUE_GROUP
Public constructors
DeviceBatteryResourceMetricCollector
public DeviceBatteryResourceMetricCollector ()
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-03-08 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-03-08 UTC."],[],[],null,["# DeviceBatteryResourceMetricCollector\n====================================\n\n\n`\npublic\n\n\nclass\nDeviceBatteryResourceMetricCollector\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\nimplements\n\n`[IResourceMetricCollector](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/IResourceMetricCollector.html)`\n\n\n`\n\n|---|--------------------------------------------------------------------------------|\n| java.lang.Object ||\n| ↳ | com.android.tradefed.monitoring.collector.DeviceBatteryResourceMetricCollector |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThis collector collects device battery metrics. It issues adb shell commands and parse the\nresponse, the metrics include status, health, level, scale and temperature.\n\nSummary\n-------\n\n| ### Constants ||\n|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `float` | [BATTERY_TEMP_DENOMINATOR](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/DeviceBatteryResourceMetricCollector.html#BATTERY_TEMP_DENOMINATOR) |\n\n| ### Fields ||\n|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` public static final String` | [BATTERY_CMD](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/DeviceBatteryResourceMetricCollector.html#BATTERY_CMD) |\n| ` public static final Pattern` | [BATTERY_PATTERN](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/DeviceBatteryResourceMetricCollector.html#BATTERY_PATTERN) |\n| ` public static final String` | [BATTERY_RESOURCE_NAME](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/DeviceBatteryResourceMetricCollector.html#BATTERY_RESOURCE_NAME) |\n| ` public static final String` | [FIELD_GROUP](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/DeviceBatteryResourceMetricCollector.html#FIELD_GROUP) |\n| ` public static final String` | [TEMPERATURE](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/DeviceBatteryResourceMetricCollector.html#TEMPERATURE) |\n| ` public static final String` | [VALUE_GROUP](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/DeviceBatteryResourceMetricCollector.html#VALUE_GROUP) |\n\n| ### Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[DeviceBatteryResourceMetricCollector](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/DeviceBatteryResourceMetricCollector.html#DeviceBatteryResourceMetricCollector())`() ` |\n\n| ### Public methods ||\n|-----|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` ` | ` `[getDeviceResourceMetrics](../../../../../../../reference/tradefed/com/android/tradefed/monitoring/collector/DeviceBatteryResourceMetricCollector.html#getDeviceResourceMetrics(com.android.tradefed.command.remote.DeviceDescriptor,%20com.android.tradefed.device.IDeviceManager))`(`[DeviceDescriptor](../../../../../../../reference/tradefed/com/android/tradefed/command/remote/DeviceDescriptor.html)` descriptor, `[IDeviceManager](../../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceManager.html)` deviceManager) ` Gets device battery state. |\n\nConstants\n---------\n\n### BATTERY_TEMP_DENOMINATOR\n\n```\npublic static final float BATTERY_TEMP_DENOMINATOR\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nConstant Value:\n\n10.0\n\n\nFields\n------\n\n### BATTERY_CMD\n\n```\npublic static final String BATTERY_CMD\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### BATTERY_PATTERN\n\n```\npublic static final Pattern BATTERY_PATTERN\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### BATTERY_RESOURCE_NAME\n\n```\npublic static final String BATTERY_RESOURCE_NAME\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### FIELD_GROUP\n\n```\npublic static final String FIELD_GROUP\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### TEMPERATURE\n\n```\npublic static final String TEMPERATURE\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### VALUE_GROUP\n\n```\npublic static final String VALUE_GROUP\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic constructors\n-------------------\n\n### DeviceBatteryResourceMetricCollector\n\n```\npublic DeviceBatteryResourceMetricCollector ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### getDeviceResourceMetrics\n\n```\npublic getDeviceResourceMetrics (../../../../../../../reference/tradefed/com/android/tradefed/command/remote/DeviceDescriptor.html descriptor, \n ../../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceManager.html deviceManager)\n```\n\nGets device battery state.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `descriptor` | `DeviceDescriptor`: the [DeviceDescriptor](../../../../../../../reference/tradefed/com/android/tradefed/command/remote/DeviceDescriptor.html) about the metricizing device. \u003cbr /\u003e |\n| `deviceManager` | `IDeviceManager`: the [IDeviceManager](../../../../../../../reference/tradefed/com/android/tradefed/device/IDeviceManager.html) instance. \u003cbr /\u003e |\n\n| Returns ||\n|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | a [ERROR(/Collection)](../../../../../../../) of device [Resource](../../../../../../../reference/tradefed/com/google/dualhomelab/monitoringagent/resourcemonitoring/Resource.html). \u003cbr /\u003e |"]]