Small fixes to battery stats.
Change-Id: Ibbf7c548a8e787a046de3659094cea64908e3deb
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index b73b78b..c82fef0 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -3631,7 +3631,9 @@
}
if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
Pid p = getPidStatsLocked(pid);
- p.mWakeStart = SystemClock.elapsedRealtime();
+ if (p.mWakeStart == 0) {
+ p.mWakeStart = SystemClock.elapsedRealtime();
+ }
}
}
@@ -3642,7 +3644,7 @@
}
if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
Pid p = mPids.get(pid);
- if (p != null) {
+ if (p != null && p.mWakeStart != 0) {
p.mWakeSum += SystemClock.elapsedRealtime() - p.mWakeStart;
p.mWakeStart = 0;
}