RESTRICT AUTOMERGE Prevent size of list changes during mPendingNonWakeupAlarms deliver

When device changes from SCREEN_OFF to SCREEN_ON, AlarmManagerService deliver non-wakeup alarms.
If there is TIME_TICK alarm in mPendingNonWakeupAlarms, TIME_TICK alarm is rescheduled.
While TIME_TICK alarm is set again, it is removed from mPendingNonWakeupAlarms.
Because removing alarm from mPendingNonWakeupAlarms change size of mPendingNonWakeupAlarms,
last alarm in mPendingNonWakeupAlarms is not delivered.

Test: build / boot
Change-Id: If0ab601248b4833855e03157cc47ffc678b3b974
Merged-In: I5228c323bb9698864c467e9e4c400459ca404b3c
This commit is contained in:
Juneup Park
2020-10-23 19:23:57 +09:00
committed by Suprabh Shukla
parent dd5e2cd505
commit 5504a25a6f

View File

@@ -3369,7 +3369,9 @@ class AlarmManagerService extends SystemService {
if (mMaxDelayTime < thisDelayTime) {
mMaxDelayTime = thisDelayTime;
}
deliverAlarmsLocked(mPendingNonWakeupAlarms, nowELAPSED);
ArrayList<Alarm> triggerList =
(ArrayList<Alarm>) mPendingNonWakeupAlarms.clone();
deliverAlarmsLocked(triggerList, nowELAPSED);
mPendingNonWakeupAlarms.clear();
}
if (mNonInteractiveStartTime > 0) {