Commit Graph

193 Commits

Author SHA1 Message Date
Scott Mertz 7f1a3b1f12 EmailTests: fix api change
Change-Id: I170478bb91d847ba9d42515c5d5c29a92f3765dc
2015-10-18 14:05:32 -07:00
Tony Mantler 0c8696c2eb Fix IMAP message upsync to include attachments.
b/13138456

Change-Id: If16b619a650c640a37cb4563750a6327a5e601e6
2014-03-26 11:49:38 -07:00
Jerry Xie 3555dc03bf Add @SmallTest annotation to test classes so they get run in continuous
Change-Id: Ieb0e3af146a6668c813ff16a718221eae61e8e01
2014-02-19 20:13:59 -08:00
James Lemieux 1fa303478c Eliminate redundant methods in Address class
THIS DOES NOT CHANGE ANY EXISTING FUNCTIONALITY.

Address.pack() has been removed and all calls replaced with its synonym Address.toHeader().
Address.unpack() has been renamed to Address.fromHeader() to follow the new naming convention.

In days of yore, pack() and toHeader() used to do different things. Now they are identical and
thus one is superfluous. We have standardized on toHeader() and fromHeader().

Change-Id: Iac91c966eb6c1477f8dba0dd2ae01c84b359e539
2014-01-22 16:15:57 -08:00
Jerry Xie 7037a0bd3d Disable, suppress, remove broken and obsolete Email tests
Change-Id: Ia4dcba1c6966f23dd2a15e69324b7345aed8f944
2013-12-16 18:18:51 -08:00
Jerry Xie 17d3a29c9d Get Email units to compile
Change-Id: I171a0e2421c5006d9862ad94f886932146547020
2013-12-05 11:11:21 -08: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
Jack Bates 4fd97a3050 Fix SMTP RFC violation for better interoperability
Space after colon violates RFC 5321 (and RFC 821): "Since it has been a common
source of errors, it is worth noting that spaces are not permitted on either
side of the colon following FROM in the MAIL command or TO in the RCPT command"

Change-Id: Ie5330bf2bd01cd8f734134dadd742cf16df70d7a
Signed-off-by: Jack Bates <jack@nottheoilrig.com>

cherry-pick of https://android-review.googlesource.com/#/c/32640/
2013-04-05 13:42:13 -07:00
Ben Komalo cb1d65c478 Fix mailbox finding and unit tests.
We seemed to not properly fallback to querying the database if the cache
did not contain a mailbox of a specific type. We may want to consider
caching mailboxes related to PIM data, but for now this is a quick fix.

Also fixes unit tests.

Bug: 5019661
Change-Id: Idcac0a6f15aa7f174890ae586f478fbb8f6e05b7
2011-07-25 16:51:47 -07:00
Marc Blank 0b8e04c84d More Store cleanup
Change-Id: I8f542175b4468c7a320322a57bfdaf19a7320165
2011-06-29 15:22:05 -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 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 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
Todd Kennedy 348b2f9f11 test uid search w/ and w/o parens
some imap servers will not work if the uid command contains parenthesis, while
other imap servers will not work unless the uid command contains parethesis. we
need to verify that we send both formats.

bug 4526165

Change-Id: I04a31f06a0f0fa0f03777a22b23281af574cd549
2011-06-09 10:38:44 -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 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
Todd Kennedy 347d06015e Fix unit tests
bug: 4361079
Change-Id: I4463187e4b7b6cc6b9c9e6bce5f4c1d690f52a79
2011-04-28 17:31:53 -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
Ben Komalo d9cf94632f Fix some unit tests
- some proguard flags were stale
- some deprecated methods were legitimately stripped - kill the tests
for them

Bug: 4330508
Change-Id: I6d5c46c99d002895377f32b203844e9a6dcf0074
2011-04-25 13:38:51 -04:00
Todd Kennedy 200c6bd9fa Simplify mailbox synchronization logic
The logic is simplified by creating database rows for new mailboxes down
in Imapstore. This means that the difference between local and remote folder
lists are mailboxes that need to be deleted.

Note -- this is still not the final CL. We probably update the database too
frequently and the column values aren't updated to support nested folders.

