Commit Graph

14244 Commits

Author SHA1 Message Date
Michael Bestas
ead5cd372c Automatic translation import
Change-Id: I432e8ba78567048f45c939b15032ca96902353b2
2015-10-18 14:06:01 -07:00
Michael Bestas
5798905bd2 Automatic translation import
Change-Id: I10b18c7f8674660d0ec1081c316361da49c434a8
2015-10-18 14:06:01 -07:00
Tom Powell
47301c4d54 Automatic translation import
Change-Id: I3788414aaa622ea6a9fb1bdd496314ba2ccfb4e7
2015-10-18 14:06:01 -07:00
Tom Powell
f5e0be5091 Automatic translation import
Change-Id: I62f9837f18625f827ff3ed1df3eb1574c7d64da1
2015-10-18 14:06:01 -07:00
Tom Powell
3ac9b69c53 Automatic translation import
Change-Id: I099dc2db2e4f1db8b3e8cc95d606108e9206ea77
2015-10-18 14:06:01 -07:00
Michael Bestas
dc3b9f8340 Automatic translation import
Change-Id: I27808a9f2c08b848bcf44b07cbf3c8e0aeee7500
2015-10-18 14:06:01 -07:00
Michael Bestas
9bec316ecd Automatic translation import
Change-Id: I08bd531f3bfaab3feb3ee72ea0eaadeb657eb5a1
2015-10-18 14:06:01 -07:00
Michael Bestas
d6eb8adcdc Automatic translation import
Change-Id: I851a2a39059f7db6b773515475e9001a0b90806c
2015-10-18 14:06:01 -07:00
Michael Bestas
94dcf047d0 Automatic translation import
Change-Id: I976db98cec4a120d7d9bb9810c0e0dd597bf9f8c
2015-10-18 14:06:01 -07:00
Danny Baumann
a9aaccb8f6 Allow saving attachments even if there's no intent handling them.
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
2015-10-18 14:06:01 -07:00
Danny Baumann
39e1c44e7c Allow download of compressed attachments.
Assuming all compressed files are malware is a little extreme.

Change-Id: I0ef776f3ad4af1fb73199989c99ab05171353d17
2015-10-18 14:06:01 -07:00
Michael Bestas
fe527522cf Automatic translation import
Change-Id: If61323bf1d0cdbdff1ad6f090b24debc96a2213a
2015-10-18 14:06:01 -07:00
Danny Baumann
a73579b5b3 Don't cancel PendingIntents used for AlarmManager.
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
2015-10-18 14:06:01 -07:00
Danny Baumann
99c6d7b40a Optimize connection loss and re-gain behaviour.
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
2015-10-18 14:06:01 -07:00
Danny Baumann
a0ef884d04 Refine thread handling.
Remove mailboxes from the list synchronously and just do the network I/O
and thread joins in the background.

Change-Id: I2a339e5982c103b69f1212627f1cc98e98a8a068
2015-10-18 14:06:01 -07:00
Danny Baumann
c96099279b Properly unregister alarm manager callbacks.
Change-Id: I2d474bc1cee168a5b76b8710b382498cd6c2fd59
2015-10-18 14:06:01 -07:00
Danny Baumann
a7bc7d8572 Use AlarmManager to schedule an IDLE connection restart.
We also want to restart it during sleep.

Change-Id: Ib2c26e06fb923487b10d94edc1bbd743ebb39fb1
2015-10-18 14:06:01 -07:00
Danny Baumann
739281a727 Don't auto-register IDLE when gaining connection.
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
2015-10-18 14:05:32 -07:00
Danny Baumann
cb4fda8286 Do less work on IDLE refresh.
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
2015-10-18 14:05:32 -07:00
Danny Baumann
9e42c23d4c Improve debug logging.
Change-Id: I13a99d5caadcc7bd2682791527f71a697d07f8d0
2015-10-18 14:05:32 -07:00
Michael Bestas
fff063d6d9 Automatic translation import
Change-Id: I47a88655494be6161c944d96532534d1c2ac1ad2
2015-10-18 14:05:32 -07:00
Danny Baumann
624321751a Use an inexact timer for the IDLE refresh.
Also use a wakeup timer, as we can't rely on the screen being turned on
at refresh time.

Change-Id: If64c164fd151c63404d0d63d9c463556cc3d0658
2015-10-18 14:05:32 -07:00
Danny Baumann
59553089b9 Don't throw a NPE when operating on a destroyed list.
Change-Id: Ie4ca1fdd55031efa56448bf0237d0edab51ea349
2015-10-18 14:05:32 -07:00
Danny Baumann
03f09f6450 Fix some more argument order issues.
Change-Id: I1ea17a0fba4ff3af03ee8c0acbe9967bed92aae1
2015-10-18 14:05:32 -07:00
Danny Baumann
b9532055e2 Simplify logic.
Make sure that either messages are fetched or a sync is initiated, and
there can be no situation where neither happens.

