Commit Graph

93 Commits

Author SHA1 Message Date
Marc Blank 3a5c1fb274 Email split, part neuf: Setup, logging, attachment glue
* Make "Exchange" option in account setup depend upon availability of the
  Exchange EmailService
* Make presence of Exchange logging depend upon availability of the
  Exchange EmailService
* Make AttachmentDownloadService use service rather than ExchangeService
  class
* Move SSLUtils to emailcommon/utility
* Move account manager type defs to emailcommon/AccountManagerTypes
* Update proguard.flags
* This is the penultimate CL for the Email package itself; the next CL
  creates a clean, SDK-compatible Email application

Bug: 3442973
Change-Id: I9162cf5fa6b5a043ded0fdd1e25fd3ce5948ad8f
2011-02-14 16:08:55 -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 2193962ca2 Email split, part quatre: Move along, nothing to see here
* No code was harmed, er, changed in the making of this CL
* All that's happened is that code that is needed by both Email and
  Exchange have been moved into emailcommon
* This required import changes to many files, which explains the
  length of the CL

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

Bug: 3442973
Change-Id: I89dce28b799b193243c07774dab65d830ae62775
2011-02-10 14:32:01 -08:00
Marc Blank 0d4fc55861 Email split, part one: EmailService
* Create emailcommon package
* Move EmailService classes to emailcommon package
* Change references to aidl's to emailcommon package
* Add getApiLevel() command to EmailService

Bug: 3442973

Change-Id: Ic7d2115363cdff6ebb86c46650b0a5b2109b1c72
2011-02-10 13:10:38 -08:00
Todd Kennedy 5e39f90e9d Resolve build warnings; part 4
Fix unchecked warnings

Change-Id: I872740fca4e5050e6ed2922eabc7e46e5e97ff3c
2011-02-03 12:44:24 -08:00
Todd Kennedy f92dd2bf3e Don't display toast for background download failures
When downloading attachments in the background, do not display any errors
on the display.

NOTE: This is a partial fix for general background attachment downloading issues

bug 3373982

Change-Id: I874ed902bde293303e10308f38b992b2bb15b6aa
2011-01-21 15:17:29 -08:00
Marc Blank 2ac1833943 Delete attachment if there's no corresponding message
Bug: 3372440
Change-Id: I5c3653c5f27e0aa7bab52ca0d979e14bb6bafc34
2011-01-20 20:32:56 -08:00
Marc Blank aeea97275d Don't report connection error when account isn't initialized
* We report uninitialized for updateFolderList when no mailboxes
  have been created

Bug: 3235788
Change-Id: I337cfeac83bf320e8078e5a837976414fdd93e0f
2011-01-18 14:19:19 -08:00
Makoto Onuki 1daf876693 Fix NPE in Controller.deleteMessageSync
Bug 3351148

