Commit Graph

325 Commits

Author SHA1 Message Date
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
Paul Westbrook 532bcf4a52 Catch exception in monkey runs
Bug: 6929910
Change-Id: I1d1703282af66bcba7e77277b8ea663fdebcc251
2012-08-07 11:01:02 -07:00
Marc Blank 970fe5316b Progress updates for POP3 message downloads
* Also, handle MessagingException when doing STAT

Change-Id: I5267b64f18a84fcc97fc2d003e49d4e373ea02c5
2012-08-03 17:03:25 -07:00
Marc Blank 7f7f7e6402 Handle server deletion of local POP deletions
* Also avoid looping through zillions of messages when
  checking uid's
* Always have 25 (or whatever the visible limit) messages
  loaded

Change-Id: Ib2f02a59cc438e3fd14d7ac607fb01d9a5fa5282
2012-08-02 20:06:38 -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 7d5e2a7c08 Do "same certificate" checking when using "trust certificates"
* Refactor/simplify Transport/MailTransport
* Add serverCert column to HostAuth table in EmailProvider
* During first connection to server, save the server certificate
  in the HostAuth; on subsequent connections, ensure that the
  certificate presented has the same public key as the one
  stored
* For now, we'll just fail to connect (with a CertificateException)
  if there's a mismatch

TODO: Add some UI to handle different certificates

Bug: 6888866
Change-Id: Ia79497e89eaad8d43617b50d3771121b2ed7f687
2012-08-01 09:04:44 -07:00
Marc Blank a8b683cf3f More work on Imap2
* Handle sending mail and moving to sent folder
* Implement picker for sent folder
* Upload sent items to server
* Add support for "automatic" sync window
* Move some files from Email -> emailcommon
* The added files are copied directly from Email (and can be
  removed if/when Imap2 is merged back with Email)

Change-Id: I3a6a3d224826e547748be2f1b567b6294ad5db89
2012-07-19 14:27:17 -07:00
Marc Blank c6089bc01f Initial Imap2 implementation
This CL includes the following:
* New Imap2.apk generation (not included in builds)
* "Push IMAP" option for accounts when Imap2.apk present
* Account creation/setup
* 2-way sync of messages, deletions, flag updates
* Push (messages, flags)
* Folder list hierarchy handling
* Message text (one plain or html part)
* Picker UI for trash folder (placeholder)
* Capabilities handling/UI command

Major Imap2 new features:
* Push
* Multiple folder sync
* Sync window (like EAS)

TODO:
* Picker UI for sent folder
* Upload of sent messages to server
* Search
* Multiple viewable parts
* Probably lots more, incl. unit tests

Change-Id: Ia5d74073d9c307e0bdae72a7f76b27140dde7d14
2012-07-18 11:32:26 -07:00
Marc Blank f419287f22 DO NOT MERGE: Move emailcommon2 sources to emailcommon
Change-Id: I06df7e467cd2e0117df8b8db3ddc6ff9da13f1c7
2012-06-28 11:15:06 -07:00
Misha Nasledov c31e2555bf Fix STARTTLS handshake error in Email's SmtpSender class
The Email.apk checks for "-STARTTLS" in the SMTP server's EHLO response
but SMTP servers may respond with STARTTLS on the last line as such:

250 STARTTLS

Or even as part of a line as such:

250-XSECURITY=NONE,STARTTLS

Checking for "-STARTTLS" in this case will break. The fix is to simply check
for "STARTTLS" instead.

See http://code.google.com/p/android/issues/detail?id=19109
And http://code.google.com/p/android/issues/detail?id=2309

Change-Id: I3a590a4398cb664f46875650550986a67f320f76
2012-02-29 03:15:10 -08:00
Marc Blank dceb2884ea Reduce max in-memory size of IMAP text from 16MB to 2MB
* Even 2MB is probably high, but it's far better than 16MB

Bug: 5573863
Change-Id: I00d6d84ebc538d41dbf5683bd078a6bcd802e584
2011-11-14 16:53:48 -08:00
Marc Blank 3285fb3cfd Prevent NPE with badly-timed account deletion
Bug: 5473621
Change-Id: I0956540de0de172bc3519a301598e197b449b9a8
2011-10-18 13:27:30 -07:00
Ben Komalo 2c57e7036d Fix upgrade code.
In HC MR2 we introduced a column for a parentKey, but AFAICT, did not
use it. It was populated with a null value. The first upgrade code in
ICS assumed it was '0' which failed to upgrade it properly.

