Merge "Save foreground_service and cached consumed power in battery usage slot datebase." into udc-qpr-dev am: 7e92664f52

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/24689853

Change-Id: I6aa86815837a7be5fc76273a121c4060a12f5b2f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/settings/fuelgauge/batteryusage/ConvertUtils.java b/src/com/android/settings/fuelgauge/batteryusage/ConvertUtils.java
index ec0d01a..a1987c9 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/ConvertUtils.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/ConvertUtils.java
@@ -473,6 +473,9 @@
                 .setConsumePower(batteryDiffEntry.mConsumePower)
                 .setForegroundUsageConsumePower(batteryDiffEntry.mForegroundUsageConsumePower)
                 .setBackgroundUsageConsumePower(batteryDiffEntry.mBackgroundUsageConsumePower)
+                .setForegroundServiceUsageConsumePower(
+                        batteryDiffEntry.mForegroundServiceUsageConsumePower)
+                .setCachedUsageConsumePower(batteryDiffEntry.mCachedUsageConsumePower)
                 .setForegroundUsageTime(batteryDiffEntry.mForegroundUsageTimeInMs)
                 .setBackgroundUsageTime(batteryDiffEntry.mBackgroundUsageTimeInMs)
                 .setScreenOnTime(batteryDiffEntry.mScreenOnTimeInMs);
@@ -525,9 +528,9 @@
                 batteryUsageDiff.getScreenOnTime(),
                 batteryUsageDiff.getConsumePower(),
                 batteryUsageDiff.getForegroundUsageConsumePower(),
-                /*foregroundServiceUsageConsumePower=*/ 0,
+                batteryUsageDiff.getForegroundServiceUsageConsumePower(),
                 batteryUsageDiff.getBackgroundUsageConsumePower(),
-                /*cachedUsageConsumePower=*/ 0);
+                batteryUsageDiff.getCachedUsageConsumePower());
     }
 
     static BatteryDiffData convertToBatteryDiffData(
diff --git a/src/com/android/settings/fuelgauge/protos/battery_usage_slot.proto b/src/com/android/settings/fuelgauge/protos/battery_usage_slot.proto
index e3b604b..5bc1a3e 100644
--- a/src/com/android/settings/fuelgauge/protos/battery_usage_slot.proto
+++ b/src/com/android/settings/fuelgauge/protos/battery_usage_slot.proto
@@ -26,7 +26,9 @@
   optional double consume_power = 9;
   optional double foreground_usage_consume_power = 10;
   optional double background_usage_consume_power = 11;
-  optional int64 foreground_usage_time = 12;
-  optional int64 background_usage_time = 13;
-  optional int64 screen_on_time = 14;
+  optional double foreground_service_usage_consume_power = 12;
+  optional double cached_usage_consume_power = 13;
+  optional int64 foreground_usage_time = 14;
+  optional int64 background_usage_time = 15;
+  optional int64 screen_on_time = 16;
 }