diff options
author | 2025-03-07 13:25:19 -0800 | |
---|---|---|
committer | 2025-03-07 13:25:19 -0800 | |
commit | d3d4dc817b6353f51f0da04db9cd9ae4d46e2314 (patch) | |
tree | fcaf9454d7dfc949409d330466055b9983e64ffe /apex | |
parent | 721bf96c0b1a774bc8365e457260e9d81063a9e6 (diff) | |
parent | dcd69b994e269331d06287cd97ef81f81e42a02c (diff) |
Merge "Release wakelock only when no alarms are in-flight" into main
Diffstat (limited to 'apex')
-rw-r--r-- | apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java b/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java index 251776e907d8..44e4999ccf44 100644 --- a/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java +++ b/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java @@ -5369,7 +5369,9 @@ public class AlarmManagerService extends SystemService { // to do any wakelock or stats tracking, so we have nothing // left to do here but go on to the next thing. mSendFinishCount++; - if (Flags.acquireWakelockBeforeSend()) { + if (Flags.acquireWakelockBeforeSend() && mBroadcastRefCount == 0) { + // No other alarms are in-flight and this dispatch failed. We will + // acquire the wakelock again before the next dispatch. mWakeLock.release(); } return; @@ -5409,7 +5411,9 @@ public class AlarmManagerService extends SystemService { // stats management to do. It threw before we posted the delayed // timeout message, so we're done here. mListenerFinishCount++; - if (Flags.acquireWakelockBeforeSend()) { + if (Flags.acquireWakelockBeforeSend() && mBroadcastRefCount == 0) { + // No other alarms are in-flight and this dispatch failed. We will + // acquire the wakelock again before the next dispatch. mWakeLock.release(); } return; |