/**
  * Gets the auth token and returns the response asynchronously. This should be called when we have
  * a foreground activity that needs an auth token. If encountered an IO error, it will attempt to
  * retry when the network is back.
  *
  * <p>- Assumes that the account is a valid account.
  */
 public void getAuthTokenFromForeground(
     Activity activity, Account account, String authTokenType, GetAuthTokenCallback callback) {
   AtomicInteger numTries = new AtomicInteger(0);
   AtomicBoolean errorEncountered = new AtomicBoolean(false);
   getAuthTokenAsynchronously(
       activity, account, authTokenType, callback, numTries, errorEncountered, null);
 }
 /**
  * Invalidates the old token (if non-null/non-empty) and asynchronously generates a new one.
  *
  * <p>- Assumes that the account is a valid account.
  */
 public void getNewAuthTokenFromForeground(
     Account account, String authToken, String authTokenType, GetAuthTokenCallback callback) {
   if (authToken != null && !authToken.isEmpty()) {
     mAccountManager.invalidateAuthToken(GOOGLE_ACCOUNT_TYPE, authToken);
   }
   AtomicInteger numTries = new AtomicInteger(0);
   AtomicBoolean errorEncountered = new AtomicBoolean(false);
   getAuthTokenAsynchronously(
       null, account, authTokenType, callback, numTries, errorEncountered, null);
 }