Commit Graph

37 Commits

Author SHA1 Message Date
Anthony Lee 0e49862711 Introduction of DownloadQueue and associated tests.
Also a bit of cleanup around log tags and DownloadRequest.

Change-Id: I33221f099ed691e5258e1741cf0a63381404f520
2014-05-12 13:50:50 -07:00
Jerry Xie 7037a0bd3d Disable, suppress, remove broken and obsolete Email tests
Change-Id: Ia4dcba1c6966f23dd2a15e69324b7345aed8f944
2013-12-16 18:18:51 -08:00
Jerry Xie 17d3a29c9d Get Email units to compile
Change-Id: I171a0e2421c5006d9862ad94f886932146547020
2013-12-05 11:11:21 -08:00
Yu Ping Hu bc8bc050b0 During upgrade, ignore protocols whose strings don't change.
Copied from https://googleplex-android-review.googlesource.com/#/c/389215/
in order to submit for ur10, also made a minor change to early out when
we know it's a no-op.

Bug: 11258856
Change-Id: I28415e97225a216c16abb6ad7c48a860c5370173
2013-11-14 18:19:12 -08:00
Yu Ping Hu afe097f318 Simplify account reconciliation.
- Rather than handle by type, do them all at once.
- Simplify when reconciliation happens.

Bug: 9056861

Change-Id: If264678c82c63090246ef8ff857c8e46f6672c85
2013-07-26 16:06:14 -07:00
Marc Blank 323eea8ac8 Don't use a repeating alarm for AttachmentDownloadService
* Guarantees we can't have runaway alarms
* Manually merged from Email1

Bug: 6494254
Change-Id: I7f272f650ab34d50ec71ad503951ada3bbf203af
2012-05-18 14:09:46 -07:00
Marc Blank 03cd72805d Revert to old Email app
* These are the last sources in the ICS-MR1 tree

Change-Id: Ida4651bddd92a06a518d00f3e1f275ab3a80c8ae
2012-04-25 13:58:23 -07:00
Marc Blank 4f813fb129 Convert POP3 to service
* Remove MessagingController and (almost all of) MailService

Change-Id: I8953b58b237de6a71fda770f1727bd94081fec55
2012-02-16 10:27:00 -08:00
Marc Blank faf9ecc992 Enforce "auto-sync app data" setting for POP3/IMAP
* We were using the deprecated ConnectivityManager for this; we should now be
  using the setting in ContentResolver
* Also, remove broadcast receiver code that is no longer relevant

Bug: 5405352
Change-Id: I985a95071aea92d235a2708925f775b817ba2328
2011-10-03 13:05:24 -07:00
Ben Komalo 002a1802ca Prevent flicker in opening Email.
Welcome had some assumptions that some things had to be done
asynchronously, such as checking inbox status.
This can now be done on the UI thread and so transition into Email can
be done immediately in onCreate, except if there's reconciliating to
be done

Bug: 4599569
Change-Id: Iaaac21e73c985c60e1b7974fb0429948b35968e4
2011-09-19 16:50:07 -07:00
Marc Blank 4e4aba9ebc Clean up account reconciliation
* Move AccountReconciler to the Email app (from EmailCommon)
* Ensure that Controller.deleteAccountSync() performs ALL actions
  needed to clean up after an account deletion (delete attachment
  files, reset policies, refresh the UI, etc.)
* Add reconcileAccounts() API to AccountService
* Remove accountDeleted() and restoreAccountsIfNeede() from the
  AccountService API
* Remove unused callback

Bug: 4883073
Bug: 4767084

Change-Id: I43ffaf009db1a6f306bb0f2a74fb4dd3b2c4b966
2011-07-19 10:31:33 -07:00
Marc Blank 66a47b8dac Clean up/simplify ExchangeUtils/ExchangeStore
* Rename ExchangeUtils to EmailServiceUtils
* Create calls for Exchange to use (eventually remove these)
* Get rid of lots of nonsense in ExchangeStore

Change-Id: Ic538cfe1de57eca24088ee1f590264283d12f511
2011-06-27 12:14:04 -07:00
Marc Blank cbc842c5c9 Fix MailService unit tests
* These broke when we split Email/Exchange
* We now use a test authenticator and a test account type, which
  is actually far cleaner than dealing with actual accounts

Change-Id: Ib7c9f884eac484c33642a8036f47466ce641c567
2011-06-21 13:03:48 -07: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
Todd Kennedy bdf1a7eb6e Fix unit test build
Change-Id: I8fcb16d4b10214668daac73a7cb9e274b07c154c
2011-03-01 08:45:16 -08:00
Todd Kennedy ffe6ef342a fix UnsupportedOperationException in tests
We're using the mock context to prevent modifying the real databases. However,
we need the real context to create intents. Use the real context in the few
places we must use it.

Change-Id: Icb8d289239218921c0b4b5c93ac7983830d90394
2011-02-23 14:51:45 -08:00
Todd Kennedy 8c89674b64 Always set a delete policy for legacy accounts
The delete policy can only be set for POP3 accounts. However, the delete policy
is used for all legacy accounts (that includes IMAP). As such, we need to make
sure IMAP accounts also have their policy set; even though the setting is not
configurable by the user.

