summaryrefslogtreecommitdiff
path: root/core/java/android/os/BatteryUsageStatsQuery.java
diff options
context:
space:
mode:
authorDmitri Plotnikov <dplotnikov@google.com>2021-03-31 17:56:13 -0700
committerDmitri Plotnikov <dplotnikov@google.com>2021-03-31 18:14:08 -0700
commitc13f44e0aaa777b9652ceb0c7e75ab20a768687f (patch)
treec29513785995be7a1433e0860748329eeab73424 /core/java/android/os/BatteryUsageStatsQuery.java
parent68037c9a26803fe33c5461af5795ecdeb305390b (diff)
Add BatteryConsumer.getPowerModel() method
This method will be used for testing and visualization purposes. Bug: 184207674 Test: atest FrameworksCoreTests:com.android.internal.os.BatteryStatsTests Change-Id: Id28ba4cbb8f27774f36248678f93ec187bc022b3
Diffstat (limited to 'core/java/android/os/BatteryUsageStatsQuery.java')
-rw-r--r--core/java/android/os/BatteryUsageStatsQuery.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/os/BatteryUsageStatsQuery.java b/core/java/android/os/BatteryUsageStatsQuery.java
index 85861bc1d2aa..50804422e92f 100644
--- a/core/java/android/os/BatteryUsageStatsQuery.java
+++ b/core/java/android/os/BatteryUsageStatsQuery.java
@@ -60,6 +60,12 @@ public final class BatteryUsageStatsQuery implements Parcelable {
*/
public static final int FLAG_BATTERY_USAGE_STATS_INCLUDE_HISTORY = 2;
+ /**
+ * Indicates that identifiers of power models used for computations of power
+ * consumption should be included in the BatteryUsageStats.
+ */
+ public static final int FLAG_BATTERY_USAGE_STATS_INCLUDE_POWER_MODELS = 4;
+
private static final long DEFAULT_MAX_STATS_AGE_MS = 5 * 60 * 1000;
private final int mFlags;
@@ -187,6 +193,17 @@ public final class BatteryUsageStatsQuery implements Parcelable {
}
/**
+ * Requests to return identifiers of models that were used for estimation
+ * of power consumption.
+ *
+ * Should only be used for testing and debugging.
+ */
+ public Builder includePowerModels() {
+ mFlags |= BatteryUsageStatsQuery.FLAG_BATTERY_USAGE_STATS_INCLUDE_POWER_MODELS;
+ return this;
+ }
+
+ /**
* Set the client's tolerance for stale battery stats. The data may be up to
* this many milliseconds out-of-date.
*/