summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Bookatz <bookatz@google.com> 2021-03-22 17:55:26 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-03-22 17:55:26 +0000
commited21f7f9e6ac3ada1bfc0d145fa1bab46f5802f5 (patch)
tree60482fef5a8dfac03af8ddb52d97d08cf4aecde3
parentc0a2fc8e91f3298c8e10e3a933b1dfcdb167bc72 (diff)
parent9601383b2590186ba6740b56c1fc87f3d23c7ebc (diff)
Merge "Fix error in MeasuredEnergySnapshot voltage" into sc-dev
-rw-r--r--services/core/java/com/android/server/am/MeasuredEnergySnapshot.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/am/MeasuredEnergySnapshot.java b/services/core/java/com/android/server/am/MeasuredEnergySnapshot.java
index 4c9ab63a100b..d789bbb04d7a 100644
--- a/services/core/java/com/android/server/am/MeasuredEnergySnapshot.java
+++ b/services/core/java/com/android/server/am/MeasuredEnergySnapshot.java
@@ -241,7 +241,7 @@ public class MeasuredEnergySnapshot {
/**
* For a consumer of type {@link EnergyConsumerType#OTHER}, updates
* {@link #mAttributionSnapshots} with freshly measured energies (per uid) and returns the
- * charge consumed (in microcouloumbs) between the previously stored values and the passed-in
+ * charge consumed (in microcoulombs) between the previously stored values and the passed-in
* values.
*
* @param consumerInfo a consumer of type {@link EnergyConsumerType#OTHER}.
@@ -341,11 +341,11 @@ public class MeasuredEnergySnapshot {
return numOrdinals;
}
- /** Calculate charge consumption (in microcouloumbs) from a given energy and voltage */
+ /** Calculate charge consumption (in microcoulombs) from a given energy and voltage */
private long calculateChargeConsumedUC(long deltaEnergyUJ, int avgVoltageMV) {
// To overflow, a 3.7V 10000mAh battery would need to completely drain 69244 times
- // since the last snapshot. Round up to the nearest whole long.
- return (deltaEnergyUJ * MILLIVOLTS_PER_VOLT + (avgVoltageMV + 1) / 2) / avgVoltageMV;
+ // since the last snapshot. Round off to the nearest whole long.
+ return (deltaEnergyUJ * MILLIVOLTS_PER_VOLT + (avgVoltageMV / 2)) / avgVoltageMV;
}
}