Change-Id: I73ec2482a5a86c54309634f434b7d8fd77d7c079
2015-10-18 14:05:32 -07:00
Danny Baumann
c59103c933 Fix some typos.
Change-Id: Idd3018a03023efe02c3bcf40b44c8f5a5e304436
2015-10-18 14:05:32 -07:00
Danny Baumann
006ea81b71 Don't solely rely on the presence of RECENT for checking for new mail.
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
2015-10-18 14:05:32 -07:00
Danny Baumann
d13071399f Don't re-sync when refreshing the IDLE connection.
The refreshing (done every 25 minutes) should be a cheap operation.
Instead, do a (quick) re-sync after idling failed.

Change-Id: Idfcc775417dc02417142e51ca546c9564c660aab
2015-10-18 14:05:32 -07:00
Danny Baumann
3e3b7b77b6 Fix crash when attempting to view EML files.
Use the correct, AppCompat based, theme.

Change-Id: Ib8e72f781a69cadb738a5783371253b8bba328e7
2015-10-18 14:05:32 -07:00
Danny Baumann
fd42df6fc0 Reset idling flag when cancelling early due to being cancelled.
Change-Id: Idde5f3a3fa04a1aa80ef4cdb9e3ba1ab01d3fcb5
2015-10-18 14:05:32 -07:00
Danny Baumann
cd69d44da0 Add some debug statements.
Change-Id: I9295bedb5b7908c8ee873285c255816373d2c602
2015-10-18 14:05:32 -07:00
Danny Baumann
36f18be31c Assign debug tags to IMAP communication output.
Allows better tracking of the output if multiple connections are active.

Change-Id: I900c9f9ecda06d3191c4cf82af7e774ae70b7dac
2015-10-18 14:05:32 -07:00
Danny Baumann
e680bf0ddc Fix argument order.
Change-Id: I087937c1323cfa1fd3d5400ef0a69d7476e36d20
2015-10-18 14:05:32 -07:00
Danny Baumann
f364a9b70d Simplify code.
Change-Id: I6c783afb9c436a35176134bfe7ae5264f2255b2f
2015-10-18 14:05:32 -07:00
Michael Bestas
293eb14692 Automatic translation import
Change-Id: If5410fff5db8cc70779e4523cc1483c3416c5256
2015-10-18 14:05:32 -07:00
Jorge Ruesga
377660c356 email: catch the correct exception while closing the buffers
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>
2015-10-18 14:05:32 -07:00
Danny Baumann
0672de3149 Fix ArrayIndexOutOfBoundsException.
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
2015-10-18 14:05:32 -07:00
Jorge Ruesga
96a2b55e39 email: fix NPE
Fix possible NPE when protocol don't offers offerLookback (pop3)

Change-Id: Id924e06e691d0ed99179fcd37fd213ac379340fd
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:05:32 -07:00
Michael Bestas
e76717497d Automatic translation import
Change-Id: I3579d02a37301a73d65b27173e2b376046251641
2015-10-18 14:05:32 -07:00
Scott Mertz
7f1a3b1f12 EmailTests: fix api change
Change-Id: I170478bb91d847ba9d42515c5d5c29a92f3765dc
2015-10-18 14:05:32 -07:00
Jorge Ruesga
dcdf4ab236 email: fix tests
Change-Id: I237337c0c86ad66023db684c8a01c89ee1ef7aef
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:05:32 -07:00
Jorge Ruesga
aea3dff32d email: fix Exchange sync frequency account setup
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>
2015-10-18 14:05:32 -07:00
Michael Bestas
15cc6ebeec Automatic translation import
Change-Id: I302532a0d88f6cf8a5987ab52738cfd24a736777
2015-10-18 14:05:32 -07:00
Jorge Ruesga
08ace26ed6 email: imap push
Change-Id: I8a184a5644e4322ee65d969e14cd47fe119f5df2
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:05:32 -07:00
Michael Bestas
3b1b30873e Automatic translation import
Change-Id: I906df0fcdea123d5278c0de34a1cca4c0c9625eb
2015-10-18 14:03:26 -07:00
Michael Bestas
aacad23dbc Automatic translation import
Change-Id: I1a364a4b794a8228155dc1dbb8758eed15ac4ea5
2015-10-18 14:03:26 -07:00
Jorge Ruesga
087a0406a3 email: fix Account table creation
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>
2015-10-18 14:03:25 -07:00
Jorge Ruesga
a2d99c6fea email: custom notification lights
Change-Id: I3aaed3c682ae33da925316a5b9a586796fe71229
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:03:25 -07:00
Michael Bestas
e1c6510f32 Automatic translation import
Change-Id: Id354731aa653029aa9cce6f75489559f2c9bbaf7
2015-10-18 14:03:25 -07:00
Jorge Ruesga
e0a547bb66 email: fix eas autodiscover
Change-Id: Ifaf5f757f7f844e49f0ac635b477fcbef4926293
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:03:24 -07:00