This prevents IMAP accounts from being broken when upgrading from GB ->
ICS.

Bug: 5252620
Change-Id: I000253b7c02ac1706710bdb21a820293f09cbea5
2011-09-13 17:18:34 -07:00
Marc Blank 20bf1f632f Support IMAP search in UTF-8, in addition to US-ASCII
* The existing IMAP search code is well-known to be primitive and
  largely broken.  In particular, it fails with any non-ASCII
  character and with a variety of symbols (e.g. quotes, slashes,
  etc.)  Basically, it's an accident waiting to happen, returning
  empty data sets even when the query might reasonably be expected
  (or known) to return valid data.
* The current CL uses the IMAP literal string format to represent
  the query text; this string can be sent either in ascii or in
  UTF-8, and since it is sent as an octet (byte) count followed by
  8-bit data, it also solves any quoting issues that might come
  up.  So, we kill two birds with one stone.
* The bug in question was punted to a subsequent MR; however, I
  think it would be a mistake to ship the code without this
  CL, which has been tested against the three common IMAP servers
  that we aim to support.

Bug: 4690713
Change-Id: Iaa542bfc56737871f3cbc9c83f0e768415a7f2b6
2011-08-17 16:17:04 -07:00
Marc Blank 7751b42f82 Fix SMTP validation code
* Caching Senders isn't a great idea; during validation, it causes
  the bug referenced below.  It's a small optimization anyway, so
  we'll just get rid of the cache.
* Also, remove unused code

Bug: 5144603
Change-Id: I539284dfa6d457fffd5cb011b8e1db5881249636
2011-08-10 13:38:45 -07:00
Ben Komalo e71a19a523 Build default mailboxes for POP3
Bug: 4580535
Change-Id: Ic800eed387d3e9e64e95cce691d13d98b4a48045
2011-07-17 17:48:31 -07:00
Marc Blank 53dddf3c55 Fix loss of client updates in IMAP when no connectivity
Bug: 5014965
Change-Id: Id5c6696ea1add598f180e739398ab14f60e382a3
2011-07-14 11:04:05 -07:00
Ben Komalo 3cfb3d5077 Remove dead code
Change-Id: I66bec3975b3f028081071b9bbd26206ec369da26
2011-07-12 20:42:16 -07:00
Ben Komalo b0a14e4f1a Merge "SmtpSender: Send EHLO that adheres to RFC2821" 2011-07-11 09:01:53 -07:00
Marc Blank 50a092c3d6 Add IMAP support for the "replied" state in messages
* Handle replied in new messages and updates
* Code added for upsyncing replied state, but the CL for
  setting this state isn't yet submitted

Change-Id: I6f3ff56475d70f686f96ed6a84fae3468f42b1c8
2011-07-07 12:00:07 -07:00
Jon Starling ea11bfd6fc SmtpSender: Send EHLO that adheres to RFC2821
Adhere to RFC2821 Sec. 4.1.3 Address Literals should be enclosed by brackets and
prefixed with 'IPv6:' if the sender is an IPv6 host

Original author: Jon Starling

Bug: 4207470
Change-Id: Id327930001188186713e38d1ce8ecc1dad8cfbc0
2011-07-05 12:50:34 -07:00
Makoto Onuki 745b33b8ff Fix all NoSuchMethodErrors
Change-Id: I05adf2b99c819d6aa2d3b52c52a8c655d9307337
2011-07-01 12:44:27 -07:00
Marc Blank 569785b4f9 Oops; fix NPE
Bug: 4977755

Change-Id: I117eb3a061628ee572f37123631c3da301b5e50b
2011-06-29 17:50:23 -07:00
Marc Blank 0b8e04c84d More Store cleanup
Change-Id: I8f542175b4468c7a320322a57bfdaf19a7320165
2011-06-29 15:22:05 -07:00
Marc Blank 6fea021e3d Remove redundant and unused constants
Change-Id: Ie8658f86737880e3127a0a2c3b7f0557dde98b29
2011-06-29 14:30:46 -07:00
Marc Blank 244d306ebb Remove more useless code
* Strike another blow for sanity!

