Commit Graph

52 Commits

Author SHA1 Message Date
Makoto Onuki 91237e9dcb Adding script for building Email app without exchange.
remove-exchange-support.sh makes it possible to build the email app without
exchange support.

This script:
- removes all packages under com.android.exchange.
- removes all lines surrounded by EXCHANGE-REMOVE-SECTION-START and
  EXCHANGE-REMOVE-SECTION-END

And the resulting source should still build and run fine.

Bug: 2369784
2010-02-03 11:39:46 -08:00
Makoto Onuki faed6178b1 Move Eas.ACCOUNT_MANAGER_TYPE out of the package.
Moved Eas.ACCOUNT_MANAGER_TYPE to Email.EXCHANGE_ACCOUNT_MANAGER_TYPE.

This constant is not related to the exchange protocol, and referred in
a lot of different places.  Moving it out of the package will make it a lot
simpler when removing exchange dependency.
2010-02-01 15:38:15 -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
Marc Blank 0e1595c177 Handle unexpected deletion of EmailProvider database
* Addresses #2226426
* If the user deletes Email data, or if data corruption causes
  EmailProvider.db to be deleted, we will be in an inconsistent
  state with any existing Exchange accounts, since the AccountManager
  will still know about them, contacts (and eventually calendar) items will
  continue to exist, etc.
* Run an integrity check when the provider is created, deleting any
  orphaned EmailProvider.db or EmailProviderBody.db
* Catch SQLiteException's in the Provider and do an integrity check
  if any is caught

Change-Id: I47d523b90a6b8f71ba8e13fba4b04846b3da1b1d
2009-12-07 21:12:57 -08:00
Vasu Nori b720ed3183 revert previously submitted CL 34143.
turns out the change I submitted before is not required at all. I mistakenly
assumed sqlite wouldn't be able to handle it. but tested it with the latest
version of sqlite 3.6.20. the old style triggers work fine.
2009-12-03 18:32:58 -08:00
Vasu Nori 8e09bde568 change BEFORE triggers to AFTER triggers - to make them work with sqlite 3.6.20 and beyond 2009-11-25 15:38:42 -08:00
Marc Blank 367963639d Fix SQL for upgrade from ver 6 to ver 7 of Email database
Fixes #2196917

Change-Id: Ia403e50e9ec4ea553d38ded656bba769a4a4dd18
2009-10-20 10:11:26 -07:00
Marc Blank ef83299b99 Clear out orphaned messages in updates/deletes tables
Case #1:
* Fixes #2184702
* Messages can be in the base Messages table, but also in
  Message_Deletes and Message_Updates; the latter two were not
  being purged of deleted messages.
* This CL deletes from all three tables when a Mailbox is deleted
* Also run a check for orphaned deletes/updates when the email
  provider's db is first opened
* Unit test updated to check for proper deletion
* Unit test for the provider check for orphans

Case #2:
* Fixes #2184708
* Messages in Outbox/Drafts can get modified or deleted, but the
  rows added to the updates/delete tables never get removed because
  the boxes don't sync
* Added code to SyncManager.ping (which gets notifications of these
  changes) to delete these rows

Change-Id: Ib53e441136b0da1e88bc220150d631999058a8f0
2009-10-15 10:58:00 -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
Marc Blank 8587aa6121 Make EmailProvider more threadsafe w/r/t transactions
* Since transactions can be nested, get rid of pointless/dangerous
  flag for indicating we're in a transaction.
* Fixes #2131847

Change-Id: I2955e8a7659533e8ee9e71b949a042570466df45
2009-09-19 22:24:52 -07:00
Marc Blank 657de3bfd6 Revert change to AccountManager naming; use email address again
* Forces wipe of existing accounts

Change-Id: I65d08e07a2d74f94f9142e85791d9bf49c100241
2009-09-18 20:48:43 -07:00
Marc Blank e7e1ca432e Change AccountManager username for Exchange to the user's login credential
* This is not a backward-compatible change (sorry)
* Existing AccountManager EAS accounts and contacts are deleted
* Existing EmailProvider data is deleted
* Change works with new code (stadler) to avoid account duplication

