private void dismissFiredAlarms() { ContentValues values = new ContentValues(1 /* size */); values.put(PROJECTION[INDEX_STATE], CalendarAlerts.STATE_DISMISSED); String selection = CalendarAlerts.STATE + "=" + CalendarAlerts.STATE_FIRED; mQueryHandler.startUpdate( 0, null, CalendarAlerts.CONTENT_URI, values, selection, null /* selectionArgs */, Utils.UNDO_DELAY); if (mCursor == null) { Log.e(TAG, "Unable to globally dismiss all notifications because cursor was null."); return; } if (mCursor.isClosed()) { Log.e(TAG, "Unable to globally dismiss all notifications because cursor was closed."); return; } if (!mCursor.moveToFirst()) { Log.e(TAG, "Unable to globally dismiss all notifications because cursor was empty."); return; } List<AlarmId> alarmIds = new LinkedList<AlarmId>(); do { long eventId = mCursor.getLong(INDEX_EVENT_ID); long eventStart = mCursor.getLong(INDEX_BEGIN); alarmIds.add(new AlarmId(eventId, eventStart)); } while (mCursor.moveToNext()); initiateGlobalDismiss(alarmIds); }
private void resetNewCallsFlag() { // Mark all "new" missed calls as not new anymore StringBuilder where = new StringBuilder("type="); where.append(Calls.MISSED_TYPE); where.append(" AND new=1"); ContentValues values = new ContentValues(1); values.put(Calls.NEW, "0"); mQueryHandler.startUpdate( UPDATE_TOKEN, null, Calls.CONTENT_URI, values, where.toString(), null); }
private void dismissAlarm(long id, long eventId, long startTime) { ContentValues values = new ContentValues(1 /* size */); values.put(PROJECTION[INDEX_STATE], CalendarAlerts.STATE_DISMISSED); String selection = CalendarAlerts._ID + "=" + id; mQueryHandler.startUpdate( 0, null, CalendarAlerts.CONTENT_URI, values, selection, null /* selectionArgs */, Utils.UNDO_DELAY); List<AlarmId> alarmIds = new LinkedList<AlarmId>(); alarmIds.add(new AlarmId(eventId, startTime)); initiateGlobalDismiss(alarmIds); }