Change-Id: Id95b441f9577abda66f04113793d6b1c60500ebe
2011-06-29 14:07:25 -07:00
Marc Blank 77160c8c08 Merge "Don't cache ImapFolders" 2011-06-29 13:34:44 -07:00
Marc Blank 2720a818d5 Don't cache ImapFolders
* ImapFolder is currently very unsafe for use by multiple threads,
  causing, among other things, the referenced bug
* Since ImapFolder is very lightweight, there's no particularly good
  reason to be caching them anyway
* Rename isOpenForTest to isOpen

Bug: 4972084
Change-Id: I2bf17b9cfc8549a222e991f3e59abfd00a4d3afd
2011-06-29 13:02:55 -07:00
Marc Blank 35b0e95ca7 Clean up Store implementation
* Remove unused argument from newInstance/constructor
* Create ServiceStore class, the superclass of ExchangeStore (and,
  eventually, all Stores, until they can go away completely)

Change-Id: Ic5237236c5349ecf006538c58b63c1efe8e4ea61
2011-06-29 12:50:43 -07:00
Marc Blank 66a47b8dac Clean up/simplify ExchangeUtils/ExchangeStore
* Rename ExchangeUtils to EmailServiceUtils
* Create calls for Exchange to use (eventually remove these)
* Get rid of lots of nonsense in ExchangeStore

Change-Id: Ic538cfe1de57eca24088ee1f590264283d12f511
2011-06-27 12:14:04 -07:00
Marc Blank 9a01353f14 New search implementation for IMAP in MessagingController
* Add protocolSearchInfo column to Message table; this can be used
  to store information related to search results.  For IMAP, we
  store the serverId of the mailbox that the message lives in on
  the server
* Add upgrade code for this column
* Change MessagingController to use the proper serverId for remote
  operations, depending on whether the Message is a search result
  or not
* Fix some smaller issues with earlier code

Change-Id: I0c7f1d89a4659b95701d02646c0e8426680e2f6a
2011-06-23 22:02:00 -07:00
Marc Blank 627bc6ed57 First implementation of IMAP search
* Broke up synchronizeMailboxGeneric into three pieces; it's still
  horrible, but this at least stops my eyes from bleeding
* Remove unused method/tests from Folder interface

Change-Id: Ib4d979536be657137cf70ca535cf429d707be41b
2011-06-16 20:26:52 -07:00
Marc Blank f65bdbdaf5 Fix Store caching
Bug: 4671090
Change-Id: I07413eb713c564f6dbcac45091357153cfe19a5d
2011-06-16 09:24:44 -07:00
Ben Komalo 22409fcffa Pass HostAuth when validating an account.
Since HostAuth is fully Parcelable, no sense passing the individual
fields.

Change-Id: I4d8fd2bbe7b47e8f1e2ff00c8c0cad8429eec159
2011-06-14 14:47:18 -07:00
Marc Blank f5418f1f93 Move Account into its own top-level class
Change-Id: Ide7c991b7d4d418dbe17164421425bf898ba64ee
2011-06-13 15:37:22 -07:00
Marc Blank 85e4c101b0 Remove storeUri's except during auto-setup
* Remove per-store limitations
* Use constants for VISIBLE_WINDOW, rather than having the
  potential for differences between Stores

Change-Id: Idd5e0874bba6e3390e4f093bcb03f4b1bb399c11
2011-06-09 13:34:43 -07:00
Ben Komalo 313586c8eb Introduce client cert alias for HostAuth.
Some email servers require client certificates to be presented to
establish an SSL connection. While this certificate will be maintained
by the system key store, we need to store the "alias" of the certificate
stored in that system store.

Wiring up to use the actual alias will be done in future CL's. It is
currently unused.

Change-Id: I8d1290151342daea9ceb0df8a4088405b44faa81
2011-06-07 18:48:23 -07:00
Ben Komalo 12b82d9374 Move HostAuth to top level class.
No other changes made.

Change-Id: I1c6497c98abc0f99443ea42d8aed6295b263c123
2011-05-19 15:28:48 -07:00
Todd Kennedy e07ecb8864 Fix display of POP3 mailbox
When legacy support for mailboxes with a parent key of '0' was removed, the
parent key for POP3 mailboxes was not updated. This forces the parent key
for all POP3 mailboxes to be "no mailbox". If we ever want to support virtual
mailboxes for POP3 accounts, this will need to be adjusted.

