Battery stats: wake locks, radio active, cleanup.
- Improve wake lock work source updates to also update the current
history tag, in case the new work source gets recorded in the
history.
- Fix bug in recording radio active time that was not distributing
any time to apps.
- No longer hold a wake lock while dispatching data conn active call,
since it comes with its own timestamp.
- Fix issue where the top app was not being cleared while the screen
was off.
- Remove obsolete STATS_LAST stats type.
- Fix bug that was not clearing the total run time when resetting
the stats.
Change-Id: Iabe17a9edf34f762374ae09fcffb8a819cf72e30
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index 41ffdc1..168742f 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -1348,25 +1348,22 @@
try {
final boolean unimportant = pi == mTimeTickSender;
mWakeLock.setUnimportantForLogging(unimportant);
+ if (first || mLastWakeLockUnimportantForLogging) {
+ mWakeLock.setHistoryTag(pi.getTag(
+ type == ELAPSED_REALTIME_WAKEUP || type == RTC_WAKEUP
+ ? "*walarm*:" : "*alarm*:"));
+ } else {
+ mWakeLock.setHistoryTag(null);
+ }
+ mLastWakeLockUnimportantForLogging = unimportant;
if (ws != null) {
- if (first || mLastWakeLockUnimportantForLogging) {
- mWakeLock.setHistoryTag(pi.getTag(
- type == ELAPSED_REALTIME_WAKEUP || type == RTC_WAKEUP
- ? "*walarm*:" : "*alarm*:"));
- } else {
- mWakeLock.setHistoryTag(null);
- }
- mLastWakeLockUnimportantForLogging = unimportant;
mWakeLock.setWorkSource(ws);
return;
- } else {
- mLastWakeLockUnimportantForLogging = false;
}
final int uid = ActivityManagerNative.getDefault()
.getUidForIntentSender(pi.getTarget());
if (uid >= 0) {
- mWakeLock.setHistoryTag(null);
mWakeLock.setWorkSource(new WorkSource(uid));
return;
}