From d0254da4e033df3265d9cea9bcbd8b6817e1d625 Mon Sep 17 00:00:00 2001 From: Fred Quintana Date: Sat, 15 Aug 2009 21:50:48 -0700 Subject: [PATCH] do not merge: cherrypicked 7bb05334b3d711ff1d03672b35f89b326acba198 from master branch --- src/com/android/email/mail/store/ExchangeStore.java | 8 ++++---- .../android/email/service/EasAuthenticatorService.java | 7 ++++--- src/com/android/exchange/ContactsSyncAdapterService.java | 4 ++-- src/com/android/exchange/SyncManager.java | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/com/android/email/mail/store/ExchangeStore.java b/src/com/android/email/mail/store/ExchangeStore.java index b302d6228..4a89d2cfe 100644 --- a/src/com/android/email/mail/store/ExchangeStore.java +++ b/src/com/android/email/mail/store/ExchangeStore.java @@ -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 callback = new AccountManagerCallback() { + public void run(AccountManagerFuture future) { try { Bundle bundle = future.getResult(); bundle.keySet(); diff --git a/src/com/android/email/service/EasAuthenticatorService.java b/src/com/android/email/service/EasAuthenticatorService.java index 5ff323fec..347271cc5 100644 --- a/src/com/android/email/service/EasAuthenticatorService.java +++ b/src/com/android/email/service/EasAuthenticatorService.java @@ -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); diff --git a/src/com/android/exchange/ContactsSyncAdapterService.java b/src/com/android/exchange/ContactsSyncAdapterService.java index ed954c3d2..b7783955a 100644 --- a/src/com/android/exchange/ContactsSyncAdapterService.java +++ b/src/com/android/exchange/ContactsSyncAdapterService.java @@ -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); diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java index b4d60606d..77cc38e3a 100644 --- a/src/com/android/exchange/SyncManager.java +++ b/src/com/android/exchange/SyncManager.java @@ -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)) {