Change-Id: Ifbe4e0cf74ba81e5b6156b452ab72c56c35235ab
2011-04-21 11:54:30 -07:00
Todd Kennedy daf869cf60 Use an Account object to create a mail sender
Instead of boiling the account down to an unusable URI, just pass along
the Account object.

Change-Id: Ida408912de29734c8f4ed9cdf09a4d633dd03002
2011-04-20 11:14:02 -07:00
Todd Kennedy a50fc99b0c Use Account instead of URI to create transports
There's no need to create a URI just to rip in appart again. Additionally, to
support additional changes (i.e. to use Mailbox instead of Folder in the
MessageController), we need to store the actual Account.

NOTE -- This change only affects IMAP and POP3. SMTP will come in a follow-on CL

Change-Id: I400036a17271c99272fd9c603547dcd713b50b9d
2011-04-20 08:31:24 -07:00
Todd Kennedy ba7652cda0 Make ImapFolder a top-level class
No code changes; just moving the class

Change-Id: I4e4544d99d52dde85b96c99ef45da3a96e7d3d48
2011-04-19 09:31:43 -07:00
Todd Kennedy d31238ca88 Add support to query for message IDs
If an IMAP server supports the UIDPLUS capability, it can return the new UID
as part of the response to the "UID COPY" command. However, if the server does
not support UIDPLUS, we perform a SEARCH to try to determine the new message
UID.

This is the second of a couple modifications.

bug 4092301

Change-Id: I1f548b63becfec8733cb8ba9a3fe6ff4be6fdd83
2011-03-24 10:56:42 -07:00
Todd Kennedy 284d8d7db5 Add support for UIDPLUS capability
When copying messages between mailboxes using standard IMAP, we must perform
a QUERY or FETCH in order to determine the new message UID. However, if the
server supports the UIDPLUS capability, the server will return the new UID
as part of the response to the "UID COPY" command.

This is the first of a couple modifications. We still need to fallback to a
less efficient QUERY/FETCH if the server does not support UIDPLUS.

bug 4092301

Change-Id: I9279f7fd70daf85adba3b3e202c12d67ddf91f22
2011-03-23 15:15:45 -07:00
Andy Stadler 45d50a1ccf Don't send ID command to *.secureserver.net
Fixes connection failures with GoDaddy IMAP.

Bug: 3497713
Change-Id: I327d9b24598d7dead2d1b74f4e37d1e5885822a6
2011-03-02 16:13:23 -08:00
Marc Blank 31d9acbf06 Email split, part huit: Refactor constants, clean emailcommon
* There are three pieces to this CL (sorry):
  1) Move and/or rename some constants into emailcommon
  2) Move Utility to emailcommon, moving the few UI
     related utilities back into Email (FolderProperties
     and UiUtilities)
  3) Remove all references to resources from emailcommon
* The three pieces relate in that, between them, they allow
  the emailcommon static library to compile cleanly

Bug: 3442973

Change-Id: Ic5e3abaa2a1b36999e0b6653c6c2134ea1bd544f
2011-02-14 12:18:10 -08:00
Todd Kennedy 32311cce01 Implement IMAP prefix support
We support two different ways for an IMAP prefix to be specified:
  1. A text field on the IMAP configuration page. This is the most obvious to
     the end user. It is also an explicit, manual configuration.
  2. RFC2342 defines a NAMESPACE IMAP command to be able to query the prefix
     from the IMAP server. This is an automatic configuration without any
     user involvement (i.e. the UI will NOT change if a prefix is loaded in
     this way)

If the user goes to the trouble of specifying a prefix, we will always honour
it instead of the namespace returned by the IMAP server -- even if the user's
configuration is wrong.

bug 1592696

Change-Id: I6b94c7aaac538f6cd9dc4694b0f1634e8c956bc1
2011-02-11 14:17:48 -08:00
Marc Blank a7bc0319a7 Email split, part six: EmailContent
* Moved EmailContent to emailcommon

Change-Id: Ib3db1bfcfe74554c0e5afd3cfce6d72f26e9aeb9
2011-02-10 19:44:29 -08:00
Marc Blank 2193962ca2 Email split, part quatre: Move along, nothing to see here
* No code was harmed, er, changed in the making of this CL
* All that's happened is that code that is needed by both Email and
  Exchange have been moved into emailcommon
* This required import changes to many files, which explains the
  length of the CL