Change-Id: Ife09c51fa714d91054d017b497bce603add5375a
2009-09-17 10:06:27 -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
Marc Blank 9be10e62ed Remove the "unique" requirement for serverId; it should never have been there
* People using multiple accounts without this change could end up with missing folders
* Fixes 2099514
* Database version incremented; this change will cause a database wipe

Change-Id: I08d23fa54d8194758e1f7c2ffb528a14bc184f08
2009-09-04 16:36:39 -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 77398c4289 Reenable Load More Messages for IMAP/POP
* Properly reset all mailbox limit values
* When load more messages is clicked, increment limit and resync
* Also fixed a race condition in provider

Resolves bug 2065626

Change-Id:	If50f25a5cb3b549b3acc48406c78533ad86ed4d5
2009-08-23 23:45:54 -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
Marc Blank a867ebba62 Have body database attach just once, and never detach
* Much cleaner implementation
* Prevent errors when various threads collide for attach
2009-08-18 14:05:40 -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
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
Mihai Preda fb7974f5bf Fix SQL for DELETE_ORPHAN_BODIES and DELETE_BODY.
and add unit tests.
2009-08-12 12:57:09 +02:00
Marc Blank 9b598924ec Try to work around the "ping loop" problem in some Exchange 2003 servers
* First try reloading the folder list; this can sometimes work
* Otherwise, change push to 5 minute sync
* Send notification if we switch to 5 minute sync so there are no surprises
* Added syncStatus column to EmailProvider (can be used for any purpose)
* Use syncStatus to keep track of sync type, result type, and change count;
  detect ping loop as consecutive ping's with no changes
* Remove InteractiveSyncService (no longer needed)
2009-08-06 20:51:54 -07:00
Marc Blank cba3a48f97 Fix EmailProvider so that deletions can occur during batch operations
* Fixes bug #2034170
* Attach the body database during all batch operations
* Change insert, delete, update, and query to use the main database for
  all operations during a batch operation; trying to use the body database
  while it is attached will result in a SQLiteException (database locked)
2009-08-05 19:53:20 -07: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
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 eda017627e Prevent EAS startup race condition while debugging
* Make sure that mAccount and mMailbox are up-to-date at all sync starts
* Prevent duplication of mailboxes in schema, since it's always wrong
* Add a service call to enable/disable logging in EAS
2009-07-21 12:00:16 -07:00
Marc Blank 5790d1458f Work on EmailService calls, attachment loading, etc.
* Stubbed in attachment loading in MessageView for EAS messages
* Modified MessageView.Listener to implement IEmailServiceCallback
  for testing callback functionality
