OSDN Git Service

If 'customTokens', let authenticator handle notification.
authorCostin Manolache <costin@google.com>
Tue, 25 Jan 2011 00:11:36 +0000 (16:11 -0800)
committerCostin Manolache <costin@google.com>
Tue, 25 Jan 2011 23:28:44 +0000 (15:28 -0800)
Bug: 3377952
Change-Id: Iffb0ed01c39b42838cf88fd1b332c4b41c3194ec

core/java/android/accounts/AccountManager.java
core/java/android/accounts/AccountManagerService.java

index 6388dc5..5bdc79d 100644 (file)
@@ -195,6 +195,13 @@ public class AccountManager {
     public static final String KEY_CALLER_UID = "callerUid";
     public static final String KEY_CALLER_PID = "callerPid";
 
+    /**
+     * Boolean, if set and 'customTokens' the authenticator is responsible for
+     * notifications.
+     * @hide
+     */
+    public static final String KEY_NOTIFY_ON_FAILURE = "notifyOnAuthFailure";
+
     public static final String ACTION_AUTHENTICATOR_INTENT =
             "android.accounts.AccountAuthenticator";
     public static final String AUTHENTICATOR_META_DATA_NAME =
index 2c99f14..fb16609 100644 (file)
@@ -897,6 +897,9 @@ public class AccountManagerService
             // let authenticator know the identity of the caller
             loginOptions.putInt(AccountManager.KEY_CALLER_UID, callerUid);
             loginOptions.putInt(AccountManager.KEY_CALLER_PID, callerPid);
+            if (notifyOnAuthFailure) {
+                loginOptions.putBoolean(AccountManager.KEY_NOTIFY_ON_FAILURE, true);
+            }
         }
 
         long identityToken = clearCallingIdentity();
@@ -964,7 +967,7 @@ public class AccountManagerService
                         }
 
                         Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
-                        if (intent != null && notifyOnAuthFailure) {
+                        if (intent != null && notifyOnAuthFailure && !customTokens) {
                             doNotification(
                                     account, result.getString(AccountManager.KEY_AUTH_FAILED_MESSAGE),
                                     intent);