Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit efa4e969 authored by Christopher Tate's avatar Christopher Tate Committed by android-build-merger
Browse files

Eliminate next-alarm-clock broadcast flapping am: 76389c00 am: 0115b9f1

am: f861e0df

Change-Id: I1a2267303072e32b20889986d4edbabeefd2b8d9
parents 3b3e6caa f861e0df
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -1732,9 +1732,10 @@ class AlarmManagerService extends SystemService {
                Alarm a = alarms.get(j);
                Alarm a = alarms.get(j);
                if (a.alarmClock != null) {
                if (a.alarmClock != null) {
                    final int userId = UserHandle.getUserId(a.uid);
                    final int userId = UserHandle.getUserId(a.uid);
                    AlarmManager.AlarmClockInfo current = mNextAlarmClockForUser.get(userId);


                    if (DEBUG_ALARM_CLOCK) {
                    if (DEBUG_ALARM_CLOCK) {
                        Log.v(TAG, "Found AlarmClockInfo at " +
                        Log.v(TAG, "Found AlarmClockInfo " + a.alarmClock + " at " +
                                formatNextAlarm(getContext(), a.alarmClock, userId) +
                                formatNextAlarm(getContext(), a.alarmClock, userId) +
                                " for user " + userId);
                                " for user " + userId);
                    }
                    }
@@ -1742,6 +1743,10 @@ class AlarmManagerService extends SystemService {
                    // Alarms and batches are sorted by time, no need to compare times here.
                    // Alarms and batches are sorted by time, no need to compare times here.
                    if (nextForUser.get(userId) == null) {
                    if (nextForUser.get(userId) == null) {
                        nextForUser.put(userId, a.alarmClock);
                        nextForUser.put(userId, a.alarmClock);
                    } else if (a.alarmClock.equals(current)
                            && current.getTriggerTime() <= nextForUser.get(userId).getTriggerTime()) {
                        // same/earlier time and it's the one we cited before, so stick with it
                        nextForUser.put(userId, current);
                    }
                    }
                }
                }
            }
            }