Commit Graph

46 Commits

Author SHA1 Message Date
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
Tony Mantler 82a207132b Move account backup/restore to userdata in AccountManager
Change-Id: Iea9f2a1b1f2d87e07d63cbb1df5a0d6355ea4031
2014-05-14 15:15:49 -07:00
Tony Mantler 2f97a7c658 Clean up unused code and warnings in Account
Change-Id: I40475eb6c8afa6b7b28fd143b9ad4fd268ff4657
2014-05-13 10:46:30 -07:00
Tony Mantler 3c73a04bec Continue purging the unused reply parts
Change-Id: I47b5bbe50ba36e68ad7ba80647f401b992660ba1
2014-04-18 14:04:23 -07:00
Jerry Xie 17d3a29c9d Get Email units to compile
Change-Id: I171a0e2421c5006d9862ad94f886932146547020
2013-12-05 11:11:21 -08:00
Marc Blank f5418f1f93 Move Account into its own top-level class
Change-Id: Ide7c991b7d4d418dbe17164421425bf898ba64ee
2011-06-13 15:37:22 -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
Ben Komalo 53ea83ebf9 Move Mailbox to top level class.
No other changes made.

Change-Id: I3d8f3c521dc0d902be313b25252b4b6a4a96e7ee
2011-05-13 17:42:02 -07:00
Marc Blank 0993190caf Complete rewrite of account backup/restore code
* Use EmailProvider to backup/restore into a backup database
* Remove all of the old AccountBackupRestore code
* Get rid of the legacy Account class and all of the Preferences
  crap that referenced it
* Remove corresponding tests

Change-Id: I2de75aafdacc87246174303961e58547303f641e
2011-05-09 10:39:17 -07:00
Marc Blank aeee10e57e Rework of security policy storage
* Replace crazy (and soon to be "full") bit fields stored in an account's
  securityFlags with a row in a newly created Policy table (thus, fully
  expandable)
* Update code from database version 17 to 18; adds Policy table, a
  policyKey row in Account, and a revised trigger that deletes Policy
  information for deleted Accounts
* Update old PolicySet unit tests to work against the new Policy class
* Add test for the conversion of securityFlags to Policy
* Tested in a variety of scenarios; appears to be functionally equivalent

Change-Id: I1505ee75230d6a0d3c2b62a46326f39c2c7f9eb5
2011-05-03 11:11:47 -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
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 0d49ef78eb Change "appendQuotedText" to "useSmartReply" in Rfc822Output
Slight API change to make it more clear what the method parameter is for.
Also add some additonal test conditions to the Rfc822Output tests.

Change-Id: I8888d6201e79136fa3420aa9d5f921772f374e56
2011-03-01 13:30:21 -08:00
Andy Stadler 30793aa791 Merge "Add parent key to Mailbox schema" 2011-03-01 10:46:56 -08:00
Andy Stadler 3a58509b2a Add parent key to Mailbox schema
Bug: 2028418
Change-Id: I79d48befe7754692a3cab6c8851105bb399431f5
2011-03-01 10:45:50 -08:00
Todd Kennedy fe68c0e7c2 Use HostAuth to determine settings changes
There were two TODO's from a prior CL where deprecated HostAuth methods
were removed.

1. Do not use a generated URI to determine if account settings have changed.
   Instead, use the HostAuth structure for this purpose.
2. The account key in the HostAuth structure has been deprecated. Remove as
   much of it as possible (until the schema of the host auth database changes,
   we must still refer to it when adding rows).

In the process, HostAuth tests were broken out into a separate unit test
file.

Change-Id: I4075da09af168f734db7b20a9ef63d4178ac2064
2011-03-01 07:49:54 -08:00
Makoto Onuki 897a0ea81c Refactoring widget part 2
- Extracted the loader
- Extracted ViewType and introduced WidgetView.
  WidgetView is ViewType + mutable fields, such as account id.
  WidgetView now owns the method to switch views.

These two are basically in preparation to address the message count bug.
(we're showing total message count where it should be the unread count,
which is a bit tricky because it'll require two different queries.)

- Also simplified the threading model in EmailWidget to fix potential
  theading issues. (now (almost) everything works on the UI thread)

Bug 3431240

Change-Id: I9f8a268210995f1135baabe88b49b274272708d4
2011-02-23 14:20:00 -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
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 75a873be84 Implement prefetch of IMAP/EAS attachments
* Load attachments in the background for IMAP/EAS messages
* Download an attachment from account X if:
  1) 25% of total storage free
  2) Attachments for X use < 1/N of 25% of total storage, where N is
     the number of AccountManager accounts
* Add accountKey to Attachment table for performance

Change-Id: I913aa710f34f48fcc4210ddf77393ab38323fe59
2010-12-13 15:32:57 -08:00
Marc Blank fab77f147f EmailProvider content caching
* In this CL, we cache individual rows, based on the CONTENT_PROJECTION
  defined for the most common queries (Account, HostAuth, Mailbox, and
  Message)
* Queries on individual rows (most often Class.restoreClassById()) will
  look to the cache first, rather than querying the database
* Queries on smaller projections will build MatrixCursor's from cached
  data
* Write-through caching updates the cache with changed columns
* Experiments with live data indicate that > 95% of queries that are
  cacheable (single row, no selection) can be retrieved from the cache,
  thereby saving a great deal of disk access.
* Timing experiments show that cache hits are > 40x faster than cache
  misses
* Unit tests for the various classes exist, with more coming

TODO
----
* More unit tests

Change-Id: I386a948a2f4cc02b6548d07d9b2fefd1e018a262
2010-11-16 08:58:05 -08:00
Marc Blank e7b9e4ab94 Add snippets to messages
* Add 'snippet' column in Message table and handle upgrades to the
  new schema
