code: public void setHistoryMaxSize(int historyMaxSize) {
          synchronized (mInstanceLock) {
              if (mHistoryMaxSize == historyMaxSize) {
                  return;
              }
              mHistoryMaxSize = historyMaxSize;
              pruneExcessiveHistoricalRecordsIfNeeded();
              if (sortActivitiesIfNeeded()) {
                  notifyChanged();
              }
          }
      }
docs: 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.