From 87522f50e18e54bf559cb4ad1a0389f0d964555c Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Mon, 24 Mar 2014 13:36:46 -0700 Subject: [PATCH] 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 --- .../core/java/com/android/server/NativeDaemonConnector.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/NativeDaemonConnector.java b/services/core/java/com/android/server/NativeDaemonConnector.java index 265b95704b..62eb6632eb 100644 --- a/services/core/java/com/android/server/NativeDaemonConnector.java +++ b/services/core/java/com/android/server/NativeDaemonConnector.java @@ -110,7 +110,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo } catch (Exception e) { loge("Error handling '" + event + "': " + e); } finally { - if (mCallbacks.onCheckHoldWakeLock(msg.what)) { + if (mCallbacks.onCheckHoldWakeLock(msg.what) && mWakeLock != null) { mWakeLock.release(); } } @@ -171,7 +171,8 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo rawEvent); if (event.isClassUnsolicited()) { // TODO: migrate to sending NativeDaemonEvent instances - if (mCallbacks.onCheckHoldWakeLock(event.getCode())) { + if (mCallbacks.onCheckHoldWakeLock(event.getCode()) + && mWakeLock != null) { mWakeLock.acquire(); releaseWl = true; }