From 649acab38956759213309835de39b14d43c1417e Mon Sep 17 00:00:00 2001 From: "minho.choo" Date: Fri, 12 Dec 2014 16:13:55 +0900 Subject: [PATCH] Fix bugs regarding delay the dispatching of non-wakeup alarms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit checkAllowNonWakeupDelayLocked() method determines that delay the dispatching of non-wakeup alarms. (there are no wakeup alarms and the screen is off, it can delay until the future.) if there is any pending non-wakeup alarms, non-wakeup alarm delivery time is bigger than nowELAPSED. but, checkAllowNonWakeupDelayLocked() returns false and non-wakeup alarm is not delay until future. i think it is necessary to reverse the inequality symbol on "mNextNonWakeupDeliveryTime > nowELAPSED" if it isn't, Could you let me know when we get ¡°stuck in a loop¡± in the comment of checkAllowNonWakeupDelayLocked () method? Change-Id: I7e972064547f4d0a9b4175dbd4cf735b4837abfd Signed-off-by: Minho Choo --- services/core/java/com/android/server/AlarmManagerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java index 8b524ddab458c..0c555c5f146ed 100644 --- a/services/core/java/com/android/server/AlarmManagerService.java +++ b/services/core/java/com/android/server/AlarmManagerService.java @@ -1587,7 +1587,7 @@ class AlarmManagerService extends SystemService { if (mLastAlarmDeliveryTime <= 0) { return false; } - if (mPendingNonWakeupAlarms.size() > 0 && mNextNonWakeupDeliveryTime > nowELAPSED) { + if (mPendingNonWakeupAlarms.size() > 0 && mNextNonWakeupDeliveryTime < nowELAPSED) { // This is just a little paranoia, if somehow we have pending non-wakeup alarms // and the next delivery time is in the past, then just deliver them all. This // avoids bugs where we get stuck in a loop trying to poll for alarms.