For e.g. compressed files that doesn't mean they can't be opened, as
they still can be unpacked by the file manager.
Change-Id: I53c80b7bedb44732bc1cf346a83c1f6e39fb0da0
Creating new ones (which is the implicit effect of FLAG_CANCEL_CURRENT)
causes PendingIntent.equals() to return false for the new and the old
instance, which in turn leads to AlarmManager failing to remove the
alarm.
Also remove the unneeded request code offsets. The intent actions for
the various actions are already distinct, so we need to only identify
between the intents that have the same actions; using the mailbox ID as
request code is sufficient for that purpose.
Change-Id: I9030c24a9c6b1c722b246601fde741f7027d3de7
Schedule the ping restart through AlarmManager to be able to cancel it
properly on connection loss, and make sure to only restart idle
connections that aren't already idling (which may happen e.g. on bootup
or if there was a sync request in the 30 second wait window).
Change-Id: If62ffa0981a7a0a71ed7764a9724c07466c6d8a3
Remove mailboxes from the list synchronously and just do the network I/O
and thread joins in the background.
Change-Id: I2a339e5982c103b69f1212627f1cc98e98a8a068
We request a sync in this case anyway, which in turn starts the IDLE
connection anyway. If we're starting IDLE earlier, we do unnecessary
work as the sync will tear it down just a few moments later.
Change-Id: I9b99023fbe1aaab72638f6ef9d29223d9a325b7b
Don't do a full reconnection, but just a stopIdling/startIdling pair. In
order to be able to do that, make sure the IDLE connection is fully shut
down when stopIdling() returns, for which some refactoring was needed to
avoid a deadlock on mIdledFolders: the ImapIdleListener callbacks
acquire this lock, so stopIdling() now MUST NOT be called with
mIdledFolders lock held.
Change-Id: Ifa1677d7845722ccee2b1b9380c7b7e4014bcd97
Make sure that either messages are fetched or a sync is initiated, and
there can be no situation where neither happens.
Change-Id: I73ec2482a5a86c54309634f434b7d8fd77d7c079
It may happen (depending on server and/or timing) that only an EXISTS
response is sent to the IDLE connection when new mail arrives. Don't
discard that response, but evaluate it to determine whether there's new
mail by checking whether the message count increased.
Change-Id: Ia49714e6cd42dd71dfda8b7bbdf1fd622972edda
The refreshing (done every 25 minutes) should be a cheap operation.
Instead, do a (quick) re-sync after idling failed.
Change-Id: Idfcc775417dc02417142e51ca546c9564c660aab
BinaryTempFileBody#getBody()#getInputStream() returns a
MessagingException not an IOException. This causes
"com.android.emailcommon.mail.MessagingException: Unable to open body"
exception messages and attachment messages not flagged as loaded.
Change-Id: Ia8f25dd0a212ce52e3dd202c523c5db4a009604f
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
This crash happens when the server isn't able to resolve the MSN:
FATAL EXCEPTION: IdleReader 3:Inbox
Process: com.android.email, PID: 3200
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at com.android.email.mail.store.ImapFolder.extractImapChanges(ImapFolder.java:1641)
at com.android.email.mail.store.ImapFolder.access$700(ImapFolder.java:77)
at com.android.email.mail.store.ImapFolder$1.run(ImapFolder.java:294)
Change-Id: I8a8c7cf3f2949630ee9db3646e5832246d69132d
Auto sync is not displayed as an option in sync frequency settings, because capabilities
aren't filled. Just ensure account capabilities are always saved.
Change-Id: I70b7ab9464a99eebf7f82726faa0fb2418e09a99
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Due to a bug in commit 44a064e5f16ddaac25f2acfc03c118f65bc48aec,
AUTO_FETCH_ATTACHMENTS column could not be available in the Account table.
Since cm12 and up doesn't use this column, we are leave as is it. In case
the feature were added, then we need to create a new exception to ensure
that the columns is re-added.
Change-Id: I1803e343dde2e841fdc99b4489a74eb08b0a8352
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>