Refresh authorization token on failed synchronizations when notification error is...
[pub/Android/ownCloud.git] / src / com / owncloud / android / authenticator / AccountAuthenticator.java
index c6ad9e7..8b85392 100644 (file)
@@ -98,6 +98,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
         intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);\r
         intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures);\r
         intent.putExtra(KEY_LOGIN_OPTIONS, options);\r
+        intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_CREATE);\r
 \r
         setIntentFlags(intent);\r
         \r
@@ -173,12 +174,14 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
             return result;\r
         }\r
         \r
-        /// if not stored, return Intent to access the AuthenticatorActivity\r
+        /// if not stored, return Intent to access the AuthenticatorActivity and UPDATE the token for the account\r
         final Intent intent = new Intent(mContext, AuthenticatorActivity.class);\r
         intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);\r
         intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);\r
         intent.putExtra(KEY_LOGIN_OPTIONS, options);\r
         intent.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account);\r
+        intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);\r
+        \r
 \r
         final Bundle bundle = new Bundle();\r
         bundle.putParcelable(AccountManager.KEY_INTENT, intent);\r
@@ -224,8 +227,8 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
 \r
     private void setIntentFlags(Intent intent) {\r
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r
-        intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);\r
-        intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // incompatible with the authorization code grant in OAuth\r
+        //intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);\r
+        //intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // incompatible with the authorization code grant in OAuth\r
         intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);\r
         intent.addFlags(Intent.FLAG_FROM_BACKGROUND);\r
     }\r