Effective in 2026, to align with our trunk stable development model and ensure platform stability for the ecosystem, we will publish source code to AOSP in Q2 and Q4. For building and contributing to AOSP, use android-latest-release. The android-latest-release manifest branch will always reference the most recent release pushed to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
TfMetricProtoUtil
public
class
TfMetricProtoUtil
extends Object
| java.lang.Object
|
| ↳ |
com.android.tradefed.util.proto.TfMetricProtoUtil
|
Utility class to help with the Map to Map transition.
Summary
Public methods |
static
Map<String, String>
|
compatibleConvert(Map<String, MetricMeasurement.Metric> map)
Conversion of Map to Map.
|
static
MetricMeasurement.Metric
|
createSingleValue(long value, String unit)
Create a Metric for a single long/int value, and optionally provide a unit.
|
static
MetricMeasurement.Metric
|
doubleArrayToMetric(List<Double> metric)
Convert a list of doubles to a Metric.
|
static
MetricMeasurement.Metric
|
doubleToMetric(Double metric)
Convert a simple Double metric to a Metric.
|
static
MetricMeasurement.Metric
|
numericArrayToMetric(List<Long> metric)
Convert a list of numeric (int64)to a Metric.
|
static
MetricMeasurement.Metric
|
numericToMetric(Long metric)
Convert a simple numeric metric to a Metric.
|
static
MetricMeasurement.Metric
|
stringArrayToMetric(List<String> metric)
Convert a list of strings to a Metric.
|
static
MetricMeasurement.Metric
|
stringToMetric(String metric)
Convert a simple String metric (old format) to a Metric (new format).
|
static
HashMap<String, MetricMeasurement.Metric>
|
upgradeConvert(Map<String, String> metrics)
Conversion from Map to HashMap.
|
static
HashMap<String, MetricMeasurement.Metric>
|
upgradeConvert(Map<String, String> metrics, boolean smartNumbers)
Conversion from Map to HashMap.
|
Public constructors
TfMetricProtoUtil
public TfMetricProtoUtil ()
Public methods
compatibleConvert
public static Map<String, String> compatibleConvert (Map<String, MetricMeasurement.Metric> map)
Conversion of Map to Map.
| Returns |
Map<String, String> |
|
createSingleValue
public static MetricMeasurement.Metric createSingleValue (long value,
String unit)
Create a Metric for a single long/int value, and optionally provide a unit.
| Parameters |
value |
long: The value that will be stored. |
unit |
String: the unit of the value, or null if no unit. |
| Returns |
MetricMeasurement.Metric |
a Metric populated with the informations. |
doubleArrayToMetric
public static MetricMeasurement.Metric doubleArrayToMetric (List<Double> metric)
Convert a list of doubles to a Metric.
| Parameters |
metric |
List: The list containing metric. |
| Returns |
MetricMeasurement.Metric |
The created Metric |
doubleToMetric
public static MetricMeasurement.Metric doubleToMetric (Double metric)
Convert a simple Double metric to a Metric.
| Parameters |
metric |
Double: The double containing a metric. |
| Returns |
MetricMeasurement.Metric |
The created Metric |
numericArrayToMetric
public static MetricMeasurement.Metric numericArrayToMetric (List<Long> metric)
Convert a list of numeric (int64)to a Metric.
| Parameters |
metric |
List: The list containing metric. |
| Returns |
MetricMeasurement.Metric |
The created Metric |
numericToMetric
public static MetricMeasurement.Metric numericToMetric (Long metric)
Convert a simple numeric metric to a Metric.
| Parameters |
metric |
Long: The double containing a metric. |
| Returns |
MetricMeasurement.Metric |
The created Metric |
stringArrayToMetric
public static MetricMeasurement.Metric stringArrayToMetric (List<String> metric)
Convert a list of strings to a Metric.
| Parameters |
metric |
List: The list containing metric. |
| Returns |
MetricMeasurement.Metric |
The created Metric |
stringToMetric
public static MetricMeasurement.Metric stringToMetric (String metric)
Convert a simple String metric (old format) to a Metric (new format).
| Parameters |
metric |
String: The string containing a metric. |
| Returns |
MetricMeasurement.Metric |
The created Metric |
upgradeConvert
public static HashMap<String, MetricMeasurement.Metric> upgradeConvert (Map<String, String> metrics)
Conversion from Map to HashMap. In order to go to the new
interface. Information might only be partially populated because of the old format
limitations.
| Returns |
HashMap<String, MetricMeasurement.Metric> |
|
upgradeConvert
public static HashMap<String, MetricMeasurement.Metric> upgradeConvert (Map<String, String> metrics,
boolean smartNumbers)
Conversion from Map to HashMap. In order to go to the new
interface. Information might only be partially populated because of the old format
limitations.
| Parameters |
metrics |
Map |
smartNumbers |
boolean: convert numbers to int metrics |
| Returns |
HashMap<String, MetricMeasurement.Metric> |
|
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 2026-06-22 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 2026-06-22 UTC."],[],[]]