Commit Graph

45 Commits

Author SHA1 Message Date
Anthony Lee 3d16e5d4b9 Move over to the new AttachmentService.
Change-Id: I4a687b003884ea6a92a755fcbf394001bfc96a38
2014-06-25 09:56:29 -07:00
Martin Hibdon fb2a3a2f77 Update IEmailService
This is not yet finalized, but it's needed to fix push syncs
on exchange.

Change-Id: Iaff20aa0bdea9685ef6603de1f861d58fbab6ff1
2014-06-18 14:19:34 -07:00
Martin Hibdon 163323294e Change IEmailService.sync to have two different forms
Change-Id: Id8e770154d6116b02746cbdfb8c7cdc9358398de
2014-05-30 14:49:47 -07:00
Martin Hibdon c5f5a14ae9 Revert "Get rid of deleteAccountPIMData from IEmailService"
This reverts commit cf2178c4fa.

Change-Id: I9b05dd7a29a2d2edf64529ca28e2305737a43115
2014-05-21 20:41:37 +00:00
Martin Hibdon cf2178c4fa Get rid of deleteAccountPIMData from IEmailService
This doesn't need to be part of the service because the
implementation doesn't need to be different between any
of the different protocols.

Change-Id: Ifddf16dd3ccaf397029f08f6d4283d9a5630f717
2014-05-21 12:18:29 -07:00
Tony Mantler 3dd85723a1 Cleanup in EmailContent
Change-Id: Ifa251eb206779f59ea003f99395d454c7e407bc2
2014-04-14 12:54:39 -07:00
Martin Hibdon 64b4f7dcff Minor formatting change
b/13642247

Change-Id: I02e495142d8043c8749ab0bce21f4c7c1cea7a5f
2014-03-26 10:47:54 -07:00
Martin Hibdon adabb4285b Fix a NPE trying to download an attachment
b/13642247

Change-Id: I4cfb7e4a3be12fdc8b8c345c1aeabd85a729d16a
2014-03-26 10:38:51 -07:00
Yu Ping Hu 8103f960d0 Add sync to IEmailService.
This supports the EasService design.

Yes, I just removed a startSync function from this interface last month. No,
I didn't quite know at the time that I'd be adding one back. :)

Change-Id: I19d9c7838473d8982560764fdba0056cba03d132
(cherry picked from commit 4a5b11d650)
2014-03-20 00:11:36 +00:00
Anthony Lee 70cb2878d7 Changed the IEmailService interface to accept and accountId in
the loadAttachment() call. This work was necessary to support
the new EasService & EasOperation infrastructure.

Change-Id: Idd507aec999596ccd4afa5f03ff2b3c2e38a9029
(cherry picked from commit efac8255ed75d22e60036e19e7a95f8407d18ad3)
2014-03-19 23:53:28 +00:00
Yu Ping Hu 701134953e Add pushModify to IEmailService.
This call lets the service know that the push settings for an
account have changed.

Change-Id: I7ed41853df6af6762c80283a2a3510ce41551657
(cherry picked from commit 446136a2278652c627068ecddff534de1ad431ab)
2014-03-19 23:51:14 +00:00
Yu Ping Hu f679cd08d1 Delete unused functions from IEmailService.aidl.
Change-Id: I131d2d3436a50c94d664fc57c6514481d9afbc97
(cherry picked from commit 8ff6c107867bc2044ba50cad010dbf4a2e93436e)
2014-03-19 22:35:47 +00:00
Martin Hibdon 9fe8131c3f Fix a case that would leak connections if an exception happens
Change-Id: I9f50911344e04f22e15bf9ba0c95f4e1b1422923
2014-01-03 14:33:28 -08:00
Martin Hibdon ff1ee36cb5 Close Imap connections when we are done using them
Also, clean up when we create and lose track of ImapStores.
Prior to this we were creating them often, and losing track of them,
which renders useless a lot of the complex logic in ImapStore devoted
to reusing connections.

Change-Id: I771d4e46d0c1cb9b605c43d9cbae6e52f5894745
2014-01-03 14:01:04 -08:00
Martin Hibdon c86fbb5bcb Add an additional mailbox key column to message table
b/11294681
The problem is that when we try to open an attachment for a
message in search results, it fails. The reason is that part of
loading the attachment, we need to open the remote folder the
message is in. For search results, the message's mailboxKey is
the special fake "search_results" folder, which doesn't actually
exist on the server.
For this change, I've added a new column called "mainMailboxKey".
For search results, this column will be populated with the real
mailbox the message is in. It will be blank for other messages.

This is a quick and low risk fix for this bug, but it's kind
of awkward. We would prefer to do one or both of the following
some time after MR1.

1. Make the "search_results" folder be a virtual folder, the same
way that unread, starred, and other virtual folders are. For these,
there is actually no mailbox row in the database, just some
queries that check various flags in the messages and behave
like folders in the UI. The messages actually still reside in the
real folders.
2. Remove the requirement to open the folder at all to load the
attachment.

