Deletes all messages in a mailbox, resets the sync key and requests a sync.
Only supports Mail mailboxes for now.
Change-Id: Iab8c051631f38687c02a22cb80ce4f50c2d9c6f1
b/10211620
The problem here is that on app upgrade, we need to change
the types of all email accounts. To do this, we have to
create new accounts and delete the old ones. This resulted
in calendar and contacts data getting deleted.
But we were copying over the last sync keys from the old
account, so on the next sync, we would only get new data.
This means that all of the data that we had gotten on
a previous sync would never be sent again, so calendar
events and contacts would be missing forever.
Now, we just don't migrate the old sync keys. This means
that on the next sync, we'll get all data, and restore
our original state.
This is still not ideal, because it means that any locally
created data that has not yet been synced will be lost
(b/10805685), but it's much better than it was.
Change-Id: I150c4dbdf490a8f3880261e2469795896ebfeab5
b/10602459
It was possible to turn off syncing for an account in global
settings, but we'd continue displaying some sync frequency
in the in-app settings.
Now, we only display the sync frequency if sync is actually
enabled. If it's disabled we always display "never". Also,
when the user changes a sync setting, if it's set to "never",
we leave the frequency in the database as it is, but disable
sync for that account. If it's set to anything else, we store
that in the database and ensure that sync for the account is
enabled. This means we should not have any apparent disagreement
between in-app settings and global settings as to whether or
not syncing will happen.
Change-Id: I1cc54e76aafd25dc4db0f1b713e7d7cbc30bf77f
Also ignore messages without server ids for moves and
state changes.
Also cleanup to match needs of EAS upsync.
Bug: 10678136
Change-Id: Id4d5229b8479e61bd718b707b0d2bc77a9e68046
b/10653370
This prevents NPEs if a serviec happens to still be running
when an account is deleted.
This mirrors a similar pattern in the gmail app.
Change-Id: I6fd8ae5ffe41580df0a321ec22535403e3f32eee
b/10413188
There are still several issues with attachments generally,
but this fixes the most glaring problem: We were short circuiting
in a loop that needed to populate a hash table of remote message
Ids, so not all of them would be present. The later code intended
to load attachments expected it to be fully populated.
There are still several problems, notably that if downloading
doesn't work, it just spins forever, but this fixes the first
problem.
Change-Id: I2b23dcb841edabe108096933fea2350ef61a10f1