summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrashant Malani <pmalani@google.com>2015-06-10 17:43:49 -0700
committerPrashant Malani <pmalani@google.com>2015-06-24 23:41:57 +0000
commit753e9e0f2d0c6c15eeb3e4905d67bfb4f12e0f87 (patch)
treed00452b36f58171061b09820171a0b20916dddae
parent65dca454c7a717b001b51d0089e7565ba428ce87 (diff)
downloadframeworks_base-753e9e0f2d0c6c15eeb3e4905d67bfb4f12e0f87.zip
frameworks_base-753e9e0f2d0c6c15eeb3e4905d67bfb4f12e0f87.tar.gz
frameworks_base-753e9e0f2d0c6c15eeb3e4905d67bfb4f12e0f87.tar.bz2
Revert "Always re-establish kernel alarms when considering new alarm set"
This reverts commit c83d3e4b72f8f25bbac39a577f125f0ca04354da. While the above patch does help deal with the issue of "lost" kernel alarms, experiments found it to also cause the unnecessary duplicate setting of non-lost alarms in other devices. This leads to a situation where the CPU constantly tries to sleep, but occasionally keeps failing to do so, because of a collection of these duplicate alarms constantly activating the "alarm" kernel wakeup source , presumably due to them being triggered. These might have accumulated over several iterations when the kernel alarms were set again (via rescheduleKernelAlarmsLocked()). To prevent the CPU thrashing (which heavily drains power on more battery-constrained devices, and increases the number of alarms being set), the aforementioned commit is backed out. Change-Id: I2a189cb303deb78a2faf476b0e789445407f3e11 (cherry picked from commit d19ffd4f2ca4130c41dd5f6baddad1830598ecbc)
-rw-r--r--services/core/java/com/android/server/AlarmManagerService.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index 65a5c23..a9a756e 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -1230,8 +1230,7 @@ class AlarmManagerService extends SystemService {
if (mAlarmBatches.size() > 0) {
final Batch firstWakeup = findFirstWakeupBatchLocked();
final Batch firstBatch = mAlarmBatches.get(0);
- // always update the kernel alarms, as a backstop against missed wakeups
- if (firstWakeup != null) {
+ if (firstWakeup != null && mNextWakeup != firstWakeup.start) {
mNextWakeup = firstWakeup.start;
setLocked(ELAPSED_REALTIME_WAKEUP, firstWakeup.start);
}
@@ -1244,8 +1243,7 @@ class AlarmManagerService extends SystemService {
nextNonWakeup = mNextNonWakeupDeliveryTime;
}
}
- // always update the kernel alarm, as a backstop against missed wakeups
- if (nextNonWakeup != 0) {
+ if (nextNonWakeup != 0 && mNextNonWakeup != nextNonWakeup) {
mNextNonWakeup = nextNonWakeup;
setLocked(ELAPSED_REALTIME, nextNonWakeup);
}