Change-Id: I825ab846f78bf8b041a5d1d579260dc5d7b4c522
2013-10-23 14:58:57 -07:00
Martin Hibdon 85d2190552 Clear all "drafts" related flags from email when sending
b/11224331

Change-Id: I1df8ea3e0e24b050cd391dea454124e06988bf7d
2013-10-14 17:42:02 -07:00
Martin Hibdon 56aba8d843 Allow multiple mailboxes to be synced in a single request
b/11103878

Change-Id: Ic6abf51457fe94e89fe51b461da4371f50e0fe86
2013-10-10 09:30:31 -07:00
Martin Hibdon 7c03217316 Add a retry backoff/limit policy to attachment download
b/11081672

Prior to this, any time the AttachmentDownloadService
got a CONNECTION_ERROR, it would just instantly retry,
without any limit on the number of tries. This is bad
if the server is in a funny state, we'll just keep spamming
it with multiple connection attempts per second. Also,
this kills the client device's battery and responsiveness.

Now, it will retry instantly five times, and then retry on a
10 second delay 5 more times. After that it will give up.

Even if it gives up, if the user visits an email with an
attachment, or taps on an attachment to expand it, we'll
start the process over. So we shouldn't have permanent
apparently data loss, even if we fail on the first 10 tries.

I'm not certain that this is the best backoff/limit policy,
maybe we should add a delay after even the first connection
error. But I'm hesitant to change this at this point, it's
possible that something is relying on this behavior and
we don't have a lot of soak time left.

Change-Id: I53d75d5d214ccca887a89cf65b799fe640cc9bc5
2013-10-09 16:32:08 -07:00
Martin Hibdon 529bdeaec1 Always close the connection after trying to load attachments
b/11081672

Change-Id: Ibe804713492b37f5579fb20a0da7292e82cb5341
2013-10-08 16:48:52 -07:00
Martin Hibdon 921c04d2ac Add some logging
Change-Id: Ib26ffad0bb6841361b8ee7be4ee2a6255d509ae2
2013-10-01 17:08:16 -07:00
Tony Mantler da42d856b8 Don't skip attachment saving if the attachment is not yet saved.
Also tidy up warnings

b/10461356

Change-Id: I65ac4c5b512cd67a39c81606391a2b044213f269
2013-09-12 11:04:49 -07:00
Yu Ping Hu eb4ee8a7aa Move required system folder types to Mailbox.
I'm formalizing the concept of folders that must exist,
and the list of such folders should be accessible to all
sync adapters.

Change-Id: I9e4d2d51aa495d211eab2d1e36c3fa197a1ac00d
2013-08-01 16:19:28 -07:00
Yu Ping Hu 2075c97f60 Delete most of IEmailServiceCallback.
The old callback mechanism is deprecated, in favor of making
calls on the ContentProvider.

Bug: 9842867

Change-Id: I65f559e593cda24456c4ffb96f785e054626dd0b
2013-07-29 20:04:42 -07:00
Yu Ping Hu afe097f318 Simplify account reconciliation.
- Rather than handle by type, do them all at once.
- Simplify when reconciliation happens.

Bug: 9056861

Change-Id: If264678c82c63090246ef8ff857c8e46f6672c85
2013-07-26 16:06:14 -07:00
Yu Ping Hu 9a1f00bee4 Change deleteAccountPIMData to take emailAddress, not id.
By the time the remote call actually runs, the account
may be deleted from the DB, so the account id is likely
useless.

Bug: 9021105
Change-Id: If28b4b8c4b5c52be35c6ff68b326c4ea28d7f7b4
2013-07-19 18:42:43 -07:00
Yu Ping Hu d5acf0bbc0 Explicitly pass a callback when loading attachments.
This is part of moving away from the explicit setCallback,
which either has race conditions or is very noisy, or both.
(Each IEmailService call that wants callbacks should just
pass the callback explicitly.)

I'm not yet changing how the services actually handle the
call. Each protocol will need to fix this on their own.

Bug: 9735207
Bug: 9842867
Change-Id: If8cf69ffe82f3544ace9e58b1db5a183f38d038a
2013-07-15 21:54:02 +00:00
Scott Kennedy 560bfadc31 Unify LogTag
There is now only one LogTag class. The static initializer of
GmailApplication (existing) and EmailApplication (new) will now set
the log tag to "Gmail" and "Email", respectively. Up until that code
is run, it will be "UnifiedEmail".

"setprop log.tag.Gmail VERBOSE" (or .Email) will trigger all logs to
be printed as long as they go through LogUtils, regardless of what tag
is used by that individual log. This lets us still turn on logging
everywhere in one command, but also lets us use more descriptive tags
(like the class name).

And since we no longer have three com.android.mail.utils.LogTag
classes, builds will be much easier.

Also, we now use LogUtils everywhere.

