Remove references to account mailbox.

Exchange implementation no longer uses them.

Change-Id: I221a914f2428c0c7989f79392ca82f7a8f4b1c52
This commit is contained in:
Yu Ping Hu 2013-06-17 19:45:17 -07:00
parent e1f0169419
commit aa0ca16a27
4 changed files with 12 additions and 23 deletions

View File

@ -180,6 +180,7 @@ public class Mailbox extends EmailContent implements MailboxColumns, Parcelable
public static final int TYPE_CALENDAR = 0x41;
public static final int TYPE_CONTACTS = 0x42;
public static final int TYPE_TASKS = 0x43;
@Deprecated
public static final int TYPE_EAS_ACCOUNT_MAILBOX = 0x44;
public static final int TYPE_UNKNOWN = 0x45;

View File

@ -142,8 +142,9 @@ public final class DBHelper {
// Version 109: Migrate the account so they have the correct account manager types
// Version 110: Stop updating message_count, don't use auto lookback, and don't use
// ping/push_hold sync states.
// Version 111: Delete Exchange account mailboxes.
public static final int DATABASE_VERSION = 110;
public static final int DATABASE_VERSION = 111;
// Any changes to the database format *must* include update-in-place code.
// Original version: 2
@ -1043,6 +1044,11 @@ public final class DBHelper {
db.execSQL("update " + Mailbox.TABLE_NAME + " set " + MailboxColumns.SYNC_LOOKBACK
+ "=null where " + MailboxColumns.SYNC_LOOKBACK + "<"
+ SyncWindow.SYNC_WINDOW_1_DAY);
oldVersion = 110;
}
if (oldVersion == 110) {
db.execSQL("delete from " + Mailbox.TABLE_NAME + " where " + MailboxColumns.TYPE
+ "=" +Mailbox.TYPE_EAS_ACCOUNT_MAILBOX);
}
}

View File

@ -4421,10 +4421,6 @@ public class EmailProvider extends ContentProvider {
}
private static final String MAILBOXES_FOR_ACCOUNT_SELECTION = MailboxColumns.ACCOUNT_KEY + "=?";
private static final String MAILBOXES_FOR_ACCOUNT_EXCEPT_ACCOUNT_MAILBOX_SELECTION =
MAILBOXES_FOR_ACCOUNT_SELECTION + " AND " + MailboxColumns.TYPE + "!=" +
Mailbox.TYPE_EAS_ACCOUNT_MAILBOX;
private static final String MESSAGES_FOR_ACCOUNT_SELECTION = MessageColumns.ACCOUNT_KEY + "=?";
/**
* Delete an account and clean it up
@ -4472,24 +4468,15 @@ public class EmailProvider extends ContentProvider {
// Delete synced attachments
AttachmentUtilities.deleteAllAccountAttachmentFiles(context, accountId);
// Delete synced email, leaving only an empty inbox. We do this in two phases:
// 1. Delete all non-inbox mailboxes (which will delete all of their messages)
// 2. Delete all remaining messages (which will be the inbox messages)
// Delete all mailboxes.
ContentResolver resolver = context.getContentResolver();
String[] accountIdArgs = new String[] { Long.toString(accountId) };
resolver.delete(Mailbox.CONTENT_URI,
MAILBOXES_FOR_ACCOUNT_EXCEPT_ACCOUNT_MAILBOX_SELECTION,
accountIdArgs);
resolver.delete(Message.CONTENT_URI, MESSAGES_FOR_ACCOUNT_SELECTION, accountIdArgs);
resolver.delete(Mailbox.CONTENT_URI, MAILBOXES_FOR_ACCOUNT_SELECTION, accountIdArgs);
// Delete sync keys on remaining items
ContentValues cv = new ContentValues();
// Delete account sync key.
final ContentValues cv = new ContentValues();
cv.putNull(Account.SYNC_KEY);
resolver.update(Account.CONTENT_URI, cv, Account.ID_SELECTION, accountIdArgs);
cv.clear();
cv.putNull(Mailbox.SYNC_KEY);
resolver.update(Mailbox.CONTENT_URI, cv,
MAILBOXES_FOR_ACCOUNT_SELECTION, accountIdArgs);
// Delete PIM data (contacts, calendar), stop syncs, etc. if applicable
IEmailService service = EmailServiceUtils.getServiceForAccount(context, null, accountId);

View File

@ -398,10 +398,6 @@ public class ControllerProviderOpsTests extends ProviderTestCase2<EmailProvider>
long box1Id = box1.mId;
Mailbox box2 = ProviderTestUtils.setupMailbox("box2", account1Id, true, mProviderContext);
long box2Id = box2.mId;
// An EAS account mailbox
Mailbox eas = ProviderTestUtils.setupMailbox("eas", account1Id, false, mProviderContext);
eas.mType = Mailbox.TYPE_EAS_ACCOUNT_MAILBOX;
eas.save(mProviderContext);
Account account2 = ProviderTestUtils.setupAccount("wipe-synced-2", false, mProviderContext);
account2.mSyncKey = "account-2-sync-key";
@ -435,7 +431,6 @@ public class ControllerProviderOpsTests extends ProviderTestCase2<EmailProvider>
// Confirm: Mailboxes gone (except account box), all messages gone, account survives
assertNull(Mailbox.restoreMailboxWithId(mProviderContext, box1Id));
assertNull(Mailbox.restoreMailboxWithId(mProviderContext, box2Id));
assertNotNull(Mailbox.restoreMailboxWithId(mProviderContext, eas.mId));
assertNull(Message.restoreMessageWithId(mProviderContext, message1Id));
assertNull(Message.restoreMessageWithId(mProviderContext, message2Id));
account1 = Account.restoreAccountWithId(mProviderContext, account1Id);