/**
  * @return true if the mailbox list of the current account hasn't been refreshed in the last
  *     {@link #MAILBOX_REFRESH_MIN_INTERVAL}.
  */
 @VisibleForTesting
 boolean shouldRefreshMailboxList() {
   if (mRefreshManager.isMailboxListRefreshing(mAccountId)) {
     return false;
   }
   final long nextRefreshTime =
       mRefreshManager.getLastMailboxListRefreshTime(mAccountId) + MAILBOX_REFRESH_MIN_INTERVAL;
   if (nextRefreshTime > mClock.getTime()) {
     return false;
   }
   return true;
 }
 /**
  * @return true if the inbox of the current account hasn't been refreshed in the last {@link
  *     #INBOX_AUTO_REFRESH_MIN_INTERVAL}.
  */
 @VisibleForTesting
 boolean shouldAutoRefreshInbox() {
   if (mInboxId == mMailboxId) {
     return false; // Current ID == inbox.  No need to auto-refresh.
   }
   if (mRefreshManager.isMessageListRefreshing(mInboxId)) {
     return false;
   }
   final long nextRefreshTime =
       mRefreshManager.getLastMessageListRefreshTime(mInboxId) + INBOX_AUTO_REFRESH_MIN_INTERVAL;
   if (nextRefreshTime > mClock.getTime()) {
     return false;
   }
   return true;
 }
 public RefreshTask(
     EmailAsyncTask.Tracker tracker, Context context, long accountId, long mailboxId) {
   this(
       tracker,
       context,
       accountId,
       mailboxId,
       Clock.INSTANCE,
       RefreshManager.getInstance(context));
 }
    /** Do the actual refresh. */
    @Override
    protected void onSuccess(Boolean isCurrentMailboxRefreshable) {
      if (isCurrentMailboxRefreshable == null) {
        return;
      }

      if (isCurrentMailboxRefreshable) {
        mRefreshManager.refreshMessageList(mAccountId, mMailboxId, true);
      }

      // Refresh mailbox list
      if (mAccountId != Account.NO_ACCOUNT) {
        if (shouldRefreshMailboxList()) {
          mRefreshManager.refreshMailboxList(mAccountId);
        }
      }
      // Refresh inbox
      if (shouldAutoRefreshInbox()) {
        mRefreshManager.refreshMessageList(mAccountId, mInboxId, true);
      }
    }