do not merge: cherrypicked 7bb05334b3 from master branch

This commit is contained in:
Fred Quintana 2009-08-15 21:50:48 -07:00
parent 10e8ecef2f
commit d0254da4e0
4 changed files with 11 additions and 10 deletions

View File

@ -34,9 +34,9 @@ import com.android.exchange.SyncManager;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorException;
import android.accounts.Future2;
import android.accounts.Future2Callback;
import android.accounts.OperationCanceledException;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.content.Context;
import android.os.Bundle;
import android.os.RemoteException;
@ -122,8 +122,8 @@ public class ExchangeStore extends Store {
Bundle options = new Bundle();
options.putString(EasAuthenticatorService.OPTIONS_USERNAME, acct.mEmailAddress);
options.putString(EasAuthenticatorService.OPTIONS_PASSWORD, acct.mHostAuthRecv.mPassword);
Future2Callback callback = new Future2Callback() {
public void run(Future2 future) {
AccountManagerCallback<Bundle> callback = new AccountManagerCallback<Bundle>() {
public void run(AccountManagerFuture<Bundle> future) {
try {
Bundle bundle = future.getResult();
bundle.keySet();

View File

@ -54,9 +54,10 @@ public class EasAuthenticatorService extends Service {
// app UI; we simply create the account and return the proper bundle
if (options != null && options.containsKey(OPTIONS_PASSWORD)
&& options.containsKey(OPTIONS_USERNAME)) {
AccountManager.get(EasAuthenticatorService.this).blockingAddAccountExplicitly(
new Account(options.getString(OPTIONS_USERNAME), Eas.ACCOUNT_MANAGER_TYPE),
options.getString(OPTIONS_PASSWORD), null);
final Account account = new Account(options.getString(OPTIONS_USERNAME),
Eas.ACCOUNT_MANAGER_TYPE);
AccountManager.get(EasAuthenticatorService.this).addAccountExplicitly(
account, options.getString(OPTIONS_PASSWORD), null);
Bundle b = new Bundle();
b.putString(Constants.ACCOUNT_NAME_KEY, options.getString(OPTIONS_USERNAME));
b.putString(Constants.ACCOUNT_TYPE_KEY, Eas.ACCOUNT_MANAGER_TYPE);

View File

@ -81,7 +81,7 @@ public class ContactsSyncAdapterService extends Service {
// Find the (EmailProvider) account associated with this email address
Cursor accountCursor =
cr.query(com.android.email.provider.EmailContent.Account.CONTENT_URI, ID_PROJECTION,
AccountColumns.EMAIL_ADDRESS + "=?", new String[] {account.mName}, null);
AccountColumns.EMAIL_ADDRESS + "=?", new String[] {account.name}, null);
try {
if (accountCursor.moveToFirst()) {
long accountId = accountCursor.getLong(0);
@ -90,7 +90,7 @@ public class ContactsSyncAdapterService extends Service {
ACCOUNT_AND_TYPE_CONTACTS, new String[] {Long.toString(accountId)}, null);
try {
if (mailboxCursor.moveToFirst()) {
Log.i(TAG, "Contact sync requested for " + account.mName);
Log.i(TAG, "Contact sync requested for " + account.name);
// Ask for a sync from our sync manager
SyncManager.serviceRequest(mailboxCursor.getLong(0),
SyncManager.SYNC_UPSYNC);

View File

@ -360,7 +360,7 @@ public class SyncManager extends Service implements Runnable {
android.accounts.Account acct =
new android.accounts.Account(Eas.ACCOUNT_MANAGER_TYPE,
account.mEmailAddress);
AccountManager.get(SyncManager.this).blockingRemoveAccount(acct);
AccountManager.get(SyncManager.this).removeAccount(acct, null, null);
} else {
// See whether any of our accounts has changed sync interval or window
if (syncParametersChanged(account)) {