summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apex/jobscheduler/service/java/com/android/server/tare/InternalResourceService.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/apex/jobscheduler/service/java/com/android/server/tare/InternalResourceService.java b/apex/jobscheduler/service/java/com/android/server/tare/InternalResourceService.java
index 581a545f8401..17b87469f7be 100644
--- a/apex/jobscheduler/service/java/com/android/server/tare/InternalResourceService.java
+++ b/apex/jobscheduler/service/java/com/android/server/tare/InternalResourceService.java
@@ -701,6 +701,10 @@ public class InternalResourceService extends SystemService {
return;
}
final long totalDischargeMah = mAnalyst.getBatteryScreenOffDischargeMah();
+ if (totalDischargeMah == 0) {
+ Slog.i(TAG, "Total discharge was 0");
+ return;
+ }
final long batteryCapacityMah = mBatteryManagerInternal.getBatteryFullCharge() / 1000;
final long estimatedLifeHours = batteryCapacityMah * totalScreenOffDurationMs
/ totalDischargeMah / HOUR_IN_MILLIS;