diff options
author | Martin Hibdon <mhibdon@google.com> | 2014-07-10 15:08:44 -0700 |
---|---|---|
committer | Martin Hibdon <mhibdon@google.com> | 2014-07-11 15:49:53 -0700 |
commit | db678bada9a25089f4ea32be0d8e6d678749459c (patch) | |
tree | 6f08244e7ea76ffb56c85f0fe33e5ea170b4c40d /src | |
parent | d793a08771c02d20c81acbedfc44d601d07d1c4f (diff) | |
download | Exchange-db678bada9a25089f4ea32be0d8e6d678749459c.tar.gz |
Update IEmailService
Add support for a version number
Correctly implement deleteAccountPIMData.
Change-Id: I4753db97a63eb63fc63519bc9be97f7fa878a737
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/exchange/eas/EasFullSyncOperation.java | 9 | ||||
-rw-r--r-- | src/com/android/exchange/eas/EasOperation.java | 9 | ||||
-rw-r--r-- | src/com/android/exchange/service/EasService.java | 16 |
3 files changed, 18 insertions, 16 deletions
diff --git a/src/com/android/exchange/eas/EasFullSyncOperation.java b/src/com/android/exchange/eas/EasFullSyncOperation.java index 79b07a80..87148346 100644 --- a/src/com/android/exchange/eas/EasFullSyncOperation.java +++ b/src/com/android/exchange/eas/EasFullSyncOperation.java @@ -111,6 +111,7 @@ public class EasFullSyncOperation extends EasOperation { final int mailboxType = mSyncExtras.getInt(Mailbox.SYNC_EXTRA_MAILBOX_TYPE, Mailbox.TYPE_NONE); + final boolean isManual = mSyncExtras.getBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, false); // Push only means this sync request should only refresh the ping (either because // settings changed, or we need to restart it for some reason). final boolean pushOnly = Mailbox.isPushOnlyExtras(mSyncExtras); @@ -171,13 +172,7 @@ public class EasFullSyncOperation extends EasOperation { if (mailboxIds != null) { // Sync the mailbox that was explicitly requested. for (final long mailboxId : mailboxIds) { - // TODO: how to tell if a sync was user requested or not. - // We should be able to check the MANUAL flag in the sync extras, but right now - // all of our syncs are manual. This is because Calender and Contacts sync adapters - // actually just forward the request through the EmailSyncAdapterService. - // When this changes we can determine for certain whether or not this is a manual - // sync. - result = syncMailbox(mailboxId, hasCallbackMethod, true); + result = syncMailbox(mailboxId, hasCallbackMethod, isManual); if (isFatal(result)) { // This is a failure, abort the sync. LogUtils.i(TAG, "Fatal result %d on syncMailbox", result); diff --git a/src/com/android/exchange/eas/EasOperation.java b/src/com/android/exchange/eas/EasOperation.java index 364115a1..19dc1492 100644 --- a/src/com/android/exchange/eas/EasOperation.java +++ b/src/com/android/exchange/eas/EasOperation.java @@ -750,14 +750,9 @@ public abstract class EasOperation { final String authority, final ArrayList<Long> mailboxIds) { final Bundle extras = Mailbox.createSyncBundle(mailboxIds); /** - * Please note that it is very possible that we are trying to send a request to the - * email sync adapter even though email push is turned off (i.e. this account might only - * be syncing calendar or contacts). In this situation we need to make sure that - * this request is marked as manual as to ensure that the sync manager does not drop it - * on the floor. Right now, this function is only called by EasPing, if it is every called - * by another caller, then we should reconsider if manual=true is the right thing to do. + * TODO: Right now, this function is only called by EasPing, should this function be + * moved there? */ - extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); ContentResolver.requestSync(amAccount, authority, extras); LogUtils.i(LOG_TAG, "EasOperation requestSyncForMailboxes %s, %s", amAccount.toString(), extras.toString()); diff --git a/src/com/android/exchange/service/EasService.java b/src/com/android/exchange/service/EasService.java index b47fb3c3..db6c05e1 100644 --- a/src/com/android/exchange/service/EasService.java +++ b/src/com/android/exchange/service/EasService.java @@ -35,6 +35,7 @@ import com.android.emailcommon.provider.HostAuth; import com.android.emailcommon.provider.Mailbox; import com.android.emailcommon.service.EmailServiceProxy; import com.android.emailcommon.service.EmailServiceStatus; +import com.android.emailcommon.service.EmailServiceVersion; import com.android.emailcommon.service.HostAuthCompat; import com.android.emailcommon.service.IEmailService; import com.android.emailcommon.service.IEmailServiceCallback; @@ -49,6 +50,8 @@ import com.android.exchange.eas.EasOperation; import com.android.exchange.eas.EasSearch; import com.android.exchange.eas.EasSearchGal; import com.android.exchange.eas.EasSendMeetingResponse; +import com.android.exchange.eas.EasSyncCalendar; +import com.android.exchange.eas.EasSyncContacts; import com.android.exchange.provider.GalResult; import com.android.mail.utils.LogUtils; @@ -203,9 +206,18 @@ public class EasService extends Service { } @Override - public void deleteAccountPIMData(final String emailAddress) { + public void deleteExternalAccountPIMData(final String emailAddress) { LogUtils.d(TAG, "IEmailService.deleteAccountPIMData"); - // TODO: remove this, move it completely to Email code. + if (emailAddress != null) { + // TODO: stop pings + final Context context = EasService.this; + EasSyncContacts.wipeAccountFromContentProvider(context, emailAddress); + EasSyncCalendar.wipeAccountFromContentProvider(context, emailAddress); + } + } + + public int getApiVersion() { + return EmailServiceVersion.CURRENT; } }; |