Change-Id: I4e12455ba057a4a8054fdbd0b578c73afa411c8a
2011-02-10 16:28:37 -08:00
Marc Blank 8a57469460 Email split, part trois: AccountService
* Create AccountService.aidl and AccountServiceProxy in emailcommon
* Implement AccountService in email
* Use AccountServiceProxy in Exchange for account reconciliation,
  notifications, etc.
* Move sync window constants into emailcommon
* Split attachment provider utilities and constants into emailcommon

Bug: 3442973
Change-Id: I89dce28b799b193243c07774dab65d830ae62775
2011-02-10 14:32:01 -08:00
Andy Stadler 7d51b7a05b Remove all compatibility with pre-2.0 data
* Remove LocalStore (pre-2.0 mail database) and its unit test
* Remove UpgradeAccounts (converted pre-2.0 accounts to Provider)
* Remove FolderMessageList (receiver for pre-1.6 desktop shortcuts)
* Remove "upgrading" paths through LegacyConversions
* Clip out dangling references to everything above

Bug: 3292310
Change-Id: I5654d55a0879b00b05b63055b94651855a8ee3ef
2011-02-06 00:54:39 -08:00
Todd Kennedy 8546e21e1e Resolve build warnings; part 2
Change-Id: I76c1a5a4f759071f92eef0574abb20a99bfb32b7
2011-02-03 11:46:40 -08:00
Makoto Onuki f33420e68f Message details: Show only one address per line
Also removed unused field from MessageViewMessageDetailsDialog

Bug 3372971

Change-Id: I8a6d87d006793c0099b380634217624bf9002ead
2011-01-31 16:12:53 -08:00
Andy Stadler 11070a5397 am 275b89d9: am 927dbc7c: Don\'t send IMAP ID unless server supports it
* commit '275b89d96949de6544c7bca999e241f659cf18b3':
  Don't send IMAP ID unless server supports it
2011-01-31 15:20:01 -08:00
Andy Stadler 927dbc7c20 Don't send IMAP ID unless server supports it
Only send IMAP ID to servers that include ID in the CAPABILITY response.
Always sending IMAP ID was found to cause problems with some servers.

Better compliance with RFC 2971.
Thanks to Samsung for debugging & reporting this.

Change-Id: I495f80949f9f811470853a1f2f8e506d8236d8cf
2011-01-31 15:10:49 -08:00
Makoto Onuki 36f2088408 Fix LocalStoreUnitTests
The problem was that we tried to upgrade the db by re-creating a LocalStore,
without closing the existing connection.  The db was still upgraded on the
filesystem, but the old connection kept looking at the old table definition
for whatever reason.

Also cleaned up checkAllTablesFound().  It now shows what columns are
missing when failed.

Bug 3349973

Change-Id: I80f4c67f1bd61cd5e1f12a632978b36a6e0a3b19
2011-01-14 14:36:01 -08:00
Makoto Onuki a826d3fb03 Pixel perfect: Message view
Still waiting for a few missing assets, but it's done other than that.

The divider change is already merged; new layouts all use the framework style.

It's basically all layout changes, except for:
- Now the recepient address line has "Show details", which shows a dialog with
  all to/cc/bcc addresses with the timestamp.
- Now invite response buttons are checkboxes.
  (But the basic behavior doesn't change -- once you check a response,
  the message will be gone, so you can't change the response later.)

Copied message_header_bg from gmail manuall.  It'll look silly without it.

Bug 3138021
Bug 3307021

Change-Id: I6f7eb91d6104c3143a5c58b0c4c6c19929cea477
2011-01-10 15:51:32 -08:00
Andy Stadler f252d5d95e am 42749c91: am 1a791e67: Fix NPE when switching IMAP into TLS
* commit '42749c9105c663e035a0863d7a6bda111b5c7112':
  Fix NPE when switching IMAP into TLS
2011-01-05 08:10:26 -08:00
Andy Stadler 1a791e675b Fix NPE when switching IMAP into TLS
* Update MockTransport to allow TLS connections
* Test TLS connection in ImapStore unit tests
* The bugfix: Re-query capabilities after closing/reopening parser for TLS

(Note: Actually, this is required by the IMAP RFC 3501, 6.2.1)

Bug: 3315939
Change-Id: I51f838043e87750b5712a1bd2e4f9c821b58c808
2011-01-04 20:21:15 -08:00