Merge "Allow callers to set value of notifyAuthFailure"
diff --git a/src/com/android/volley/toolbox/AndroidAuthenticator.java b/src/com/android/volley/toolbox/AndroidAuthenticator.java
index c00f8bb..a2c6ac9 100644
--- a/src/com/android/volley/toolbox/AndroidAuthenticator.java
+++ b/src/com/android/volley/toolbox/AndroidAuthenticator.java
@@ -33,6 +33,7 @@
private final Context mContext;
private final Account mAccount;
private final String mAuthTokenType;
+ private final boolean mNotifyAuthFailure;
/**
* Creates a new authenticator.
@@ -41,9 +42,22 @@
* @param authTokenType Auth token type passed to AccountManager
*/
public AndroidAuthenticator(Context context, Account account, String authTokenType) {
+ this(context, account, authTokenType, false);
+ }
+
+ /**
+ * Creates a new authenticator.
+ * @param context Context for accessing AccountManager
+ * @param account Account to authenticate as
+ * @param authTokenType Auth token type passed to AccountManager
+ * @param notifyAuthFailure Whether to raise a notification upon auth failure
+ */
+ public AndroidAuthenticator(Context context, Account account, String authTokenType,
+ boolean notifyAuthFailure) {
mContext = context;
mAccount = account;
mAuthTokenType = authTokenType;
+ mNotifyAuthFailure = notifyAuthFailure;
}
/**
@@ -57,7 +71,7 @@
public String getAuthToken() throws AuthFailureError {
final AccountManager accountManager = AccountManager.get(mContext);
AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount,
- mAuthTokenType, false, null, null);
+ mAuthTokenType, mNotifyAuthFailure, null, null);
Bundle result;
try {
result = future.getResult();