From cdd477e16a82417fb924abc42a2a834c29fb0db8 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Wed, 30 Sep 2009 23:55:40 -0700 Subject: [PATCH] Delete attachments for mailboxes/messages deleted by server Change-Id: Idd94dd0be9e8febe449fd4888fdb911af76618ce --- src/com/android/exchange/adapter/EmailSyncAdapter.java | 2 ++ src/com/android/exchange/adapter/FolderSyncParser.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/com/android/exchange/adapter/EmailSyncAdapter.java b/src/com/android/exchange/adapter/EmailSyncAdapter.java index a2bca3eca..b4e0c4605 100644 --- a/src/com/android/exchange/adapter/EmailSyncAdapter.java +++ b/src/com/android/exchange/adapter/EmailSyncAdapter.java @@ -18,6 +18,7 @@ package com.android.exchange.adapter; import com.android.email.mail.Address; +import com.android.email.provider.AttachmentProvider; import com.android.email.provider.EmailContent; import com.android.email.provider.EmailProvider; import com.android.email.provider.EmailContent.Account; @@ -425,6 +426,7 @@ public class EmailSyncAdapter extends AbstractSyncAdapter { for (Long id : deletedEmails) { ops.add(ContentProviderOperation.newDelete( ContentUris.withAppendedId(Message.CONTENT_URI, id)).build()); + AttachmentProvider.deleteAllAttachmentFiles(mContext, mAccount.mId, id); } if (!changedEmails.isEmpty()) { // Server wins in a conflict... diff --git a/src/com/android/exchange/adapter/FolderSyncParser.java b/src/com/android/exchange/adapter/FolderSyncParser.java index be268a4cb..aa2f42aa7 100644 --- a/src/com/android/exchange/adapter/FolderSyncParser.java +++ b/src/com/android/exchange/adapter/FolderSyncParser.java @@ -17,6 +17,7 @@ package com.android.exchange.adapter; +import com.android.email.provider.AttachmentProvider; import com.android.email.provider.EmailContent; import com.android.email.provider.EmailProvider; import com.android.email.provider.EmailContent.Account; @@ -163,6 +164,8 @@ public class FolderSyncParser extends AbstractSyncParser { ops.add(ContentProviderOperation.newDelete( ContentUris.withAppendedId(Mailbox.CONTENT_URI, c.getLong(0))).build()); + AttachmentProvider.deleteAllMailboxAttachmentFiles(mContext, + mAccountId, mMailbox.mId); } } finally { c.close();