Change-Id: I55f1c7a66ce50ead54877a13e40256422a56dc39
2013-06-05 20:06:15 -07:00
Yu Ping Hu 9e7f5a2a33 Use system SyncManager for Exchange.
Change-Id: I77e4e75c94c532d22a28cf97e6f55f1259b8bdde
2013-04-25 14:03:00 -07:00
Yu Ping Hu 17d5bbf768 Improve mailbox sync and load more.
- Update syncTime for IMAP and POP whenever we sync.
- Change load more to simply include the delta in the RPC
  rather than using the visibleLimit column.
- Add a query to get the message count for a Mailbox.
- Refactor code for updating totalCount and determining
  the new message count when syncing.
- Remove dead code from Mailbox.
- Remove uses of visibleLimit from code.

Note that visibleLimit and messageCount in Mailbox table are
no longer useful and will be removed in a later change.

Bug: 8579767
Bug: 8523146
Change-Id: Ieb67e3b6f1c82c3b21b972c5a1e557cd75dc21db
2013-04-11 21:06:08 +00:00
Yu Ping Hu 861c5c8c9e Guard against potential NPE.
Change-Id: I379da1f478b1b1fd1e488dbeff249cc10e3d48d5
2013-03-21 19:25:14 -07:00
Yu Ping Hu 2192bf01e0 Always create system folders during sync.
Change-Id: I8ff6eb4f65d4207d7a2768c5fd837fad8cd47269
2013-03-20 15:23:51 -07:00
Yu Ping Hu 9d91dd8023 Specify correct sync extras for user-requested syncs.
BUG: 8364227
Change-Id: Icfc97c92e5ecc9c2abd83b73cf67a5e10408cede
2013-03-12 12:38:01 -07:00
Paul Westbrook 9a95253846 Cache attachments on send
Cache attachments in a email directory when sending to allow sending
to succeed when the content provider has a permission

Bug: 7381557
Change-Id: Icf9faead2048de237228625f998b42feade48978
2013-02-27 09:43:31 -08:00
Marc Blank 54347010fb Allow legacy imap to sync
* Remove old (and dangerous) constants

Bug: 7210754
Bug: 7212263

Change-Id: I6a1463a653c5c4823a96c9fbb9ca37e53a45b48a
2012-09-21 18:03:17 -07:00
Marc Blank f53490dc86 Reconcile all types of local accounts in MailService
Bug: 7078247

Change-Id: I43eb5b8a85e40217893bdc08cd839450358d07ea
2012-09-03 18:32:53 -07:00
Marc Blank e714bb9d15 Convert authorities, intents, and account manager types
* Tested ok on wiped Nexus
* Tested ok on S3
* Upgrade verified on Nexus

Change-Id: If5d4ce594f8a309cdb59589d10b1d33f3b79326c
2012-08-31 23:26:36 -07:00
Marc Blank f6db592c31 POP3 renovation
* Much, much faster
* Remove message length pass and lots of other useless code
* Create pseudo-attachment for long messages (click to download) that
  includes size (so user can determine whether it's worth it)
* Handle download of message via pseudo-attachment; real attachments
  are then created as necessary.

TODO: Add real UI with UX input (or modify existing to clean up the
loose ends)
TODO: Optimizations for loading the whole message
TODO: Get server delete working (isn't working currently anyway)

Change-Id: I31f3809fc5a2f9fd490d33cfed70d2930654e71d
2012-08-02 15:26:30 -07:00
Marc Blank c5afb16430 Add a bunch of stuff missed earlier
Change-Id: I7f707446a963912fe5786dacb5569e68db572d1c
2012-06-28 12:16:59 -07:00
Marc Blank 03cd72805d Revert to old Email app
* These are the last sources in the ICS-MR1 tree

Change-Id: Ida4651bddd92a06a518d00f3e1f275ab3a80c8ae
2012-04-25 13:58:23 -07:00
Marc Blank 824f776365 Fix up load of IMAP attachments
Change-Id: I2f55fc2c3d92eff72ebfd50ff3f782928f3a85a2
2012-03-12 09:11:46 -07:00
Marc Blank ab6321e2c4 Fix SMTP sending
Bug: 6134036
Change-Id: Id48e4bd17e7493d873d888027e68c7eb86d23198
2012-03-09 10:26:33 -08:00
Marc Blank af8f8a48ee Reconcile accounts in deleteAccountPIMData
Change-Id: Ifd17ef76e13ddcfa07c84429dca7bf19e6cbcfab
2012-03-07 08:43:08 -08:00
Marc Blank 87c84a6d96 Send sync status updates from POP3/IMAP
Change-Id: Ia1bb5d1a302d6dde8b8979e03a762d6d45ee8cd3
2012-02-22 16:27:26 -08:00
Marc Blank 9227dbbf0f Add back attachment loading callbacks for IMAP
* Remove newly unused code

Change-Id: Ifea2193deaf35734a031500c807ce9e3abd88fb1
2012-02-19 15:21:25 -08:00
Marc Blank 4f813fb129 Convert POP3 to service
* Remove MessagingController and (almost all of) MailService

Change-Id: I8953b58b237de6a71fda770f1727bd94081fec55
2012-02-16 10:27:00 -08:00