/**
  * 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);
 }
  /**
   * Invalidates the old token (if non-null/non-empty) and synchronously generates a new one. Also
   * notifies the user (via status bar) if any user action is required. The method will return null
   * if any user action is required to generate the new token.
   *
   * <p>- Assumes that the account is a valid account. - Should not be called on the main thread.
   */
  @Deprecated
  public String getNewAuthToken(Account account, String authToken, String authTokenType) {
    // TODO(dsmyers): consider reimplementing using an AccountManager function with an
    // explicit timeout.
    // Bug: https://code.google.com/p/chromium/issues/detail?id=172394.
    if (authToken != null && !authToken.isEmpty()) {
      mAccountManager.invalidateAuthToken(GOOGLE_ACCOUNT_TYPE, authToken);
    }

    try {
      return mAccountManager.blockingGetAuthToken(account, authTokenType, true);
    } catch (OperationCanceledException e) {
      Log.w(TAG, "Auth token - operation cancelled", e);
    } catch (AuthenticatorException e) {
      Log.w(TAG, "Auth token - authenticator exception", e);
    } catch (IOException e) {
      Log.w(TAG, "Auth token - IO exception", e);
    }
    return null;
  }
 /** Removes an auth token from the AccountManager's cache. */
 public void invalidateAuthToken(String authToken) {
   mAccountManager.invalidateAuthToken(GOOGLE_ACCOUNT_TYPE, authToken);
 }