* Generate a snippet from either HTML or plain-text message body,
  removing tags, extraneous whitespace, and other superfluous text
  along the way.  Store the snippet in the Message table
* Clean up MessagesAdapter to use the pre-existing list projection
  and constants
* Write unit tests for snippet creation
* The UI in this CL is always single-line, ellipsized

TODO: Handle two-line subject if portrait and XL

Change-Id: I84a2cbe10957975942edad6eb1255a726924a78a
2010-09-03 23:23:19 -07:00
Makoto Onuki 25144e2b79 Fix testAccountIsEasAccount
Bug 2953763

Change-Id: Iad1bf94e676c1fb41335e8bd7f3297af0033b0f5
2010-08-26 15:08:57 -07:00
Marc Blank f19f9cf4d3 Simplify AttachmentDownloadService; add unit tests
* Changed our queue from a TreeMap to a TreeSet that uses an easily
  testable comparator
* Remove the ugly bit twiddling priority computation
* Test DownloadSet (the logic behind queue ordering, addition,
  removal, query, etc.)

Change-Id: Ia8427900b8f39a243a5407349775802d0a4fad4f
2010-08-23 11:42:40 -07:00
Makoto Onuki 833fe73b99 Aadd special boxes to mailbox list.
Change-Id: I36616f53555346ca7fbb6f3426a0c3196d7bacbc
2010-08-03 17:06:04 -07:00
Makoto Onuki 206d4e842d Split up MessageViewFragment like we did to MessageView.
Break MessageViewFragment up into two fragments, MessageViewFragment, which
is used to show regular messages, and MessageFileViewFragment, which shows
EML messages.  (And their base class, MessageViewFragmentBase.)

MessageViewFragmentBase's javadoc has a class diagram.

MessageViewFragment is actually named MessageViewFragment2 at this point
so that GIT correctly finds out the rename from MessageViewFragment to
MessageViewFragmentBase.  I'll rename it back in a following CL.

Also added very basic unit tests for MessageView and MessageFileView.
At this point, they just make sure the activities really open and show
messages without exceptions.

I feel like the current naming schema for the activities/fragments is
kinda confusing.  Let me know if you come up with better names.

Change-Id: Iff948f4b68cfdb7c1e68f225927b0ce58d34766b
2010-07-30 15:38:53 -07:00
Makoto Onuki 20225d5760 Explicitly send ICS files in UTF-8.
- In memory attachments are now stored as byte[], not String.
  We can store any type of contents now.
- Added blob content_bytes to the Attachment table.
  The content field is now deprecated and not used.
- Explicitly convert ICS files to UTF-8.

- Added Utility.to/fromUtf8().

Bug 2509287
Change-Id: I3785a365a9a34039ec12ba82bd857dcdbc4de92d
2010-03-15 10:51:58 -07:00
Makoto Onuki f3f15c12c9 Fix AccountSetupExchangeTests.testLoadFields()
This test has been failing since I60974b85, which is obviously correct,
so I modified the test.

Bug 2488770

Change-Id: I5a2eea19d9f3c3647b7c88a1e0db9297727b8e66
2010-03-08 15:28:38 -08:00
Andrew Stadler 3aaba9eb87 First part of Exchange meeting request/reply implementation
* Added two columns to Attachment in EmailProvider
  content: content that is written directly as an attachment
  suppressDisposition: to suppress the content-disposition header
  All meeting invitation emails use these two columns; the first
  for ics attachment data (which is quite small, rarely over 1k),
  and the second to indicate NOT sending the content-disposition
  header; without this, Exchange will consider the ics as an
  attachment rather than an iMIP style message (rfc2447)
* Modified tests to include these columns; added upgrade code for
  new database version
* New columns and code are designed to be usable outside Exchange,
  although there are no other clients of the code at this point.
* Modified Rfc822Output to use the content field, if present, in
  lieu of retrieving attachment data via URL; added support for
  suppressing the Content-Disposition header
2010-02-22 12:57:33 -08:00
Marc Blank 4006e5fc22 Add meetingInfo column to Message; use for meeting invites
* Added a meetingInfo column to the Message database
* When a meeting invite is received, the start time is stored here
  in ms from start of epoch.  Note that this field is defined to be
  a String, for extensibility
* Update ProviderTests

Change-Id: If44892d27ccc5ebdc1f8667befafb8b8a27a2cf4
2010-02-16 10:18:33 -08:00
Marc Blank 694257cb7e Handle calendar sync state changes by observing Calendars; cleanup
* Use a content observer to detect changes in Calendars; we use this to
  determine whether or not sync has been turned off.  If sync is turned
  off, all events will be deleted, so we need to reset the sync key
* Make sure that all code working on Contacts also now works on Calendar
  (push, etc.)
* Remove some old crufty logging and out-of-date comments
* Addresses 2433061

Bug: 2433061
Change-Id: I6299168903fcce9bf820b72b5f6bb157d9169653
2010-02-13 12:58:56 -08:00
Andrew Stadler 345fb8b737 Add utilities for processing account security policies
* Add security sync key & signature columns
* Add utilities for easy read/write of security columns
* Write aggregator for multiple accounts
* Simple API's for exchange security (very preliminary)
* Unit tests of above

Bug: 2387961
2010-01-26 17:24:15 -08:00
Andrew Stadler fc8d943a82 Add security column to Account
* Upgrade accounts table to add security column
* Read/Write new column
* Backup/Restore new column
* Unit tests for all of the above
* First cut at defining bitfields (non-binding, just putting down ideas)

Bug: 2387961
2010-01-21 11:48:02 -08: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 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
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 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
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
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 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
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
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
Andrew Stadler 28448e782b Extract utilities from provider tests for use elsewhere. 2009-07-06 10:49:38 -07:00