diff options
author | 2025-02-21 16:14:55 -0800 | |
---|---|---|
committer | 2025-02-21 16:14:58 -0800 | |
commit | caea55101151f47a33c955b00c685edcc4494c4b (patch) | |
tree | 018c70a84fc9726423167d368183f78f5e4bab42 /apex | |
parent | 73c4873c60327cf1a964255fc230560d1a94a4d8 (diff) |
Release alarm wakelock if send fails
Now that we're acquiring a wakelock before we dispatch the alarm to the
app, we also need to release it in cases where the dispatch results in
an exception, because the only other release point is in the path of
alarm completion or timeout.
Test: atest FrameworksMockingServicesTests:AlarmManagerServiceTest
Flag: com.android.server.alarm.acquire_wakelock_before_send
Bug: 397950542
Change-Id: I7f119c51e2377841396efb360b38f51c1ab17915
Diffstat (limited to 'apex')
-rw-r--r-- | apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java | 6 |
1 files changed, 6 insertions, 0 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 f89b13dce307..0298c1e627ee 100644 --- a/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java +++ b/apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java @@ -5367,6 +5367,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()) { + mWakeLock.release(); + } return; } } else { @@ -5404,6 +5407,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()) { + mWakeLock.release(); + } return; } } |