Change-Id: I4ae0e386db4bcdaf559b87ca17cbe0d151dea75b
2011-05-17 14:18:40 -07:00
Todd Kennedy 518fc490b2 Fix bug where we fail to acknowledge an APPEND
After appending a message to a mailbox (i.e. like appending to the 'sent'
mailbox after composing a new message), we would try to determine if the
append was successful by searching for the message. Most servers return an
APPENDUID response with the message's new UID. However, on those that don't
support APPENDUID, we need to perform a SEARCH for the message id. On one
set of these servers, the search would fail if the query string was
surrounded by parenthesis. However, another set of servers will fail if the
query string is not surroudned by parenthesis. So, we now try both ways.

Change-Id: I5a82ad241fb927e28aa5d05376568d5eac266a95
2011-05-17 10:43:46 -07:00
Todd Kennedy 581e3c2333 Fix Store re-using old data
The key for the Store cache was not adjusting properly for account
changes (such as port changes, etc...). As such, it was possible to
get an invalid store.

Now, there's problem with leaking Account objects if the store account
changes (see bug 4440839). This is "okay" for now since account changes
are fairly uncommon and Account objects are light. However, this should
be fixed at some point.

Change-Id: I4ddcbc3e2759b7b1374d0300706373678dedec94
2011-05-17 08:48:33 -07:00
Todd Kennedy 171c3f2273 Some more re-arrangement of code
No real code changes; just moving where code / constants live. Removed
one unused method of Store.

Change-Id: Ie7532381759a568cb23601e1071c8e199b6beb07
2011-05-16 14:47:49 -07:00
Todd Kennedy ebece4dbdc Make ImapConnect a top-level class
Split out ImapConnection to its own class. This allows us to update ImapStore
without worrying about links between it and the connection.

Also, added a bit more safety to the classes in terms of correctly freeing
resources. Whenever the connection is closed, it now releases all resources.
Additionally, if the connection is ever put back in the pool, any response
data is released.

Change-Id: Ie3bda40d677707a0d6655f57175e58dece539e19
2011-05-16 14:17:58 -07:00
Ben Komalo 53ea83ebf9 Move Mailbox to top level class.
No other changes made.

Change-Id: I3d8f3c521dc0d902be313b25252b4b6a4a96e7ee
2011-05-13 17:42:02 -07:00
Makoto Onuki bfac9f2e8a Move some of the log constants from Email to Logging
Change-Id: If9f4e4e3adcdef897a0d6a4e153bb446a8b24fdd
2011-05-13 14:24:38 -07:00
Todd Kennedy c4cdb11d24 Remove notification if messages seen off device
If we receive new messages, we may display a notification to the user. If
those same messages are read elsewhere (i.e. via a web client), we will
remove the notification.

Change-Id: Iba09afe01942e0deaac8210fd6f9b315b1c8c93f
2011-05-05 12:00:27 -07:00
Todd Kennedy e87ff6c3cb Opportunistic cleanup
not making any real code changes:
* removed deprecated, unused methods
* remove 'throws' clauses when that exception is never thrown
* renamed method Controller#moveMessage()-->moveMessages()

Change-Id: Ifd006f760f0c19283e94a11a45c71295c8da35f7
2011-04-27 12:01:04 -07:00
Todd Kennedy 019341af98 Set mailbox flags for message contents
For IMAP, it's possible for a mailbox to exist on the server, but, to be
unselectable. Previously, these folders were never added to the folder list.
However, with nested folder support, we need to have these folders in the
UX so the user can get to its sub-folders (which may be selectable).

Change-Id: I11135fafbb14b40660983804fb86bd223e180d5e
2011-04-27 09:10:30 -07:00
Todd Kennedy 22208771b7 Add hierarchical folders to IMAP
We now create folder hierarcies for IMAP. This also includes a nifty SQL
statement that will get your existing database into shape.

Change-Id: If07a0632e9b250cf0c33c3e16bfba5816beab94c
2011-04-25 15:11:38 -07:00
Ben Komalo 1611d0baed Make ImapStore tests use mocks where possible
Change-Id: I2a1d5e7d3cc3b105a24a5fc29772bcd4a0308ad3
2011-04-25 16:50:37 -04:00