问题描述
- 关于android5.1AlarmManagerService中移除Alarm的问题
-
private void removeLocked(PendingIntent operation) { boolean didRemove = false; for (int i = mAlarmBatches.size() - 1; i >= 0; i--) { Batch b = mAlarmBatches.get(i); ArrayList<Alarm> alarmList = b.alarms; Alarm alarm = null; for (int j = alarmList.size() - 1; j >= 0; j--) { alarm = alarmList.get(j); if (alarm.type == RTC_POWEROFF_WAKEUP && alarm.operation.equals(operation)) { long alarmSeconds, alarmNanoseconds; alarmSeconds = alarm.when / 1000; alarmNanoseconds = (alarm.when % 1000) * 1000 * 1000; Slog.w(TAG,"Clear alarm type=" + alarm.type + ",alarmSeconds=" + alarmSeconds); clear(mNativeData, alarm.type, alarmSeconds, alarmNanoseconds); mNextRtcWakeup = 0; } } didRemove |= b.remove(operation); if (b.size() == 0) { mAlarmBatches.remove(i); } } if (didRemove) { if (DEBUG_BATCH) { Slog.v(TAG, "remove(operation) changed bounds; rebatching"); } rebatchAllAlarmsLocked(true); rescheduleKernelAlarmsLocked(); updateNextAlarmClockLocked(); } }
在google源码中,移除alarm中的判断语句 if (alarm.type == RTC_POWEROFF_WAKEUP && alarm.operation.equals(operation)) ,难道只移除RTC_POWEROFF_WAKEU
这一种闹钟么?
解决方案
时间: 2024-12-02 02:50:47