/// retrieve extras from intent\r
String tokenType = getIntent().getExtras().getString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE);\r
boolean oAuthRequired = AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(tokenType);\r
- mOAuth2Check.setChecked(oAuthRequired);\r
- changeViewByOAuth2Check(oAuthRequired);\r
\r
mAccount = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT);\r
if (mAccount != null) {\r
mHostUrlInput.setText(mHostBaseUrl);\r
String userName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@'));\r
mUsernameInput.setText(userName);\r
+ oAuthRequired = (mAccountMgr.getUserData(mAccount, AccountAuthenticator.KEY_SUPPORTS_OAUTH2) != null);\r
}\r
+ mOAuth2Check.setChecked(oAuthRequired);\r
+ changeViewByOAuth2Check(oAuthRequired);\r
+ \r
\r
} else {\r
loadSavedInstanceState(savedInstanceState);\r
boolean isOAuth = mOAuth2Check.isChecked();\r
if (isOAuth) {\r
response.putString(AccountManager.KEY_AUTHTOKEN, mOAuthAccessToken);\r
- // the next line is unnecessary; the AccountManager does it when receives the response Bundle\r
- // mAccountMgr.setAuthToken(mAccount, AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN, mOAuthAccessToken);\r
+ // the next line is necessary; by now, notifications are calling directly to the AuthenticatorActivity to update, without AccountManager intervention\r
+ mAccountMgr.setAuthToken(mAccount, AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN, mOAuthAccessToken);\r
} else {\r
response.putString(AccountManager.KEY_AUTHTOKEN, mPasswordInput.getText().toString());\r
- // the next line is not really necessary, because we are using the password as if it was an auth token; but let's keep it there by now\r
mAccountMgr.setPassword(mAccount, mPasswordInput.getText().toString());\r
}\r
setAccountAuthenticatorResult(response);\r