/** * Sets the maximal size of the historical data. Defaults to * {@link #DEFAULT_HISTORY_MAX_LENGTH} * <p> * <strong>Note:</strong> Setting this property will immediately * enforce the specified max history size by dropping enough old * historical records to enforce the desired size. Thus, any * records that exceed the history size will be discarded and * irreversibly lost. * </p> * * @param historyMaxSize The max history size. */ public void setHistoryMaxSize(int historyMaxSize) { synchronized (mInstanceLock) { if (mHistoryMaxSize == historyMaxSize) { return; } mHistoryMaxSize = historyMaxSize; pruneExcessiveHistoricalRecordsLocked(); sortActivities(); } }
/** * Sets the maximal size of the historical data. Defaults to * {@link #DEFAULT_HISTORY_MAX_LENGTH} * <p> * <strong>Note:</strong> Setting this property will immediately * enforce the specified max history size by dropping enough old * historical records to enforce the desired size. Thus, any * records that exceed the history size will be discarded and * irreversibly lost. * </p> * * @param historyMaxSize The max history size. */ public void setHistoryMaxSize(int historyMaxSize) { synchronized (mInstanceLock) { if (mHistoryMaxSize == historyMaxSize) { return; } mHistoryMaxSize = historyMaxSize; pruneExcessiveHistoricalRecordsLocked(); sortActivities(); } }
/** * Adds a historical record. * * @param historicalRecord The record to add. * @return True if the record was added. */ private boolean addHisoricalRecord(HistoricalRecord historicalRecord) { synchronized (mInstanceLock) { final boolean added = mHistoricalRecords.add(historicalRecord); if (added) { mHistoricalRecordsChanged = true; pruneExcessiveHistoricalRecordsLocked(); persistHistoricalData(); sortActivities(); } return added; } }
/** * Adds a historical record. * * @param historicalRecord The record to add. * @return True if the record was added. */ private boolean addHisoricalRecord(HistoricalRecord historicalRecord) { synchronized (mInstanceLock) { final boolean added = mHistoricalRecords.add(historicalRecord); if (added) { mHistoricalRecordsChanged = true; pruneExcessiveHistoricalRecordsLocked(); persistHistoricalData(); sortActivities(); } return added; } }