Change-Id: I0015c84e5758504a66a4373668afea063f5b2e15
2011-01-13 16:09:21 -08:00
Marc Blank 69af769688 Fix issues w/ security-related account data deletion
* Stop running syncs
* Delete all EmailProvider data except the account itself (with
  cleared sync key) and the account mailbox (necessary for syncing
  to sync after security hold is lifted

Bug: 3245779
Bug: 3253952
Change-Id: Idc208ef5ed85808b085ebab9c26a428fb0451e34
2011-01-09 18:24:35 -08:00
Andy Stadler 900021dbee Prevent duplicate mailbox creation
* Synchronized findOrCreateMailboxOfType

Bug: 3291982
Change-Id: I7146458112296aa2b0f4b8f24d0c86f16a8b6626
2011-01-05 14:11:44 -08:00
Marc Blank cbdd9f78b2 Distinguish mailbox requests that are user requested
Bug: 3251757
Change-Id: Ie417ebf44c8b740db88e5854077782930359a958
2010-12-31 11:02:03 -08:00
Andy Stadler 2959a7e073 Fix ANRs from Email.setServicesEnabled()
* Create sync & async versions
* Rename all callsites so sync is very apparent
* Fix callsites appropriately
* Clean up interaction between reconciler and setServicesEnabled

Bug: 3133770
Bug: 3134677
Change-Id: Iefbc7814d9aa390baea6345e450e2a4768bf0a9a
2010-12-23 13:19:55 -08:00
Andy Stadler 3b1cccf234 Async code for read/unread and starred
* Move each worker into async (combining common code)
* Update unit tests to match
* Make the message->account->controller lookups more efficient

Bug: 3134653
Change-Id: Icc82998a5d8eb07c7ebc7edbd28cd9308378d866
2010-12-23 09:55:16 -08:00
Makoto Onuki aef9515ee7 Controller.Result callbacks should all have accountId
- Added accountId to loadAttachmentCallback/loadMessageForViewCallback

- Cleaned up LegacyListener/MessagingListener.
  Removed the constructors which take messageId and attachmentId, which
  are used to bridge loadAttachmentProgress, which the callsite doesn't know
  these IDs.  The inconsistency (only loadAttachmentProgress() uses the member
  messageId) doesn't look too good, so extracted this into a separate class,
  MessageRetrievalListenerBridge.

Change-Id: I46303e50df2b0e1fe8616e7c9cef632ac14f23aa
2010-12-10 18:11:44 -08:00
Makoto Onuki 45e04b009d Update error banner
1. Error banner now pushes down the entire screen, rather than covers it.
2. Switch to the new ObjectAnimator for the animation to achieve #1.
   (Traditional Animation doesn't do this)
3. Dismiss the banner when getting any callback with MessagingException == null
   and progress > 0, only when the account is the one that caused the last error.
4. MessageListXL now registers its own ControllerResult to detect
   connection errors, and more importantly, when they're cleared.

Bug 3240874
Bug 3240406

Change-Id: I07f8e2f589bb1d312859824f9ec398879003ba16
2010-12-07 16:49:26 -08:00
Andy Stadler d3a9ab946c Leave empty inbox when clearing out account.
* Makes things simpler for UI state on a wiped account
* Also wipe sync keys from remaining account & inbox
* Unit tests

Bug: 3245274
Bug: 3245779
Change-Id: I74cc6d7859dad54961426b70ffe0541ce49e3b91
2010-12-01 16:21:51 -08:00
Andy Stadler e29189e3ee Cleanups to Controller & AttachmentProvider
* New method in AttachmentProvider to delete all attachments for an
  account, and unit test it.
* New method in Controller to delete all synced data for an account,
  and unit test it.
* Fixed existing problem with Controller unit tests (needed cache clear)
* Fixed existing problems in Controller (mContext vs. mProviderContext)

Bug: 3197935
Change-Id: I79c6a03c21f18d37eeb8158cd1c2af0e0a6e9d2e
2010-11-30 12:11:36 -08:00
Marc Blank cf3fb71bc6 Implement password expiration for EAS
* Hoist wipe() method from AbstractSyncParser to AbstractSyncAdapter
* Add deleteAccountPIMData(accountId) to the EmailService API
* Implement deleteAccountPIMData for EAS

Change-Id: I1037cde25fc2b24419f399446cfa0906dc0174d1
2010-11-22 11:17:00 -08:00
Marc Blank 02d59d2194 Delete secured accounts if device admin is disabled
* Update unit test

Bug: 2817683
Change-Id: Ia7117c34e7bbba13ac4f2ff375d19b3ef94ef49c
2010-10-27 09:03:21 -07:00
Makoto Onuki be1aa37dc5 Don't use sendMailCallback() -- don't track outbox status
There're differences between how SMTP and EAS use this callback.
We should eventually unify the behavior, but till then let's not
use sendMailCallback().

Bug 3116377

Change-Id: Ic5ecf16251c11ab2bd2e16e29bd417f1ece67f14
2010-10-22 15:45:51 -07:00
Makoto Onuki 77aabd9519 Don't move drafts to trash
Now deleted drafts are really deleted, rather than getting moved to trash.

Also rewrote the test to avoid creating AsyncTasks on the test thread.
In this case it seems to be running fine, but I've had problems doing this
before.

Bug 3099179

Change-Id: Ice5298bf94312ce764d90aa35c5a6c5262ec5b42
2010-10-19 13:54:05 -07:00
Makoto Onuki e069246d48 Make sure callback is still registered when calling wrappee
This caused callback methods getting run after onDestroy() problem.

Bug 2799534
Bug 3011802

Change-Id: Id505e328bbff096a9f7474c033443ff6663a5fdf
2010-09-22 15:39:02 -07:00
Makoto Onuki b8efc2d048 Make sure MessageView series don't use mMailboxKey
Because "move" and "delete" are asynchronous operations, Message.mMailboxKey
can change any time.  We can't use stored values.

(Fortunately it was used at only one place, and this was actually unused.)

Change-Id: Idc1300a00122fe0e6372b0374cddc98aa54a47fc
2010-09-02 10:53:47 -07:00
Makoto Onuki 11aea1efe4 "Move to" multiple messages
Now Controller.moveMessage supports moving multiple messages.

Change-Id: I5d9715cd94e55cf14254b4d4d731524be9d014a8
2010-09-01 15:18:06 -07:00
Makoto Onuki 086aac2386 MailboxFinder should ignore callback for non-target account
There were two cases where MailboxFinder responded to updateMailboxListCallback
when it shoulnd't.
- Callbacks for non-target accounts
- Callbacks arrived after the operation is finished

Make sure these callbacks are properly ignored.
Also, make sure startLookup() can't be called more than once.

Change-Id: I823c11ab5f96df4eb84594c08d3325d12319f708
2010-08-31 10:20:02 -07:00
Marc Blank 64b64cca01 Rename SyncManager to ExchangeService
* Updated comments and checked for 100-columns

Change-Id: I4ab5aaa9425714f8e035e1952db3fec63d498ae1
2010-08-27 12:15:56 -07:00
Marc Blank 85cf69d371 Fix "move to folder" for both IMAP and EAS
* We were zero'ing the server id BEFORE the move, rather than
  afterward; this is fixed in the current CL

Change-Id: I4a5f2b2de5794a110a8f657c80dfeac4955b5909
2010-08-26 15:42:15 -07:00
Marc Blank b53b150105 IMAP implementation of "move to folder"
* Clean up Controller.deleteMessage to work with new EmailContent
  utility methods, and move out of the UI thread
* Add unit test for Controller.moveMessage

Change-Id: Ic49e2ecc7ef2252dd4d51f4c3b313b936fda78b6
2010-08-26 10:43:28 -07:00
Marc Blank 4dcb1c5fda Fix attachmentExists (recognize mContentBytes)
* Add unit test for attachmentExists

Bug: 2937856
Change-Id: I020f58740618c084676bbf1cdfad3795edb07688
2010-08-25 22:34:22 -07:00
Makoto Onuki 45f530ba55 Integrate Controller w/ AttachmentDownloadService
* Add ControllerService to Controller and call this from
  AttachmentDownloadService to handle attachment loading

(It's a redo of I3a6c2a40.  Submitting for mlbank, who had a trouble
with repo.)

Change-Id: I7c90761ec4e213d6dc331fc894c7b77e84ad43a6
2010-08-24 11:14:57 -07:00
Marc Blank c184f36c2d Revert "Convert Controller to a full service"
This reverts commit 0e6d972641.

Change-Id: I005fc34152396806468edef919a3620961ddb4fe
2010-08-24 10:27:58 -07:00
Marc Blank 64dcd7700e Add moveMessage to the EmailService API
Change-Id: Ia10f4a75b4c1288ec52dda8b925b9aee442b8e4a
2010-08-23 21:59:14 -07:00
Marc Blank 0e6d972641 Convert Controller to a full service
Change-Id: I2078fd047ff46f85936c8bf798a5edd3678bb5b4
2010-08-20 13:34:09 -07:00
Marc Blank 7894ee82b3 New attachment download support for Controller (IMAP/POP3)
* Supports download via AttachmentDownloadService

Change-Id: I66143a79b99dcdbd307524ba0b81227f09a00e4a
2010-08-19 15:44:44 -07:00
Makoto Onuki 21efedb67f Rework/cleanup of "refresh".
Added RefreshManager, which is responsible for getting refresh requests
from UI and keeping track of what is being refreshed.

Conceptually it's a part of Controller, but extracted for easier testing.

- Now sendPendingMessagesForAllAccounts() is owned by RefreshManager
  rather than Controller.
- Also updateMailboxRefreshTime/mailboxRequiresRefresh have been moved
  in from the Email class.
- Now MessagingException implements a method to return an error message
  for the UI.

The refresh button on 2-pane doesn't work as intended yet, because the
spec is a bit too complicated (as described in the TODO in
MessageListXLFragmentManager.onRefhres()).

This change touches many file mostly because it cleans up a lot
of code duplication.

Change-Id: I058ab745ccff10f6e574f6ec4569c84ac4a3e10e
2010-08-18 11:06:45 -07:00
Makoto Onuki 4be3bc1ec8 Properly unregister mock controllers
Some tests create mock controllers.  They register themselves to
MessagingController when instantiated, but never unregister.

Added a cleanup method, and call it for each instance.

(I was hoping it would spped up unit tests, but it didn't.  Still
it's a nice thing to do.)

Change-Id: Ia90f0380aef388d22f7cfcf6e9203e05444b3285
2010-08-13 15:28:23 -07:00
Makoto Onuki 6d8bfa67c4 Make AccountBackupRestore/"delete account" robust.
Fix for crashes caused by an incomplete account
which typically a crashed unit test leaves behind.

- "Delete account" now works for incomplete accounts
- AccountBackupRestore won't crash.

Change-Id: Ie235aa15cf9b970fd184c60f14406aa7353c6f00
2010-08-10 13:49:56 -07:00
Makoto Onuki ec15f2356e Extract the mailbox lookup logic into an independent class
This new class MailboxFinder is responsible for looking for a mailbox
by an account id and a mailbox type.

If a mailbox is not found on the first try, it'll tell Controller
to refresh the mailbox list, and try again later.

This will be used by MessageListXL.

Change-Id: I4adc3db025fb271c254aa2b58b3b753281dc7398
2010-07-28 16:36:34 -07:00
Marc Blank 8d8f86e899 Cleanup and speed up isMessagingController
* Use the new Account.getProtocol() method to determine whether an
  Account "isMessagingController" (i.e. uses the legacy controller)
* Cache the result of this test, so that it's only done once per
  Account
* Add unit test

Change-Id: I6a0ec789a84bdf30b55156e6337a627fb4e81a08
2010-06-28 10:21:45 -07:00
Marc Blank 391ae25c43 Handle viewing of attachments that are, themselves, emails
* Add intent filter for application/eml and message/rfc822 mime types,
  launching MessageView with a Uri
* Modify loadMessageTask to handle the Uri by parsing the attachment's
  input stream with Pop3Message.parse(), and then creating an
  EmailProvider message in a special Mailbox created to hold
  "attachment" messages
* Delete all "attachment" messages after the parent message is closed
* Add unit tests

Change-Id: I20276ee006b9f05b889f3c808d3dc407cde26d49
2010-06-22 18:39:18 -07:00
Makoto Onuki 291b90fb24 Adding method that deletes an account synchronously.
New tests that's under development will need it.

Change-Id: I5abf168dae6ed0e78db4ae82210673decfa9ece7
2010-06-22 11:26:05 -07:00
Makoto Onuki 91d47ccb47 Cleaning up MessageListFragment.
- Introduced EmptyCallback to avoid the flood of null checks.

- Fixed some TODOs in MessageListFragment.
  - Notably, sendPendingMessages() is now handled by the fragment itself,
    rather than by the activity.
  - Moved two DB accesss from the UI thread to a worker thread.

- Replaced the 'mailboxid < 0' check with isMagicMailbox(), which is more
  explicit and easier to understand.

- Renamed some methods in preparation of moving to the activity.

Change-Id: Ie730c2c561050bbfa83a38252fcf09d59238f7ea
2010-06-18 10:55:57 -07:00
Makoto Onuki 7e1de3c484 Fix NPE in Controller and MessagingController.
Bug 2553401
Bug 2186777
Bug 2721133
Bug 2684365
Bug 2530534

Change-Id: I5185d9196deab5ba3a9866e2de2a9be04a04ca03
2010-06-11 15:54:41 -07:00
Makoto Onuki 954bcd45b0 Move account deletion feature to Controller.
Change-Id: Icd3a7cc4ff0db8fb65d3e01868543e7ce8ea79e7
2010-06-08 10:25:09 -07:00
Makoto Onuki 3f545a4060 Controller rework.
- Controller.Result is now a class rather than an interface,
  so subclasses don't have to implement empty methods.

- Replaced Threads with AsyncTasks, which is more light weighted
  because it uses pooled threads.

- Removed the Result argument from Controller's methods.
  These argumetns weren't used, except in serviceCheckMail.

  Regarding serviceCheckMail, the new code behave differenly from the old code.
  If there's already listeners registered when it's colled, they wouldn't get
  called in the old code, but they will in the new code.
  But I think this difference is okay because that's how it works for
  POP/IMAP accounts.

Change-Id: I37a857ce7c089c1a411cb7f1fcfcb72c9f5fd2a6
2010-06-07 16:33:44 -07:00
Makoto Onuki c7b6145c12 Fix the cache in Controller.
Turned out we can't reuse EmailServiceProxy, so only cache the account type.

Change-Id: I5499c2440082580d6f0739ae85b888f1afb65ba8
2010-06-03 16:31:20 -07:00
Makoto Onuki 768aff4c88 Cache for Controller.getServiceForAccount.
Change-Id: I607c437d6e0781ae8305df22c13a0e3a003c623f
2010-06-03 15:31:35 -07:00