Remove references to account mailbox.
Exchange implementation no longer uses them. Change-Id: I221a914f2428c0c7989f79392ca82f7a8f4b1c52
This commit is contained in:
parent
e1f0169419
commit
aa0ca16a27
|
@ -180,6 +180,7 @@ public class Mailbox extends EmailContent implements MailboxColumns, Parcelable
|
||||||
public static final int TYPE_CALENDAR = 0x41;
|
public static final int TYPE_CALENDAR = 0x41;
|
||||||
public static final int TYPE_CONTACTS = 0x42;
|
public static final int TYPE_CONTACTS = 0x42;
|
||||||
public static final int TYPE_TASKS = 0x43;
|
public static final int TYPE_TASKS = 0x43;
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_EAS_ACCOUNT_MAILBOX = 0x44;
|
public static final int TYPE_EAS_ACCOUNT_MAILBOX = 0x44;
|
||||||
public static final int TYPE_UNKNOWN = 0x45;
|
public static final int TYPE_UNKNOWN = 0x45;
|
||||||
|
|
||||||
|
|
|
@ -142,8 +142,9 @@ public final class DBHelper {
|
||||||
// Version 109: Migrate the account so they have the correct account manager types
|
// 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
|
// Version 110: Stop updating message_count, don't use auto lookback, and don't use
|
||||||
// ping/push_hold sync states.
|
// 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.
|
// Any changes to the database format *must* include update-in-place code.
|
||||||
// Original version: 2
|
// Original version: 2
|
||||||
|
@ -1043,6 +1044,11 @@ public final class DBHelper {
|
||||||
db.execSQL("update " + Mailbox.TABLE_NAME + " set " + MailboxColumns.SYNC_LOOKBACK
|
db.execSQL("update " + Mailbox.TABLE_NAME + " set " + MailboxColumns.SYNC_LOOKBACK
|
||||||
+ "=null where " + MailboxColumns.SYNC_LOOKBACK + "<"
|
+ "=null where " + MailboxColumns.SYNC_LOOKBACK + "<"
|
||||||
+ SyncWindow.SYNC_WINDOW_1_DAY);
|
+ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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_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
|
* Delete an account and clean it up
|
||||||
|
@ -4472,24 +4468,15 @@ public class EmailProvider extends ContentProvider {
|
||||||
// Delete synced attachments
|
// Delete synced attachments
|
||||||
AttachmentUtilities.deleteAllAccountAttachmentFiles(context, accountId);
|
AttachmentUtilities.deleteAllAccountAttachmentFiles(context, accountId);
|
||||||
|
|
||||||
// Delete synced email, leaving only an empty inbox. We do this in two phases:
|
// Delete all mailboxes.
|
||||||
// 1. Delete all non-inbox mailboxes (which will delete all of their messages)
|
|
||||||
// 2. Delete all remaining messages (which will be the inbox messages)
|
|
||||||
ContentResolver resolver = context.getContentResolver();
|
ContentResolver resolver = context.getContentResolver();
|
||||||
String[] accountIdArgs = new String[] { Long.toString(accountId) };
|
String[] accountIdArgs = new String[] { Long.toString(accountId) };
|
||||||
resolver.delete(Mailbox.CONTENT_URI,
|
resolver.delete(Mailbox.CONTENT_URI, MAILBOXES_FOR_ACCOUNT_SELECTION, accountIdArgs);
|
||||||
MAILBOXES_FOR_ACCOUNT_EXCEPT_ACCOUNT_MAILBOX_SELECTION,
|
|
||||||
accountIdArgs);
|
|
||||||
resolver.delete(Message.CONTENT_URI, MESSAGES_FOR_ACCOUNT_SELECTION, accountIdArgs);
|
|
||||||
|
|
||||||
// Delete sync keys on remaining items
|
// Delete account sync key.
|
||||||
ContentValues cv = new ContentValues();
|
final ContentValues cv = new ContentValues();
|
||||||
cv.putNull(Account.SYNC_KEY);
|
cv.putNull(Account.SYNC_KEY);
|
||||||
resolver.update(Account.CONTENT_URI, cv, Account.ID_SELECTION, accountIdArgs);
|
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
|
// Delete PIM data (contacts, calendar), stop syncs, etc. if applicable
|
||||||
IEmailService service = EmailServiceUtils.getServiceForAccount(context, null, accountId);
|
IEmailService service = EmailServiceUtils.getServiceForAccount(context, null, accountId);
|
||||||
|
|
|
@ -398,10 +398,6 @@ public class ControllerProviderOpsTests extends ProviderTestCase2<EmailProvider>
|
||||||
long box1Id = box1.mId;
|
long box1Id = box1.mId;
|
||||||
Mailbox box2 = ProviderTestUtils.setupMailbox("box2", account1Id, true, mProviderContext);
|
Mailbox box2 = ProviderTestUtils.setupMailbox("box2", account1Id, true, mProviderContext);
|
||||||
long box2Id = box2.mId;
|
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);
|
Account account2 = ProviderTestUtils.setupAccount("wipe-synced-2", false, mProviderContext);
|
||||||
account2.mSyncKey = "account-2-sync-key";
|
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
|
// Confirm: Mailboxes gone (except account box), all messages gone, account survives
|
||||||
assertNull(Mailbox.restoreMailboxWithId(mProviderContext, box1Id));
|
assertNull(Mailbox.restoreMailboxWithId(mProviderContext, box1Id));
|
||||||
assertNull(Mailbox.restoreMailboxWithId(mProviderContext, box2Id));
|
assertNull(Mailbox.restoreMailboxWithId(mProviderContext, box2Id));
|
||||||
assertNotNull(Mailbox.restoreMailboxWithId(mProviderContext, eas.mId));
|
|
||||||
assertNull(Message.restoreMessageWithId(mProviderContext, message1Id));
|
assertNull(Message.restoreMessageWithId(mProviderContext, message1Id));
|
||||||
assertNull(Message.restoreMessageWithId(mProviderContext, message2Id));
|
assertNull(Message.restoreMessageWithId(mProviderContext, message2Id));
|
||||||
account1 = Account.restoreAccountWithId(mProviderContext, account1Id);
|
account1 = Account.restoreAccountWithId(mProviderContext, account1Id);
|
||||||
|
|
Loading…
Reference in New Issue