Make Settings and SysUI estimates use same data class
This moves everything over to using a shared data class
for Estimates in SettingsLib which will facilitate a cl
that will help ensure greater consistency across
surfaces where battery estimates are shown.
Test: Tests pass
Bug: 124030091
Change-Id: I0b7f1f3a806255ff4804a00e6d90a7846c484484
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 83dc39e..8581920 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -12666,6 +12666,45 @@
public static final String DYNAMIC_POWER_SAVINGS_ENABLED = "dynamic_power_savings_enabled";
/**
+ * A long value indicating how much longer the system battery is estimated to last in
+ * millis. See {@link #BATTERY_ESTIMATES_LAST_UPDATE_TIME} for the last time this value
+ * was updated.
+ *
+ * @hide
+ */
+ public static final String TIME_REMAINING_ESTIMATE_MILLIS =
+ "time_remaining_estimate_millis";
+
+ /**
+ * A boolean indicating whether {@link #TIME_REMAINING_ESTIMATE_MILLIS} is based customized
+ * to the devices usage or using global models. See
+ * {@link #BATTERY_ESTIMATES_LAST_UPDATE_TIME} for the last time this value was updated.
+ *
+ * @hide
+ */
+ public static final String TIME_REMAINING_ESTIMATE_BASED_ON_USAGE =
+ "time_remaining_estimate_based_on_usage";
+
+ /**
+ * A long value indicating how long the system battery takes to deplete from 100% to 0% on
+ * average based on historical drain rates. See {@link #BATTERY_ESTIMATES_LAST_UPDATE_TIME}
+ * for the last time this value was updated.
+ *
+ * @hide
+ */
+ public static final String AVERAGE_TIME_TO_DISCHARGE = "average_time_to_discharge";
+
+ /**
+ * A long indicating the epoch time in milliseconds when
+ * {@link #TIME_REMAINING_ESTIMATE_MILLIS}, {@link #TIME_REMAINING_ESTIMATE_BASED_ON_USAGE},
+ * and {@link #AVERAGE_TIME_TO_DISCHARGE} were last updated.
+ *
+ * @hide
+ */
+ public static final String BATTERY_ESTIMATES_LAST_UPDATE_TIME =
+ "battery_estimates_last_update_time";
+
+ /**
* The max value for {@link #LOW_POWER_MODE_TRIGGER_LEVEL}. If this setting is not set
* or the value is 0, the default max will be used.
*
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 0e94abc0..cf9a7fc 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -130,8 +130,10 @@
Settings.Global.AUTOFILL_MAX_PARTITIONS_SIZE,
Settings.Global.AUTOFILL_MAX_VISIBLE_DATASETS,
Settings.Global.AUTOMATIC_POWER_SAVE_MODE,
+ Settings.Global.AVERAGE_TIME_TO_DISCHARGE,
Settings.Global.BACKGROUND_ACTIVITY_STARTS_ENABLED,
Settings.Global.BATTERY_CHARGING_STATE_UPDATE_DELAY,
+ Settings.Global.BATTERY_ESTIMATES_LAST_UPDATE_TIME,
Settings.Global.BROADCAST_BG_CONSTANTS,
Settings.Global.BROADCAST_FG_CONSTANTS,
Settings.Global.BROADCAST_OFFLOAD_CONSTANTS,
@@ -462,6 +464,8 @@
Settings.Global.TEXT_CLASSIFIER_ACTION_MODEL_PARAMS,
Settings.Global.THEATER_MODE_ON,
Settings.Global.TIME_ONLY_MODE_CONSTANTS,
+ Settings.Global.TIME_REMAINING_ESTIMATE_MILLIS,
+ Settings.Global.TIME_REMAINING_ESTIMATE_BASED_ON_USAGE,
Settings.Global.TRANSITION_ANIMATION_SCALE,
Settings.Global.TRUSTED_SOUND,
Settings.Global.TZINFO_UPDATE_CONTENT_URL,