Alarm a = alarms.get(j);
if (a.alarmClock != null) {
final int userId = UserHandle.getUserId(a.uid);
+ AlarmManager.AlarmClockInfo current = mNextAlarmClockForUser.get(userId);
if (DEBUG_ALARM_CLOCK) {
- Log.v(TAG, "Found AlarmClockInfo at " +
+ Log.v(TAG, "Found AlarmClockInfo " + a.alarmClock + " at " +
formatNextAlarm(getContext(), a.alarmClock, userId) +
" for user " + userId);
}
// Alarms and batches are sorted by time, no need to compare times here.
if (nextForUser.get(userId) == null) {
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);
}
}
}