The delete policy does not mean anything for Exchange accounts, so, we do not
need to modify the account setup code for them.

bug 3074164

Change-Id: Iab10d2997404b3b0c10a60a64fb652540c0d2d1a
2011-02-23 11:00:19 -08:00
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 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
Marc Blank ed9938cd9c Protect against threading issues in AttachmentDownloadService
Bug: 3391148
Change-Id: I513b5678815db262ea5660661336432f1e203c9e
2011-01-26 16:04:28 -08:00
Makoto Onuki c50b6f685b Use broadcast to detect system account update.
Instead of AccountsUpdatedListener.

Bug 3211657

Change-Id: I1e60092fc06fe80b9914ff7264c24fcbfa950745
2011-01-17 11:03:57 -08:00
Andy Stadler 201a24f51e Harden MailService against half-created accounts
* Add simple sanity checks to scanned accounts, skip over if bad
* Fix existing unit tests and add new unit test for this change
* Also fixed minor bug in EmailContent that was never triggered in
  production code (only discovered it via a unit test).
* Also fixed minor bug in an existing unit test

Bug: 2937595
Change-Id: Id60bbb5d8bd923db043d46891c7f89d7debb0a11
2011-01-06 12:53:40 -08:00
Marc Blank edb05ca5ee Harden AttachmentDownloadService; fix storage calculation
Bug: 3292720
Bug: 3286634

Change-Id: I378aac369ee8317c0c41b1f021a3731b81bcb380
2010-12-17 11:28:18 -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 eb49659423 Prevent MailService from spamming AccountManager during reconcile
* When any Account is modified, MailService gets a content notification and
  runs reconciliation in an AsyncTask.  Reconciliation ends up calling the
  AccountManager, which also runs asynchronously.  The net effect is that,
  especially during unit tests, where we create/destroy accounts rapidly,
  these calls can "back up", ending in a situation in which the worker pool
  for AsyncTask is filled, with a resulting RejectedExecutionException
* We fix this by preventing more than one request for reconciliation to
  be queued at a time
* Added a unit test that thrashes the notification handler

Bug: 2937628
Change-Id: Iaf25806efb46831f31704604360df091752d9525
2010-10-18 14:07:47 -07:00
Marc Blank fe6e3eae2a Fix MailService unit test
Bug: 2844726
Change-Id: I168b3db49bf422b33d05f25cfff1c7be15150c2b
2010-10-07 14:34:50 -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 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 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
Marc Blank 0e6d972641 Convert Controller to a full service
Change-Id: I2078fd047ff46f85936c8bf798a5edd3678bb5b4
2010-08-20 13:34:09 -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
Marc Blank e6cc662abc Use AccountManager for POP/IMAP; refactor setup classes
There are two major, interrelated parts to this CL:

1) Clean up the activities to reduce the use of Intents to pass
   information between activities; instead, we use a common
   SetupData structure that automatically saved/restored as necessary
   during the setup flow.  A fair amount of code and inconsistent
   use of Bundle extras has been eliminated in the process.

   * Create SetupData structure, setters/getters, and initialization
     methods to simplify the preservation of state during setup flow
   * Remove all state/flow extras from Intents; Intents now only
     specify the Activity to be started, which should greatly simplify
     the transition to Fragments.
   * Remove all state/flow fields from Activities
   * Modify existing setup activity unit tests and confirm tests pass

2) Create AccountManager accounts for POP/IMAP email accounts to
   provide consistency in user experience.  Also, internal flows are
   now identical as between account types.

   * Move account reconciliation from SyncManager to MailService, so
     that reconciliation is consistent between email and exchange
     accounts; move unit tests as appropriate
   * Add a "Sync Email" setting for POP/IMAP/EAS
   * Change MailService to respect the "Sync Email" setting in
     Settings -> Accounts & sync
   * Create PopImapSyncAdapterService to handle manual POP/IMAP sync as
     requested by SyncManager; add EmailSyncAdapterService to perform
     the same function for EAS
   * Use new PopImapAuthenticatorService to add AccountManager accounts
     for POP/IMAP accounts; setup appropriate stanzas in AndroidManifest
     and add related xml files
   * Update AccountSettings to use SetupData

Miscellaneous other changes:

   * Only allow valid port numbers in incoming/outgoing setup

Bug: 1712475

Change-Id: Ibdac52fb2c5578b86bf3992ddb1acd10f162391a
2010-07-21 19:01:41 -07:00
Marc Blank 42ff939e3a Prevent MailService from potential looping due to EAS accounts
* The code assumed that all accounts used the scheduler in MailService
  whereas only those using MessagingController do so (i.e. EAS does
  not)
* Change setupSyncReportsLocked to set the syncInterval for accounts
  that don't use MessagingController to Account.CHECK_INTERVAL_NEVER
* Add unit test for the changed code

Change-Id: I74a3dae21d9ec16f9903bdf2a1c28092ae89cc50
2010-07-02 11:47:03 -07:00