Commit Graph

889 Commits

Author SHA1 Message Date
Andrew Stadler e4a7cc440f Re-enable modernized version of "optional" SSL/TLS
* Add "Accept all certificates" modes to incoming/outgoing secure choices
* Change URI scheme slightly to make "trust" a flag, not part of the
    protocol.
* Change Stores to know about new URI scheme
* Slightly rework Transport API to make "trust" an independent flag
* Adapt HostAuth to handle new Uri scheme
* Remove the old ambiguous "optional" code, which was allowing
    some unsigned certificates, but was *also* allowing TLS to
    optionally start (though not SSL, despite the UI strings.)
* Add a few unit tests to EmailContent
* Add logging and a bunch of comments to TrustManagerFactory, and a bit
    of simple cleanup to make it more readable.
* Add missing conversion of SSLException->CertificateValidationException
    in TLS so we get the correct certificate errors from TLS too.
* Re-enable TLS for mac.com accounts (which had a certificate problem)

Fixes bug http://b/2119755, http://b/1374780, and probably a raft of
earlier and/or external bugs about certificate problems.

Change-Id: Iaf99a8da3eaadaa4cdeec224737838b5d6813e55
2009-09-29 15:28:43 -07:00
Andrew Stadler c41c47fa07 Enable message upload
* Create logic to detect upsyncable messages in Sent
* Note:  Drafts is now local only for IMAP - no sync, either way
* Rewrite MessageController.processPendingAppend for Provider world
* Write provider message -> legacy message converter
* Fixed bug in IMAP APPEND (it was not picking the right UID for the
    uploaded message.)
* Better handling of server internaldate
* Add constants for new X-Android-Body-Quoted-Part header
* Add EmailContent routines to get each of the 5 parts of the body
* Remove "Load more" from unsynced message lists
* Add toString to MimeHeader for debug support

Bug # 2097471

TODO (next CL): Upload attachments records too

Change-Id: I209182f5adc6b6696919f559e3cbbdd58b3eed3a
2009-09-25 14:54:32 -07:00
Marc Blank 5fc57eccef Fix reply/forward for both SMTP and EAS; fixes #2138725
* Add new introText column in the Body database
* Reply/Forward put the appropriate String into this new column
* Rfc822Output uses this when required when streaming the message

Change-Id: I34602fdb3f91692c46fc8bc31ba0e6f680d445a0
2009-09-23 07:31:01 -07:00
Andrew Stadler 0d00889f83 Cleanup Provider Message in preparation for upload
* Remove mServerIntId and its special logic
* Add mServerTimeStamp
* Add column dynamically so we don't lose accounts

Bug # 2097471
2009-09-22 18:31:10 -07:00
Andrew Stadler fa52e6c956 Clean out old mailbox names logic and fix a couple of bugs.
* Get rid of old Account.getxxxFolderName() calls.
* Clean up any call sites to them
* Properly rename the existing special folder name identifiers
* Use a hash table in MessagingController to improve identification
    of special folders for IMAP accounts
* Fix a bug in Controller, which was creating new server-side folders
    using localized names.
* Fix a bunch of code in Controller that was using mContext, instead of
    using mProviderContext to support testability.
* Fix broken unit tests in ControllerProviderOpsTests

Fixes bug 1904373
2009-09-21 14:44:30 -07:00
Android (Google) Code Review 71bba443f2 Merge change 26224 into eclair
* changes:
  Fix broken test after changes to Rfc822Output
2009-09-21 16:16:51 -04:00
Marc Blank e470332456 Fix broken test after changes to Rfc822Output
Change-Id: Ibb1ab79cf2cce1e5ad66d3a45656e575dbabbc6d
2009-09-21 13:16:16 -07:00
Andrew Stadler ad4ec0590d Fix broken MessageView tests
I'm surprised these were working at all.
2009-09-21 12:59:25 -07:00
Andrew Stadler 092d35c98d Fix NumberFormatException in POP3 message sync
* Write unit test to replicate failure(s) in POP3 use of parseInt.  All
    calls to parseInt must be guarded by try/catch NumberFormatException.
* Fix the failures

Bug # 2115586
2009-09-16 12:20:38 -07:00
Andrew Stadler da8836a76c Give warnings if dupe account created:
* Check for existing accounts with matching servername + username
* Show a dialog and block account creation
* Triggers in three cases:
  * After input of an auto-setup account (e.g. Gmail or AOL)
  * After input of manual setup (incoming) parameters
  * After changing incoming parameters of *any* existing account
* Made some notes in EmailContent regarding fields in HostAuth that we
    are not actually using.
* Added HostAuth unit tests

Primarily fixes bug # 1964449
Bonus fix for bug # 1594408

Change-Id: I49310faf6654280582e0ab3d3e40f2701bfcd21d
2009-09-15 16:33:44 -07:00
Android (Google) Code Review c21d326ef0 Merge change 25145 into eclair
* changes:
  Disable testResolveInlineImage
2009-09-15 19:03:06 -04:00
Andrew Stadler 1761234fc6 Disable testResolveInlineImage
This test depends on LocalStore and is thus deprecated.

It very much needs to be be rewritten and reestablished.

