From c13f44e0aaa777b9652ceb0c7e75ab20a768687f Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Wed, 31 Mar 2021 17:56:13 -0700 Subject: 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 --- core/java/android/os/BatteryUsageStatsQuery.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'core/java/android/os/BatteryUsageStatsQuery.java') 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; @@ -186,6 +192,17 @@ public final class BatteryUsageStatsQuery implements Parcelable { return this; } + /** + * 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. -- cgit v1.2.3