/** * Adds a historical record. * * @param historicalRecord The record to add. * @return True if the record was added. */ private boolean addHistoricalRecord(HistoricalRecord historicalRecord) { final boolean added = mHistoricalRecords.add(historicalRecord); if (added) { mHistoricalRecordsChanged = true; pruneExcessiveHistoricalRecordsIfNeeded(); persistHistoricalDataIfNeeded(); sortActivitiesIfNeeded(); notifyChanged(); } return added; }
/** * Removes all historical records for this pkg. * * @param historicalRecord The pkg to delete records for. * @return True if the record was added. */ boolean removeHistoricalRecordsForPackage(final String pkg) { boolean removed = false; for (Iterator<HistoricalRecord> i = mHistoricalRecords.iterator(); i.hasNext(); ) { final HistoricalRecord record = i.next(); if (record.activity.getPackageName().equals(pkg)) { i.remove(); removed = true; } } if (removed) { mHistoricalRecordsChanged = true; pruneExcessiveHistoricalRecordsIfNeeded(); persistHistoricalDataIfNeeded(); sortActivitiesIfNeeded(); notifyChanged(); } return removed; }