Bug # 2121424
2009-09-15 15:55:23 -07:00
Marc Blank 2d5691cac1 Support bcc in Exchange (Fixes #2117849)
* Must send the bcc header for EAS

Change-Id: I38d119beed334c6bb23a09b87375804f8c03ea76
2009-09-15 15:18:46 -07:00
Marc Blank 1d98989222 Implement SmartReply/SmartForward for EAS; fixes #2098779
* SmartForward and SmartReply are EAS commands that automatically
  include the original message and, if a forward, all original
  attachments, regardless of whether they've been downloaded to
  the device
* Both commands improve battery life by sending less data; greatly
  so for SmartForward if there are attachments

Change-Id: I12432cd5275a3b54e9a80d5cd59da437c4a086cc
2009-09-14 15:47:38 -07:00
Marc Blank f2dded3a2f Reimplement reply/forward to use mTextReply/mHtmlReply
* Move creation of final reply/forward text (i.e. new text plus
  the original) to Rfc822Output, where it belongs.
* Prepares the way for use of SmartForward/SmartReply in
  Exchange and replying w/ multipart/alternative in SMTP
* Moved test from MessageCompose to new Rfc822OutputTests, and note
  that new tests should be added (this is not a regression; there
  were never enough tests here)

Change-Id: Ibefb842f47cc9223714856d99b8d4f55b55f49e3
2009-09-13 22:28:38 -07:00
Marc Blank 411334d4e5 Fix broken test cases
Change-Id: Ib2d019662d358a20b4d62992529bfdf398e4661b
2009-09-11 23:00:39 -07:00
Andrew Stadler 6c21942ec4 Implement move-to-trash for IMAP and POP3.
* Define new message-loaded state "FLAG_LOADED_DELETED" (used only for
   POP3, which needs to write sentinel messages that are not displayed.)
* Also renamed the other flags to make the naming more consistent.
* Tweak MessageList query generation to inhibit display of deleted
    message sentinels, and MessagingController won't try to resync them.
* Clean up implementation of Controller.deleteMessage()
* Add support for move to trash to MessagingController.  This operates
    in three primary modes:
  * POP3 local delete (no server-side interaction)
  * POP3 server delete
  * IMAP server delete (and copy to IMAP trash mailbox)
* Add missing implementation in provider to delete all of the attachments
    for a given message
* Fix progress reporting in activities (the test for error vs. progress
    was inverted, which caused progress indicators to keep spinning
    after errors.)
* Fix broken account settings UI (POP3 delete policy was not persisting)

Addresses bug 2097409

TODO delete from trash / empty trash

Change-Id: I00188e6dc2093823106e009f35b68c760227c9e6
2009-09-10 12:44:05 -07:00
Marc Blank cef2344e70 Rework EAS account creation & ssl operation
* Fixes 2048663, 2025029, and 2100131
* Add "Trust Certificates" checkbox in EAS account creation
* Use custom ClientConnectionManager for HttpClient with registry
  for plain, ssl, and tssl (trusted ssl) connection
* Use a ConnectionPool for HttpClient connections
* Remove "Domain" checkbox in  EAS account creation
* Remove tests related to the "Domain" field
* TODO Write a test for valid usernames (requires a bit of research)
  <name>, <email address>, <domain>/<name, and <domain>\<name> are all
  valid, but there might be others

Change-Id: I4a0338df5960bfd3d679a88aaf22d1c49f49992b
2009-09-09 10:32:06 -07:00
Marc Blank e256983193 Add sourceKey to Body table; add flags for reply/forward in Message
* Set reply/forward flag and sourceKey as appropriate in MessageCompose
* Update provider tests accordingly

Change-Id: I7f49d80a735314a1a38f09fbf1f234257c41af8c
2009-09-08 16:42:53 -07:00
Marc Blank 5b1ec90761 Fix more broken large Email tests (#2087413)
Change-Id: Iacff02d7bb025f6c4d6de9ca8dfa96c6cbb78d67
2009-09-06 13:58:38 -07:00
Marc Blank 6e7ea8cfe6 Fix problem with case of attachment name in EAS
* Fixes #2102752

Change-Id: I9cc05a8fc02344f1f673c5ccb4e6aed0f9602350
2009-09-05 22:13:55 -07:00
Marc Blank b8d0c55a05 Fix reply all behavior to prevent duplicates, etc.
* Also create a bogus account if none exists to prevent setup failure
* Fixes #2087413 (Email large tests failing with Unknown URI)
* Fixes #2097361 (Duplicate email address when replying...)

Change-Id: I9ca2ac5f98db43e9009c22421c69956440356e34
2009-09-04 20:39:02 -07:00
satok 4bb52e36b1 Fix the foldername of outbox
BUG: 2077596

* fixed the array of special_mailbox_display_names
* added unit tests
2009-09-03 09:47:00 +09:00
Andrew Stadler fe5ed7b4b5 DO NOT MERGE Remove test code
Bug # 2092944
2009-09-02 15:20:32 -07:00
Andrew Stadler 91a5cd517f Clean up handling of Exchange setup option
* Use concrete declarations, not the old sample code
* Remove unused "sample" code
* Create ExchangeSender.java
* Strip out the unused (old sample code) parts of ExchangeStore.java
* Unit test to make sure EAS is being offered
* Fix "account leak" in AccountSettingsTests

This was triggered by donut bug # 2092944 but the solution is
different because we support EAS here.
2009-09-02 09:45:28 -07:00
Andrew Stadler 936babc145 Bulk change of columns, LAST TIME.
* Add reply columns to Body
* Remove a bunch of unused columns from Message
* Update SQL tables, content read/write, etc.
* Small tweaks to app code that was not-really-using the old columns.
* Update existing unit tests for new/changed columns
* Disable TagsTests to solve a tests failure (prexisting, not caused by
    this CL)

Change-Id: Ief493796dfe219669755170d76786f91570cbb9b
2009-09-01 23:19:12 -07:00
Marc Blank 2ebf7d97ec Fix 2085862; add email address to test Account
Change-Id: I1980935207a96daa0b34bf78931e47b8374c84cc
2009-08-31 11:50:30 -07:00
Mihai Preda 0967b74a62 am 629e18ad: Fix base64 decoder. BUG 2081740.
Merge commit '629e18ad866917523599ed059898f4d986e49e26' into eclair

* commit '629e18ad866917523599ed059898f4d986e49e26':
  Fix base64 decoder. BUG 2081740.
2009-08-27 15:16:39 -07:00
Mihai Preda 629e18ad86 Fix base64 decoder. BUG 2081740.
It was broken by CL 22378.
The bug was in the situation when "==" (two padding chars) were at
the end, the reading did not stop after the first '=',
and thus one more char of output was generated.
Add more unit-test for base64 decoding.
2009-08-27 22:24:30 +02:00
Andrew Stadler 423206653f Sync "read" and "favorite" back to server.
* Add \FLAGGED support to IMAP (writeback)
* Add code in Controller to kick MessagingController
* Rewrite pending commands system to scan through provider's updated
    messages table and react
* Fix a unit test that I broke
* Cleaned out some of the old PendingCommand support

Addresses the 2nd half (upsync) of bug 1904385

TODO:
Can I add a unit test for IMAP flag writer?

Change-Id: I5a96a695d4f35fca1395506f165b86d9fb19b543
2009-08-26 23:12:02 -07:00
Mihai Preda ea0fea2558 MessageCompose: bug 2080075 & 2077496.
- fix bug 2080075, reply to message without text body.
- workaround bug 2077496 by temporarilly disabling the address adapter.
- unit test for MessageCompose.buildBodyText()
- use precompiled regex
2009-08-26 21:49:31 +02:00
Marc Blank aa69a17477 Add initial support for uploading new Contacts to Exchange server
* Refactor the sync adapters to separate out parsing from commit
* Use ContactsProvider to save the SyncKey for contacts
* Fixes #2072664 and #2072456

Change-Id: I1e85c498496e83d9523489636a75f366f7fbd106
2009-08-24 18:45:14 -07:00
Andrew Stadler 4b41bae270 Enable IMAP/POP sending and EAS resend
* Finish IMAP/POP sections of Controller.sendMessage
* Rewrite MessagingController.sendPendingMessagesSynchronous
* Add deleteAllAttachmentFiles to AttachmentProvider, and unit test
* Rework sendMessage callbacks and integrate into MessageList UI
* Send pending from UI

TODO:
* Find other places from which to call deleteAllAttachmentFiles
2009-08-20 11:09:39 -07:00
Marc Blank c0c9c33322 Add URI's that atomically add a value to a particular field (Account or Mailbox)
* Message, etc. could be added, if this had a use case
* Unit test added for both Account and Mailbox cases
* Eclipse changed some parens around; it won't happen again
2009-08-20 10:27:10 -07:00
Mihai Preda 44144d0301 MessageCompose: initial save attachments and load them back.
- load attachments for EditDraft.
- save attachments when save message.
- unit test for restoreAccountsWithMessageId()
2009-08-20 15:52:50 +02:00
Andrew Stadler 0d10783635 Finish loading large IMAP/POP messages
* Handle messages >25k
* When structure is available (e.g. IMAP) pull in the entire body
    and the list of attachments
* When structure is not available (e.g. POP) pull in a large chunk of
    the body to try and capture the message body at least.
* Implement loadAttachment for IMAP/POP to demand download large items
* Tested with IMAP & POP messages

INCOMPLETE (file bugs):
* implement logic for the old loadMessageForView calls that comes from
    MessageView (when you open a message that's partially-loaded)
* Resolve handling of mimetype when attachment info is read (currently
    we're assuming base64 in a couple of places)
* delete account => delete attachments
* delete attachment => delete file
* create account => clear existing attachments for acct id
2009-08-19 16:09:13 -07:00
Andrew Stadler 4a8c70c09b Add "num new messages" field to Account
* Reset DB version to "1"
* Added field and support code (save, restore, & parcel)
* Added forgotten mProtocolVersion to parcelable code
* Added unit test for parceling

Also, fixed race condition in SyncManager that was underlocking the
wake locks during tests.
2009-08-18 12:14:15 -07:00
Marc Blank cc8d74bd03 Add support for syncing the favorite flag to server (EAS 12.0 and up)
* Add test for date formatting
2009-08-17 22:48:12 -07:00
Mihai Preda 9627d014e1 MessageCompose: update body on save.
- plus unit tests.
- and some attachment refactoring.
- move PROJECTION_ID up to EmailContent.
- add index on messageKey to Attachments and Body tables.
- add missing Columns.ID field in EmailContent.
2009-08-17 13:43:56 +02:00
Andrew Stadler c640cbbaf3 Update SMTP to send from provider messages, and attachments
* Change Sender definition (remove old Message from API) and update
    any existing calls through that API
* Rewrite SMTPSender to use provider messages
* Add attachments to RFC822Output
* Minor bugfixes in RFC822Output
* Unit tests
2009-08-13 09:31:57 -07:00
Mihai Preda fb7974f5bf Fix SQL for DELETE_ORPHAN_BODIES and DELETE_BODY.
and add unit tests.
2009-08-12 12:57:09 +02:00
Andrew Stadler 3f1ac4da94 Add code to handle IMAP/POP attachments.
IMAP messages up to about 25k will be downloaded properly.

* Move Store->Provider message rewrite code to a separate utility.
* Add code to descend a Store message and write provider attachments.
* Unit test basic IMAP attachment handler

TODO:
* handle large IMAP messages.
* unit test for POP
* unit test for large IMAP messages
2009-08-11 15:08:14 -07:00
Mihai Preda 2917e895c7 MessageCompose:
- set displayName for composed messages (from To:)
- set FLAG_LOADED
- do the save & send in an AsyncTask
- some clean-up
2009-08-03 13:04:21 +02:00
Marc Blank f00dccd321 Massive reworking of EAS serialization; much smaller and faster now
* Remove all use of Strings in favor of the parser's static final int's
* Strings remain in Tags for debugging output only
* Renamed lots of classes to be more consistent
* Centralized logging behavior in Eas class
* Found and fixed some bugs in the process:
  - Account deletion wasn't removing HostAuth's correctly in the trigger
  - Adding a second EAS account was trashing the first one
  - Fixed looping sync behavior caused by Exchange 2003 bug
2009-08-01 17:55:15 -07:00
Marc Blank 758a532fce Use providers to update the unreadCount of Mailboxes
* Triggers added for insert/delete/update of Message
* update of Mailbox will never set unreadCount
* Removed old test for unread counts and replaced with on
  that tests trigger operation.
* Remove Account.updateUnreadCount (deprecated)
2009-07-30 16:03:31 -07:00
Marc Blank 948c36f47a Reimplement EAS contacts sync to work w/ new system facilities
* Modify to work with ContactsProvider2
* Modify to work with system AccountManager
* Modify to work with system SyncManager (for triggering user-change syncs)
* Sync server->client for adds/deletes implemented (CP2 doesn't handle delete yet)
* Sync server->client changes handled efficiently (only write changes)
* Some fields still not handled
* Rewrote most of the CPO code to handle server->client changes
* Sync client->server works for supported fields
2009-07-30 09:22:40 -07:00
Mihai Preda 3e79032dd1 Fix MessageCompose tests.
BUG 2017612.
2009-07-28 16:27:04 +02:00
Mihai Preda ff683a5b98 Remove mOldMessage from MessageView.
And add Address.unpackFirst() (used in MessageView) + test.
2009-07-28 13:49:40 +02:00
Andrew Stadler a98de7e55e Finish Attachment support for EAS accounts.
* Change service API to allow caller to supply complete target path/file
* Also allow caller to supply the final content_uri
* In MessageView, use full integration with EAS service API and
  attachments content provider to enable:
  * Save: Only works on SD card
  * View: Works w/o SD card using content provider & intents
  * Thumbnail previews
2009-07-27 19:52:21 -07:00
Andrew Stadler 3d25a519ab Convert AttachmentProvider to use new Provider db.
* Rewrite internals to use EmailProvider instead of raw db access
  * Minor changes to APIs as necessary (and scattered changes to follow)
  * Convert unit tests and check them
2009-07-27 15:52:42 -07:00
Andrew Stadler 301ac18bb7 Create tests and improve docs on AttachmentProvider
No change in functionality.  Just getting a test infrastructure in place
before rewriting to use new EmailProvider.  Provides tests for:

* get type (raw & thumb)
* open file (raw)
* open file (thumb)
* query
* resolveAttachmentIdToContentUri
2009-07-27 11:20:15 -07:00
Android (Google) Code Review c7ccb68ba4 Merge change 8253
* changes:
  Modified to display unread count correctly.
2009-07-24 14:46:52 -07:00
satok 41f775bbc7 Modified to display unread count correctly. 2009-07-25 06:42:34 +09:00
Marc Blank b8a781f220 Load EAS attachments internally with new API ; re-sync after account changes
* Fix bugs #1993689 and #1997842
* Update test for attachment name creation
2009-07-24 12:36:52 -07:00
Mihai Preda 21ace307e0 Clean-up in MessageCompose, using EmailContent.Message.
Difficulties:
re-enable EmailHtmlUtil.resolveInlineImage() and
MessageCompose.loadAttachments() that operate on MIME parts.
2009-07-24 18:50:09 +02:00
Marc Blank 7375d950e4 Move to single EmailContent file; fix bug #1998157 2009-07-23 16:24:48 -07:00
Andrew Stadler 6ae38e4a39 Moving message operations into Controller, and load attachments.
* Moved logic into Controller:
  * toggling read/unread
  * toggling favorite status
  * some new unit tests
  * load attachment
* Completed logic for EAS to save attachments and MessageView to
  begin and complete that process.

NOTE:  Until EAS has a mode for saving the attachment locally (and I
rewrite the attachmentprovider to handle the new database) I am
implementing "view" attachment to just call "save".  This means that
attachments "viewed" will be dropped onto the SD card, instead of
cached and flushed.

TODO:  Controller is not properly working in its own thread, yet, so
we are not properly preventing ANR's yet.
2009-07-23 09:51:01 -07:00
Marc Blank 531ae9d25f Fix bug #1997284 re: single default account
* Fixed the bug and uncommented the relevant tests in ProviderTests
2009-07-22 16:35:12 -07:00
Andrew Stadler 9e2c6bd5f2 Remove saveOrUpdate from EmailContent to prevent stale writes
* Numerous classes modified to deal with this change
  * Fixes bugs 1993292 and 1994671
  * Renamed various setter and getter methods to reflect the underlying
    field names
  * Renamed syncFrequency to syncInterval in Account and Mailbox
  * Convenience method added to AccountSettings to save only user settings
  * Calls to content.update(context, content.toContentValues()), which save
    all fields, should be double-checked for correctness, making sure that
    content has current data and will not conflict with other threads that
    might modify that data
  * Ran all unit tests to confirm proper function

NOTE:  The logic to enforce single default account no longer works,
because that logic is in Account.save() and does not run via
Account.update().  I have patched out a small section of the relevant unit
test and will file a bug to come back for this fix.
2009-07-22 15:13:30 -07:00
Andrew Stadler 54c1f2bf9a Improvements to default account handling
* Remove all references to Account.mIsDefault, which was not the right
    way to find the default account (it is lazy initialized)
* Change Account.getDefaultAccount to getDefaultAccountId, which is more
    efficient and suitable in most uses.
* Wrote unit tests for provider default account handling

This should resolve bug 1983390 as well as a few other issues with default
account management.
2009-07-21 16:44:16 -07:00
Marc Blank 53093871c4 Changes to EAS: attachments, HTML text, and sending mail (without atts)
* Added HTML support for Exchange 2007 and later
* Modified MessageView to show HTML parts of body (if present)
* Replace some unused convenience methods in Body to be ones that are more
  useful (i.e. retrive body for a given message id)
* Made EAS sending operational
* Updated SyncManager to recognize the creation of new messages and check
  for work to be done (i.e. starting Outbox sync)
* Modified MessageView to remove EmailContent.X references
* Also changed the pattern EmailContent.getContent(cursor, class) to the better
  new ClassName().restore(cursor)
* Add a test of the utility to determine mime type from file name (since
  EAS doesn't provide this with attachment header information)
* Fixed bug in ProviderTestUtils in which the base (EmailContent) fields weren't
  being checked for equality in the various subclass equality testers.  Fixed a
  bug in saving emails that was caught by fixing this bug.
2009-07-18 23:31:39 -07:00
Andrew Stadler 4119218e2f Add support for get-attachments-by-message-id
* clean up provider URI's in this area
* minor bugfix in EmailContent, and add auto-writeback of messageId into
    saved attachments
* clean up existing attachment unit tests
* add new tests
2009-07-16 16:03:40 -07:00
Marc Blank 976f92908d Add support for attachments in EmailProvider and (preliminary) EAS
* EmailProvider now saves Attachment records atomically with Message (and Body,
  of course) if an ArrayList is stored in mAttachments
* Update EAS code to support attachment discovery
* Update EAS code to support attachment download via service API (preliminary)
* Add test for atomic attachment save
* Add test for unique file creation (external)
2009-07-16 00:01:57 -07:00
Mihai Preda c6893ddf0f First steps towards using the new EmailContent.Message in MessageCompose. 2009-07-15 13:13:45 -07:00
Andrew Stadler ded3c915d8 Add folders to AccountFolderList
* Scan folders and write into child cursors
* Clicking a folder takes you to MessageList
* Remove most links to FolderMessageList (nearly dead!)
* Repair 1-account startup behavior (takes you directly to inbox)
* Cleanup a few basic things like context menus & refresh

TODO: Magic mailbox section at the top
TODO: As always, better linkage to sync engine(s)
TODO: Menus, context menus, etc.
TODO: Proper handling of expandable list - accounts should stay open?
2009-07-10 16:46:51 -07:00
Mihai Preda e8d58c01ec Implement efficient Address pack/unpack and unit-test it.
Also unit-test legacy pack/unpack.
2009-07-08 12:07:58 -07:00
Andrew Stadler 7c3cca80a0 Reenable delete-message UI and write delete-from-provider.
* Longpress delete in MessageList
* Delete or Menu-Delete in MessageView
* Add deleteMessage() to Controller
* Unit tests for the new code in Controller
2009-07-06 13:58:30 -07:00
Andrew Stadler 28448e782b Extract utilities from provider tests for use elsewhere. 2009-07-06 10:49:38 -07:00
Andrew Stadler 45f9dd22e1 Fix bug in GroupMessagingListener and add unit tests 2009-07-02 14:29:02 -07:00
Andrew Stadler ddc871d9ed Fixed a few EmailProvider omissions; added tests
* EmailProvider query wasn't handling queries for deleted messages
* EmailProvider wasn't catching exceptions on some 'drop table' ops
* Added tests of synced messages (delete and update)
2009-06-29 23:08:40 -07:00
Takaoka G. Tadashi 2ed5063274 am 4f23ebd3: Fixed Pop3Store to be able to delete message in Inbox.
Merge commit '4f23ebd3dcca596533a33e6faedb446a814d32e3'

* commit '4f23ebd3dcca596533a33e6faedb446a814d32e3':
  Fixed Pop3Store to be able to delete message in Inbox.
2009-06-29 20:20:23 -07:00
Takaoka G. Tadashi 4f23ebd3dc Fixed Pop3Store to be able to delete message in Inbox.
When delete policy is DELETE_POLICY_ON_DELETE, PENDING_COMMAND_TRASH
will be invoked. But in POP3 account, because of 1) Inbox is
OpenMode.READ_ONLY, 2) getMessage(uid) just after open() is not work
correctly, 3) remote Inbox folder is not closed after deleting message,
PENDING_COMMAND_TRASH does not work.  And also the fat that some POP3
server use UID with '-' prevents PENDING_COMMAND_TRASH to recognize
the message is remote message.

Internal Bug: 1651709
2009-06-26 10:36:27 +09:00
Andrew Stadler 7143d969dd Add unit tests for Provider and fix bugs that were found
Uses a mock provider to avoid touching production databases.
Includes utilities for creating accounts, mailboxes, and messages.
Tests basic object creation & readback, object deletion, and some
forms of hierarchical deletion.  Has many TODO notes for additional
tests to be written.

In EmailContent, found & fixed a few fields that weren't being written to
the database properly.
2009-06-25 00:02:29 -07:00
Mihai Preda ed0e683d86 Don't drop invalid addresses while editing & check that all addresses are valid before send.
BUG: 1542391
add unit tests.
2009-06-24 15:44:08 -07:00
Mihai Preda 6c5460886f am a4926736: Review Email tests annotations (small/medium/large) and change some annotations based on time.
Merge commit 'a492673609111fe8c41ae152d62547b267346502'

* commit 'a492673609111fe8c41ae152d62547b267346502':
  Review Email tests annotations (small/medium/large) and change some annotations based on time.
2009-06-18 13:12:45 -07:00
Mihai Preda a492673609 Review Email tests annotations (small/medium/large) and change some annotations based on time.
Fix an NPE appearing when running the test suite.

BUG: 1566281, 1910409.
2009-06-18 12:16:28 -07:00
Marc Blank a290f503f1 Refactored EmailStore, EmailContent, EmailProvider
EmailStore goes away, replaced by EmailContent
All database activity is moved to EmailProvider
2009-06-15 14:49:11 -07:00
The Android Open Source Project a244abdad0 Do not merge. Merge commit '14f3e16' into donut 2009-06-15 00:08:40 -07:00
Mihai Preda 0dff228dc7 AI 149714: Download inline images for viewing if necessary and don't
delete attachment cache files if these are inline images.
  The purpose of original logic of loadAttachmnet() is to keep
  at most one attachment cache, probably to limit the size of
  cached file.  But it also purges all inline images.
  Integrates CL 149551 from DocomoEmail.
  BUG=1884385,1860250

Automated import of CL 149714
2009-06-10 10:48:32 -07:00
Andrew Stadler d2b0efa2f5 Cleanup broken unit tests from previous submit. This now works:
What works:
* All unit tests
* Editing existing accounts
* Create new accounts
* Checking account settings against server
* Mail sync using accounts
* Viewing mailboxes

What breaks (in approx order of planned fixes)
* Viewing messages
* Composing messages
* Some details of account editing
* Import of existing accounts
2009-06-09 14:46:30 -07:00
Andrew Stadler c0033f24a2 Convert remainder of app to use provider-based accounts
What works:
* Unit tests, except for com.android.email.activity.setup.*
* Editing existing accounts
* Create new accounts
* Checking account settings against server
* Mail sync using accounts
* Viewing mailboxes

What breaks (in approx order of planned fixes)
* Unit tests in com.android.email.activity.setup.*
* Viewing messages
* Composing messages
* Some details of account editing
* Import of existing accounts
2009-06-08 15:42:40 -07:00
Mihai Preda a9576bdad6 resolved conflicts for merge of 7403a54738 to donut 2009-06-08 20:52:12 +02:00
Mihai Preda 7403a54738 AI 149664: Move escapeChar from MessageView to EmailHtmlUtil.
Integrate CL 148437 from DocomoEmail.
  BUG=1860250

Automated import of CL 149664
2009-06-08 11:21:18 -07:00
Andrew Stadler a392e070bc Add android.permission.WRITE_EXTERNAL_STORAGE
Add unit test to verify writeable to sdcard.

Fixed bug http://b/issue?id=1883487
2009-06-04 15:16:43 -07:00
Mihai Preda 7330fe4953 Merge branch 'readonly-p4-donut' into donut 2009-06-04 11:40:35 -07:00
Mihai Preda 70798a7892 AI 149573: Display To: instead of From: in Drafts folder && Display unread message count for inbox, total message count everywhere else.
Integrates from imode email: 148948,149107,149247,149248,149249,149287.
  BUG=1591391,1842520,1860085,1459866,1860250

Automated import of CL 149573
2009-06-04 11:38:26 -07:00
Mihai Preda 438275b283 Merge branch 'readonly-p4-donut' into donut 2009-06-04 09:42:51 -07:00
Mihai Preda ca5089efb8 AI 149564: Escape special characters such as '<>&' in text/plain for display in WebView.
Integrate CL 144586,145919 from imode.
  Remove the Emoji escaping/workaround for WebView.
  Also integrate MimeHeader.java from CL 143064 from imode.
  BUG=1785319,1860250

Automated import of CL 149564
2009-06-04 09:39:24 -07:00
Mihai Preda d64d0e56de Merge branch 'readonly-p4-donut' into donut 2009-06-03 06:47:40 -07:00
Mihai Preda 7436601fae AI 149523: Correctly display inline images in Reply and Forward messages.
Integrates CL 148436, 148515, 148833 from imode email.
  BUG=1814789,1860250

Automated import of CL 149523
2009-06-03 06:44:47 -07:00
Mihai Preda fbde900c37 Merge branch 'readonly-p4-donut' into donut 2009-06-01 11:31:52 -07:00
Mihai Preda 5182d80674 AI 149442: Integrate CL#140625 (Fix attachment uri and content uri confusion) from imode to donut.
BUG=1598754,1860250

Automated import of CL 149442
2009-06-01 11:28:33 -07:00
Tadashi Takaoka 7b92d9a2a9 Merge branch 'readonly-p4-donut' into donut 2009-05-27 19:06:31 -07:00
Tadashi Takaoka a8884b9b72 AI 149328: Add extended header support to MimeMessage, MimeBodyPart, and LocalStore.
This extension is necessary to support some vendor specific
  extended header, such as X-NoRtn-Addr of i-mode.net mail.
  This change will update LocalStore database version to 24.
  And it should be consistent between donutburger Email and DocomoEmail.
  BUG=1741969

Automated import of CL 149328
2009-05-27 19:03:34 -07:00
Andrew Stadler b011a812e0 Fix the java.lang.StringIndexOutOfBoundsException that occurs when an SMTP server closes the connection early or returns an empty line.
Fix the same error in the Pop3 UIDL parser.
2009-05-22 11:48:14 -07:00
Andy Stadler c6efb28ad3 AI 149059: Manually merge CL 148988 to fix "Not to revert SEEN flag if POP, and
fixed counting unread messages bug".
  BUG=1785254

Automated import of CL 149059
2009-05-20 10:36:16 -07:00
Andy Stadler 80257af81b AI 149020: Manually merge CLs 148814, 148818 which fix IMAP response parsing to be
able to handle a literal string in the middle of the response.
  BUG=1814528

Automated import of CL 149020
2009-05-19 14:54:49 -07:00
Andy Stadler 93116fe28e AI 148457: Allow exchange accounts to be set up without an empty domain
specification.  This relaxes a rule that was incorrectly applied.
  BUG=1740626

Automated import of CL 148457
2009-05-07 10:58:05 -07:00
Andy Stadler 08e2bc5bb4 AI 148382: Check cursors in LocalStore so we avoid errors when the folder itself
has been deleted from the DB.  Add unit tests.
  BUG=1835733

Automated import of CL 148382
2009-05-06 18:01:47 -07:00
Andy Stadler e67a433c44 AI 148381: Fix broken tests
BUG=1776149

Automated import of CL 148381
2009-05-06 17:58:01 -07:00
Andy Stadler 843125b98a AI 148300: Reduce memory waste in getTextFromPart(), and improve error handling.
Fix NPE's in loadMessageForViewBodyAvailable().
  BUG=1831272

Automated import of CL 148300
2009-05-05 10:26:55 -07:00
Andy Stadler c9f151d4fe AI 148230: Allow stores to indicate if they support server-side copying of sent
mail into the "Sent" folder, thus eliminating the need to perform a 2nd
  upload into the server's Sent folder.  IMAP and POP3 do not support
  this (although IMAP could when it recognizes Gmail IMAP servers.)
  BUG=1807499

Automated import of CL 148230
2009-05-01 16:36:34 -07:00
Andy Stadler c5c2b96739 AI 148145: Remove the account-based storage of store persistent data, and instead
combine it with the same code that handles folder persistent data (in
  the database).  The schema is really simple;  Rows with a folder id of
  -1 are store data.  This also adds the ability to use keys to store
  multiple values, instead of a single string per account.  Added/updated
  unit tests.
  3rd party stores will need slight code changes because the persistent
  callbacks now accept keys.
  BUG=1807499

Automated import of CL 148145
2009-04-30 16:47:50 -07:00
Andy Stadler d8cbeaf7ae AI 148098: Manual merge CL 148086 to fix additional problems with non-ASCII chars
in address fields.
  BUG=1676634

Automated import of CL 148098
2009-04-30 10:18:00 -07:00
Andy Stadler 067d0a87fa AI 148097: Fix bug in exchange account setup (actually it only affects
editing existing accounts).  Added simple functional tests for
  Activity UI.
  BUG=1812798

Automated import of CL 148097
2009-04-30 10:14:00 -07:00
Andy Stadler 0cfffc5222 AI 148091: Manual merge CL 148078 which resolves bugs when you have non-ASCII
names in email address fields of MessageCompose.
  BUG=1676657

Automated import of CL 148091
2009-04-30 09:38:30 -07:00
Andy Stadler 3c3add638e AI 148027: Fix concurrency failure in Folder.getUnreadMessageCount() and
Folder.getVisibleLimit(), which used local copies of the data from the
  DB.  If there were two Folder objects associated with a single actual
  folder, updating one wouldn't be reflected in the others.
  BUG=1812798

Automated import of CL 148027
2009-04-29 17:17:14 -07:00
Andy Stadler c05afb24bb AI 148019: Add "accountInstanceLimit" to stores.xml so a given type of connection
(e.g. EAS) can limit itself to n (usually 1) accounts per device.
  The UI for this is really simple - don't show the EAS button when the
  limit is reached.  More work would be required in
  AccountSetupAccountType.java in order to do a more sophisticated UI
  (e.g. show the button but pop a toast if the limit is reached.)
  BUG=1740626

Automated import of CL 148019
2009-04-29 17:10:25 -07:00
Andy Stadler 8264c4fa21 AI 148002: Add X_DOWNLOADED_FULL, X_DOWNLOADED_PARTIAL, and DELETED flags
to the set that are stored in their own columns (and thus can
  be quickly selected from).  Add code to migrate old style
  flags into new flags.  Add tests.
  BUG=1786939

Automated import of CL 148002
2009-04-29 17:07:03 -07:00
Andy Stadler a13aea24a3 AI 147868: Fix CL 146360 which didn't make the changes persistent. Changed
MessagingController to accept and track a Context, instead of the
  unnecessary Application object, which makes this fix more testable.
  BUG=1790798

Automated import of CL 147868
2009-04-27 17:24:41 -07:00
Andy Stadler 5551f7feb2 AI 147714: New, lighter-weight version of CL 147620. Still touches as many files,
due to API change, but still has a smaller footprint.  Also fixes the
  bug in the original, which is that we actually needed to udpate the
  local trash folder, not the remote one.
  BUG=1807499

Automated import of CL 147714
2009-04-24 11:54:42 -07:00
Andy Stadler b633efa2b7 AI 147708: Automated g4 rollback of changelist 147620.
*** Reason for rollback ***
  We figured out a simpler solution affecting fewer files - we
  don't actually need the new remotestore API.
  *** Original change description ***
  Some stores require changing the UID of a message when it is
  copied to a new folder (I'm looking at you, EAS).  Add a callback
  to Folder.copyMessages() which allows the store to report back
  such changes.  Then, add a new api to record the new values:
  Folder.updateMessages().
  For now, the two APIs are linked by a common callsite in
  MessagingController, so the existing stores can use a minimal
  implementation - if they don't call the callback, nobody will
  call the update.
  BUG=1807499

Automated import of CL 147708
2009-04-24 11:13:36 -07:00
Andy Stadler 1df530294d AI 147620: Some stores require changing the UID of a message when it is
copied to a new folder (I'm looking at you, EAS).  Add a callback
  to Folder.copyMessages() which allows the store to report back
  such changes.  Then, add a new api to record the new values:
  Folder.updateMessages().
  For now, the two APIs are linked by a common callsite in
  MessagingController, so the existing stores can use a minimal
  implementation - if they don't call the callback, nobody will
  call the update.
  BUG=1807499

Automated import of CL 147620
2009-04-23 23:16:01 -07:00
Andy Stadler 72288724d4 AI 147538: Because mPreferences is transient, we need to pass Context into the
persistent callbacks, in order to recreate it occasionally.
  BUG=1786939

Automated import of CL 147538
2009-04-23 16:42:23 -07:00
Andy Stadler 2990ff1f96 AI 147452: Update LocalFolder.fetch() to support STRUCTURE mode, in
addition to existing support for BODY mode.  Add tests.
  BUG=1807499

Automated import of CL 147452
2009-04-22 23:48:59 -07:00
Andy Stadler 29bbfd0b97 AI 147401: Redo the implementation of store-specific flags to allow
deeper database-style operations with them.  This enables two
  new LocalStore APIs to be provided:  A new version of
  GetMessages() that can retrieve only flagged (or un-flagged)
  messages, and a new method to set flags for an entire set of
  messages, in a single SQL transaction.
  BUG=1786939

Automated import of CL 147401
2009-04-22 13:49:57 -07:00
Andy Stadler 7e6df9c6aa AI 146379: Provide a small set of message flags that can be set by stores and will
be persisted by LocalStore.
  BUG=1786939

Automated import of CL 146379
2009-04-15 15:29:00 -07:00
Andy Stadler 1f48259d22 AI 146360: Provide an API by which the server (or store) can tag some
of the role-specific folders such as Drafts, Sent, or Trash.
  This allows us to properly target these folders even on
  systems where they have different names.  I capture the
  tagged names into the existing columns in the account data,
  where they are used elsewhere in the code (no changes
  necessary).
  Use default implementations on POP3 and IMAP for now -
  no change from original behavior.  The new code is
  primarily to support EAS (for now).
  BUG=1790798

Automated import of CL 146360
2009-04-15 12:58:19 -07:00
Andy Stadler 4836f3c289 AI 146331: Make the download window sizing adjustable on a per-store basis.
The default values are 25 (default) and 25 (increment).  This is fine
  for Stores that control downloads by # of messages, but won't work for
  stores that use other measurements - e.g. EAS windows the download in #
  of days.  So for this change:
  1.  Allow the StoreInfo to provide non-default values
  2.  Remove the hardcoded references to the default values
  3.  Use StoreInfo values everywhere
  4.  Set the values to 1,1 in EAS store info
  BUG=1789913

Automated import of CL 146331
2009-04-15 10:58:59 -07:00
Andy Stadler c6039f7d17 AI 146134: Add persistence API for remote stores & folders to use while
syncing.  This provides a key-value store, per folder, that
  can be used by network Stores to record persistent data such
  as sync status, server keys, etc.
  Note that, by definition, this only applies to remote folders
  (e.g. IMAP, POP3). You'll see everywhere that LocalFolder is
  passed null, and this is correct - LocalFolder *is* persistent
  storage and does not need external help.
  Note to reviewers:  The core changes are Folder.java,
  LocalStore.java, and LocalStoreUnitTests.java, so please give
  them the bulk of your reviewer attention.  The other files
  are just following along with minor API changes.  Of those,
  the one worth close examination is MessagingController.java,
  which is the only place in the system where remote Folders
  are bonded with Local Folders and thus where this new API
  comes into play.
  Note to jham:  Can you please take a look at
  LocalStore.LocalFolder.setPersistentString() and recommend
  better SQL foo than my primitive test-then-update-or-insert
  logic, which is not transactional or threadsafe.
  BUG=1786939

Automated import of CL 146134
2009-04-14 10:15:07 -07:00
Andy Stadler cd7e5664f9 AI 146061: Add persistent storage that Store classes can access.
The current design for Store classes (e.g. IMAP) did not provide for
  any persistent storage.  This is the beginning of a mechanism to
  provide that.  It's quite simplisitic - each Store can read/write one
  persistent string - but that's enough for the first simple use case
  (saving some sync data for EAS).
  The core changes here - suggest reviewing first - are in Account.java,
  Store.java, and AccountUnitTests.java.  Everything else is just
  following the API change that was necessary.
  Note that, by definition, this only applies to remote stores (e.g.
  IMAP, POP3).  You'll see everywhere that LocalStore is passed null, and
  this is correct - LocalStore *is* persistent storage and does not need
  access (so far, at least).
  BUG=1786939

Automated import of CL 146061
2009-04-13 20:07:56 -07:00
Andy Stadler ea6fea9bb2 AI 144953: Provide UI for push mode accounts.
1.  Generalize the code for the various spinners that control
  account check frequency.
  2.  Provide an API for looking up store attributes (and refactor
  existing instatiateStore logic to use it).
  3.  Cleanup the old code that was used to setup frequency spinners.
  4.  Hardwire Exchange accounts to default into push mode.
  Notes to tester:
  1.  For each account type (POP, IMAP, EAS) we need to check that
  auto & manual creation "do the right thing" for frequencies.
  POP & IMAP should offer "none" or time intervals, while EAS
  should offer "push", "none", or time intervals.
  2.  EAS accounts should default to "push", all others to "15 min"
  3.  Make sure that you can edit existing account settings and see
  the right choices (only EAS should be offered push).
  4.  I couldn't write an automated test for the mail checker service,
  please confirm that POP & IMAP accounts are checked at the right
  intervals (or never, if set for "none".)
  BUG=1776149

Automated import of CL 144953
2009-04-07 17:35:13 -07:00
Andy Stadler ae8ca3fbd1 Automated import from //branches/donutburger/...@143018,143018 2009-03-26 17:05:25 -07:00
Tadashi Takaoka 2a34cb9c9c Automated import from //branches/donutburger/...@142523,142523 2009-03-25 01:30:24 -07:00
Tadashi Takaoka b1d72808d7 Automated import from //branches/donutburger/...@142458,142458 2009-03-24 22:44:38 -07:00
Andy Stadler 2b4b8d3e8e Automated import from //branches/donutburger/...@142110,142110 2009-03-24 21:27:36 -07:00
Andy Stadler 7dbeb7d91c Automated import from //branches/donutburger/...@141237,141237 2009-03-24 19:53:32 -07:00
The Android Open Source Project 3469902379 auto import from //branches/cupcake_rel/...@140373 2009-03-18 17:39:48 -07:00
The Android Open Source Project 3b85e2c2b5 auto import from //branches/cupcake_rel/...@138607 2009-03-13 13:04:24 -07:00
The Android Open Source Project fd09f8019a auto import from //branches/cupcake/...@137197 2009-03-09 11:52:14 -07:00
The Android Open Source Project 96c5af40d6 auto import from //depot/cupcake/@135843 2009-03-03 19:32:22 -08:00
The Android Open Source Project 8c2158a5eb auto import from //depot/cupcake/@135843 2009-03-03 18:28:50 -08:00
The Android Open Source Project 1f5bbf66d1 auto import from //depot/cupcake/@132589 2009-03-03 14:04:31 -08:00
The Android Open Source Project 7a8703fda9 auto import from //depot/cupcake/@137055 2009-03-02 22:54:40 -08:00
The Android Open Source Project 88a1d6f92d auto import from //branches/cupcake/...@132276 2009-02-19 10:57:35 -08:00
The Android Open Source Project ff4eb775df auto import from //branches/cupcake/...@131421 2009-02-13 12:57:53 -08:00
The Android Open Source Project f7ae27b973 auto import from //branches/cupcake/...@130745 2009-02-10 15:44:04 -08:00
The Android Open Source Project b957c79556 auto import from //branches/cupcake/...@126645 2009-01-15 16:12:13 -08:00
The Android Open Source Project 687f9962d7 Code drop from //branches/cupcake/...@124589 2008-12-17 18:05:56 -08:00