Commit Graph

98 Commits

Author SHA1 Message Date
Marc Blank c522cfa770 Change ping loop wait from 10s to 1s to reduce WakeLock use
* There is a better way of implementing this, which I'll write up in
  Buganizer, but this will help our battery life testing

Change-Id: I2583f0cb9c62b38aee64166138385d7b14855832
2009-09-10 12:26:26 -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 58267fe146 Fix some Contacts upsync bugs; add logging for serialization
Change-Id: I855a8ee3df520f53fc94866b8463d314cf800ca5
2009-08-28 16:37:29 -07:00
Marc Blank 317a92f51f Clean up onCreate/onDestroy methods for SyncManager
* Put most of onDestroy code into the run method of SyncManager's thread
* Clean up code for updating Mailboxes' SyncKey and interval
* Fixes 2080472

Change-Id: Ie16c851a686142d9fd1d810a942aa786690b1034
2009-08-26 22:09:53 -07: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
Marc Blank 0cbdba8d62 Fix a few sync-related bugs:
* Don't leak the receiver registered by AccountManager for updates
* Only restart dead threads if they aren't logged in the syncErrorMap
  (to prevent looping behavior as seen in bug #2072456

Change-Id: Id1b4c53ef8b721bf8bfa8426627fd76831864c70
2009-08-23 10:53:53 -07:00
Marc Blank d366346a64 Implement sendMessageStatus callback in EAS
* Change API for callback to include message subject (when msg is isn't valid)
* Update users of callback to add the new argument
* Use API in EasOutboxService to send status messages back to the UI

Still TODO:  Add relevant error codes for sending problems that are not related
to connection or login issues
2009-08-20 09:08:12 -07:00
Marc Blank f4d7ddb0c2 Fix message sending from EAS (the service wasn't properly set up)
* Cleanup of EasSyncService
2009-08-19 16:09:26 -07:00
Marc Blank f2113c1dcf Make sure we log exceptions in FileLogger 2009-08-18 13:53:38 -07:00
Marc Blank b486677f91 Have all mailboxes fall back reversibly on ping loop errors 2009-08-17 17:39:05 -07:00
Marc Blank 6b52af214c Implement adaptive ping timeout; release wake lock waiting for connectivity
* Remove unused/duplicated classes (e.g. Base64, WbxmlSerializer, etc.)
* Code cleanup in AbstractSyncService, EasSyncService
* Remove last references to HttpURLConnection (using HttpClient now)
2009-08-16 16:40:42 -07:00
Marc Blank 1ba0fd37a1 Cleanup; delete unused files, change log statements
* Two files were unused and therefore deleted
* userLog was changed to avoid using string concatentation until the logging
  decision is made
2009-08-13 11:30:39 -07:00
Marc Blank b37b1b4bfe Stream rfc822 messages to a temporary file, and send using an InputStreamEntity
* Removes the need to store the entire outgoing message in memory
2009-08-12 15:35:44 -07:00
Marc Blank 8db0babf72 Separate syncInterval constants for Account and Mailbox to remove confusion 2009-08-12 09:24:12 -07:00
Marc Blank 466054d066 Minor changes to ping variables &c 2009-08-11 15:19:50 -07:00
Marc Blank 8d8f6918c7 Use 5 minute ping time when connected via mobile (prevent NAT timeout) 2009-08-11 13:44:35 -07:00
Marc Blank 84cb2bcd59 Change PIM fallback sync to 30 mins; try ping again if changes are found 2009-08-11 09:52:27 -07:00
Marc Blank 72c62e4d33 Make verbose logging less verbose; add exception message to logging 2009-08-11 09:15:12 -07:00
Marc Blank bd4d30f522 Push fallback per mailbox, rather than for entire account
* Also cleanup code, add comments, remove unused methods
2009-08-10 17:05:31 -07:00
Marc Blank cc402e42ab Clear error states on network reconnect; add temporary notifications; see details
* When we get a network connect broadcast, clear error states so sync can
  restart for any boxes in an error state
* Add temporary notification code for the testers
* Add file-based debug logger
* Add Exchange logging to debug screen (adds additional exchange debugging)
* Add Exchange sd card logging to debug screen (logs to sd card)
* Change setLogging service API to send an int rather than a boolean
* Make sure push mailboxes are set up again when account changes to push
* Make sure push mailboxes are set up again when account mailbox starts
* (Fixed contacts sync bug found during debugging these changes)
2009-08-09 21:20:47 -07:00
Marc Blank 71132ff6b7 Make small changes as recommended by stadler (for CL9459) 2009-08-08 21:23:28 -07:00
Marc Blank 1795efacc5 Use wake locks in running syncs; clean up associated code 2009-08-08 18:59:33 -07:00
Marc Blank 1e7829fb65 Switch from HttpURLConnection to HttpClient 2009-08-08 13:33:41 -07:00
Marc Blank fc579d4477 Refactor, cleanup, and fix sync bugs
* Found/fixed major sync bug re: first-time sync (emulator only)
* Moved deviceId code to SyncManager
* Added code to handle some edge cases related to sync errors
2009-08-07 22:29:15 -07:00
Marc Blank b9d6ba11c7 Fix various problems related to synchronization, reload folder list, etc.
* The reloadFolderList service call mustn't reset the account mailbox if the foler
  list has never synced
* Be careful to not commit anything after a mailbox has been stopped
* Be careful to synchronize before checking the stopped state of a mailbox
2009-08-07 12:17:23 -07: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 b4d87dfdd0 Add support for note and category upload for Contacts
* Also fixed a few random bugs found while debugging
2009-08-04 11:06:58 -07:00
Marc Blank b2bd8a8095 Add support for additional EAS contact fields
* Fix a few misc. bugs found while testing
2009-08-03 17:00:05 -07:00
Marc Blank e7e999ee95 Send OPTIONS less frequently; remove extraneous Log command 2009-08-03 10:49:10 -07:00
Marc Blank 6696c26da3 Fix bugs related to push & reloading folder list
* Fixed bug #2026451 (updateFolderList isn't interrupting pingLoop)
* Added some logging code related to 'ping' and manual service starts
* Handle exit from stopped sync thread better
* Fixed a bug in ContactsSyncAdapter service in which a cursor didn't
  get properly closed.
2009-08-02 15:35:04 -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 59b7da4616 Fix 2026451 (folder list update callback not being made)
* Make sure updateFolderList service call stops the account mailbox sync
* Make sure SyncManager is kicked so that it will restart (and thus do
  a folder list sync)
2009-07-30 21:34:48 -07:00
Marc Blank 85ef72b2ce Add support for the syncMailboxStatus/syncMailboxListStatus callback
* Allows UI to show proper progress indications depending on the status
  of a particular mailbox (running, finished, or error state)
2009-07-30 14:01:09 -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
Marc Blank c449cba510 First pass at implementing new IEmailServiceCallback.
* Add setCallback method to IEmailService interface
* Remove the callback from loadAttachment and loadMore in SyncManager and
  EmailServiceProxy
* Remove the callback from PartRequest
* Update EasSyncService to use the saved callback in SyncManager

Note: Unsure how to handle the case in which SyncManager dies, since it
will no longer have the callback available...
2009-07-29 13:36:13 -07: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
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
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
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
Marc Blank 6a6d67edde Fix push bug, minor changes to logging and removal of debug code 2009-07-16 13:13:54 -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
Marc Blank 16470fc7db Fix bugs related to EAS upsync and the cleanup afterward. 2009-07-14 17:24:16 -07:00
Andrew Stadler 17250429db Various EAS related changes related to accounts and services.
* Renamed ISyncManager/ISyncManagerCallback to IEmailService/IEmailServiceCallback
* Restored ExchangeTransportExample to its original state; created ExchangeStore to
  handle validation functionality instead; updated stores.xml to reflect these changes.
* Add support for AccountManager in EAS code (this is necessary for the contacts and
  calendar providers to work with syncable data); created EasAuthenticatorService to
  as our authenticator, which required adding authenticator.xml and modifying the
  manifest to register our service with AccountManager metadata
* Created EmailServiceProxy as a convenience for the UI in calling into the EAS
  service; created EmailServiceStatus class for status codes in callbacks.
2009-07-13 19:10:08 -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