* Rewrote EmailServiceProxy entirely
* Simplified loadAttachment service call
2009-07-20 13:52:27 -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
Mihai Preda f33986d5cc Eliminate Config.LOGV (deprecated, always false).
Add Email.LOGD as a development log guard.
2009-07-16 14:09:15 -07:00
Mihai Preda c6893ddf0f First steps towards using the new EmailContent.Message in MessageCompose. 2009-07-15 13:13:45 -07:00
Marc Blank 6b158f715b Handle UI delete in EAS where the message is moved to trash
* Check for the folder of updated messages, and delete those now in trash
* Created convenience method for finding a mailbox of a particular type in
  an account (helpful for finding, say, an Inbox or Trash for a given account
* Fix deleted/updated message table so that the _id column is defined to be
  unique (to prevent duplicate change records from being written)
2009-07-14 16:04:27 -07:00
Marc Blank b6493a07ef Major refactor and cleanup of EAS code
* Rewrote push logic to encompass multiple folders (i.e. calendar/contacts)
    * Change inbox from push frequency to ping frequency after initial sync
    * Implement upsync logic for email (i.e. sending changes to the server)
    * Did cleanup of some files (there's still some to do) re: format, style
    * Initial one-way sync of Contacts data - add and delete are implemented
    * Created adapter package for all parts of the EAS adapter
    * Created utility package for utility code that will eventually be merged
      with code in the Email application (Base64, QuotedPrintable, etc.)
    * SyncManager/AbstractSyncService can be used in the future for other
      protocols, especially IMAP push
2009-07-07 00:30:24 -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
Marc Blank f374304e92 Add support for sync related provider operations
There is now a deleted table as well as an updated table for Messages,
and some new URIs that are well documented in EmailProvider
2009-06-27 14:41:41 -07:00
Andrew Stadler 5f4dbd6438 Attempt to download small messages, and POP messages.
POP doesn't supply headers in the ENVELOPE phase, so we have to
explicitly ask for, download, copy, and save small message bodies.

Fix bug in EmailProvider (it was not always detaching the body db),
leaving the DB locked in some situations.

Problems outstanding:
* POP messages are committed before they have headers, which leads
to blank entries in the UI.  It might be worth tagging them and
selecting them out until they're ready to display.
* Inefficient because we're reloading the message from the provider on
each pass, instead of hanging onto it and updating it.
* Not marking "complete" yet because we aren't handling attachments
or inline images yet.  So we keep on reloadin'.
2009-06-24 12:48:57 -07:00
Marc Blank 2c67f1f8b8 Initial submission for EAS support (email)
* There is some temporary code ensuring that SyncManager runs (this will be removed when Exchange
is entirely independent)
* The service interface (aidl) is in place for most user-facing actions (load more, start sync, etc.)
* EAS account validation is done via aidl
* Folder and message sync appear to be functional in this early submission
* Provider now does cascading deletes (Account -> HostAuth and Mailbox, Mailbox -> Message,
  Message -> Attachment and Body)
2009-06-23 13:13:42 -07:00
Marc Blank 33e176f491 Remove the bodyId column in the message base for consistency
Foreign keys belong in the child, not the parent, as is done with other
EmailContent classes.  Therefore, Body has a messageKey, and Message has
no bodyKey.

Updated MessageView to use the proper query for retrieving a message body.
2009-06-22 12:13:06 -07:00
Marc Blank e34525d0f0 Add URI's for updated messages, and Provider support for them
Messages that have been updated in the database live in a different table
and therefore can't be accessed in the provider without the added support.
2009-06-17 11:20:32 -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
Andrew Stadler 9019315b26 Conversion to provider-based Account. What works:
* Editing existing accounts
 * Two placeholder accounts are written

What breaks (in approx order of planned fixes)
 * Some details of account editing
 * New account creation,
 * Viewing mailboxes & messages
 * Mail sync using accounts
 * Import of existing accounts
2009-06-03 16:11:36 -07:00
Fred Quintana 84969fb580 update to adhere to applyBatch changes 2009-06-01 17:06:26 -07:00
Andrew Stadler 626f3e48a4 Updates to EmailStore and EmailProvider:
1. Call notifyChange() after all API calls.
  2. Make Account & HostAuth parcelable
  3. Temporary APIs to create "store URI" strings for the existing mail code
2009-06-01 14:34:16 -07:00
Marc Blank fae4727a91 Squashed commit of the following:
commit 19beb6f0cc6c0f3f0cbcdcd66cec9f141b470d70
Author: Marc Blank <mblank@google.com>
Date:   Fri May 29 14:23:01 2009 -0700

    Changes to EmailProvider

commit 84cced7b94bde4688ad986a45a6bf876cde3bdbe
Author: Marc Blank <mblank@google.com>
Date:   Fri May 29 14:02:20 2009 -0700

    Fix additional formatting issues.

commit 1faeb1763ba8a967fbf79ddbc48822af08c65a15
Author: Marc Blank <mblank@google.com>
Date:   Thu May 28 19:26:03 2009 -0700

    Changes in EmailStore.Account
    - Add isDefault column
    - Add status methods setDefaultAccount/getDefaultAccount

    Resubmit previous with formatting issues addressed.
2009-05-29 16:08:17 -07:00
Andrew Stadler ea6b71e0f4 Per android code style guide, all member variables start with "m" 2009-05-28 11:46:09 -07:00
Andrew Stadler bd649fc1fd General changes to generalize account & hostauth classes:
- Remove references to SMTP and use generic "send" and "recv" notation
  - Move protocol indication into hostauth
  - Add TLS (along with SSL)
2009-05-27 17:30:07 -07:00