summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2015-06-30 12:54:41 -0700
committerAdam Lesinski <adamlesinski@google.com>2015-06-30 12:54:41 -0700
commit43f222f02fcfb675460a2bbe8e4e8ab3efc1ede1 (patch)
treee1e0af33899ab34f5b67b0d8201d84eb6120df9d /core/java
parentb035c6d9a6827510e6ee3f855827cf6e428adb22 (diff)
BatteryStats: Account for remaining OS wakelock time at the end of processing all apps
Bug:18724932 Change-Id: I01cfd18acb3332ad35fd0d48d9c50bc37e5ccd08
Diffstat (limited to 'core/java')
-rw-r--r--core/java/com/android/internal/os/BatteryStatsHelper.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/core/java/com/android/internal/os/BatteryStatsHelper.java b/core/java/com/android/internal/os/BatteryStatsHelper.java
index 6a85afbdb322..264b8c1458ff 100644
--- a/core/java/com/android/internal/os/BatteryStatsHelper.java
+++ b/core/java/com/android/internal/os/BatteryStatsHelper.java
@@ -480,6 +480,7 @@ public final class BatteryStatsHelper {
final boolean forAllUsers = (asUsers.get(UserHandle.USER_ALL) != null);
mStatsPeriod = mTypeBatteryRealtime;
+ BatterySipper osSipper = null;
final SparseArray<? extends Uid> uidStats = mStats.getUidStats();
final int NU = uidStats.size();
for (int iu = 0; iu < NU; iu++) {
@@ -526,15 +527,19 @@ public final class BatteryStatsHelper {
}
if (uid == 0) {
- // The device has probably been awake for longer than the screen on
- // time and application wake lock time would account for. Assign
- // this remainder to the OS, if possible.
- mWakelockPowerCalculator.calculateRemaining(app, mStats, mRawRealtime,
- mRawUptime, mStatsType);
- app.sumPower();
+ osSipper = app;
}
}
}
+
+ if (osSipper != null) {
+ // The device has probably been awake for longer than the screen on
+ // time and application wake lock time would account for. Assign
+ // this remainder to the OS, if possible.
+ mWakelockPowerCalculator.calculateRemaining(osSipper, mStats, mRawRealtime,
+ mRawUptime, mStatsType);
+ osSipper.sumPower();
+ }
}
private void addPhoneUsage() {