Commit Graph

164 Commits

Author SHA1 Message Date
Marc Blank 25ab2df296 Fix typo and comment
Change-Id: Iffc69baf98c05a09693ba9a053c91d921fc1b423
2011-03-02 09:37:00 -08:00
Marc Blank 81273dfcee Fix deadlock issue in AttachmentDownloadService
* When a connectivity wait was added to processQueue, I neglected
  to consider that a lock was held during this time
* The fix is to move the check for connectivity out of processQueue

Bug: 3500702

Change-Id: I646cf899ff895d9838612e89b15b66f1084840b1
2011-03-01 13:43:44 -08:00
Marc Blank fdec974c93 Send logging information to Exchange when deviceId is retrieved
* Clean up logging to indicate the actual Service being used

Change-Id: I55f87487389accb1aad9b0cc03eff945ea0b1f3e
2011-02-27 12:08:36 -08:00
Marc Blank dc78a769fc Email split, part dix
* The coup de grĂ¢ce for Exchange in Email
* Remove Exchange bits from AndroidManifest
* Update Android.mk to create static jar for emailcommon
* Delete all com.android.exchange files
* Delete all exchange-only strings
* Change loadAttachment service method to take only attachment id and
  background flag
* Add code to AttachmentProvider.openFile() that opens an output file
  for attachment writes
* Make sure deviceId is determined in Email app (not Exchange)

Bug: 3442973
Change-Id: I775600252fd121f474d51cb26fefbfcc50e387af
2011-02-25 10:46: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 37500777f1 Email split, part sept: Configuration
* Add getConfigurationData api to AccountService; this allows clients
  to get configuration-related data from the Email app
* We use this so that Exchange can determine whether alternative strings
  should be used

Bug: 3442963
Change-Id: Ieea56e3416458dc57699b00c2fc062dfcf7abca9
2011-02-14 11:24:28 -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 9ba506c4dd Email split, part deux: PolicyService
* Split PolicySet from SecurityPolicy and move to emailcommon
* Define PolicyService that sync adapter services can use to
  interact with the Email DPM administrator
* Implement PolicyServiceProxy for exchange
* Implement PolicyService in email
* Modify imports, references, etc. as required

Bug: 3442973

Change-Id: I92015e21f780a68754b318da89fbb33570f334a2
2011-02-10 13:53:37 -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
Makoto Onuki 314a51cb1d Refactoring widget
- Moved to com.android.email.widget
- Extracted nested classes to top-level classes
- Some small clean-ups.
- WidgetProvider and WidgetProvider$WidgetService are left in the original
  package to keep compatibility with honeycomb (3.0) release.

This CL is supposed to be pure-refactoring.  There should be no
functionality changes.

Change-Id: I37acaa24b6b488724750c0f33374b31fcc433f11
2011-02-08 13:10:42 -08:00
Makoto Onuki 943e02c97d Merge "Add debug setting for one-minute refresh" 2011-01-28 14:30:55 -08:00
Makoto Onuki 5907d39d2b Add debug setting for one-minute refresh
Bug 3377054

Change-Id: I7843fe82d66ab7896b8293b2fa16ca73f6711595
2011-01-28 14:16:56 -08:00
Makoto Onuki 9c44430690 Fix AttachmentDownloadService for remove-exchange script
Now the source at least compiles fine.

Change-Id: I329ad08f81fd6ab23f28dd30023fe3e781ccc4fc
2011-01-28 11:22:51 -08:00
Todd Kennedy 6c5ee59c4f Add "tap to configure" text to widget
If there are no email accounts defined, the widget should show a single string
that allows the user to create a new account. Whenever there are changes to
the defined accounts, the widget(s) will update their headers to ensure they
are only displaying valid information.

bug 3296594

Change-Id: I156c20cfc90692174297a2aededd85775e0ea196
2011-01-26 17:58:51 -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 2d0e44f201 Fix NPE in AttachmentDownloadService
Initialize mConnectivityManager before starting the thread.

Bug 3389701

Change-Id: If616721ad3b3bec81c5d6920f4a5d91b06f937fb
2011-01-25 15:30:15 -08:00
Marc Blank 3ef8f54bae Prefetch respects "background data" setting and waits for connectivity
Bug: 3384997
Bug: 3384994
Change-Id: Id8338650b69666f2996837324e27c2e98c9261fe
2011-01-24 18:39:50 -08:00
Todd Kennedy 751e4b2d95 Prevent auto-download of attachments not in an inbox
When creating the list of attachments to be automatically downloaded in the
background, exclude any attachments that are not in an inbox. Also added unit
tests to ensure the query URIs behave as expected.

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

bug 3373982

Change-Id: I13ef56cd280c028fa966ab9e655acce28b0b9b91
2011-01-24 13:43:14 -08:00
Todd Kennedy 819db01ead Limit attachment background download attempts
Do not retry downloading attachments infinitely. After some number of failures,
black list the attachment and move on. The black list is not persisted, so,
restarting the app will again try to fetch the attachments. In this way, any
transient network failures will not permanently affect the ability to download
attachments in the background

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

bug 3373982

Change-Id: I7f3ad9667ebebb95fbba95278b62bf40c5fce67c
2011-01-24 10:19:46 -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 475c20d3a8 Implement checks before performing background attachment download
Bug: 3339007
Change-Id: I36a8359f3478c37b2ccd6a0cf0381569c592061a
2011-01-19 19:20:38 -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
Makoto Onuki 36cc9c18ed Fix NPE in AttachmentDownloadServiceTests.testDownloadSet
Bug 3353834

Change-Id: I5cf475ff174bffce80a435c80b1fd85c0be146e9
2011-01-14 11:47:26 -08:00
Marc Blank f6fe21b483 Merge "Check download request before trying to remove it from the queue" into honeycomb 2011-01-11 13:22:39 -08:00
Marc Blank 782c21e953 Check download request before trying to remove it from the queue
Bug: 3312633
Change-Id: I443d9a8f786f93c7cd72b6b96ea838bf0d05f4d4
2011-01-11 11:45:36 -08:00
Marc Blank 75396e175d Merge "Remove STOPSHIP from AttachmentDownloadService" into honeycomb 2011-01-10 11:29:42 -08:00
Marc Blank 33799ad2d0 Remove STOPSHIP from AttachmentDownloadService
Bug: 3335071
Change-Id: Ia6a8e2e7378510db234c4ec5164cb5ef39c529d7
2011-01-09 18:30:24 -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 cbdd9f78b2 Distinguish mailbox requests that are user requested
Bug: 3251757
Change-Id: Ie417ebf44c8b740db88e5854077782930359a958
2010-12-31 11:02:03 -08:00
Andy Stadler a2269e84c6 Remove disk access from DeviceAdminReceiver callbacks
* DeviceAdminReceiver is actually a BroadcastReceiver, must follow
  guidelines to prevent ANR or early process kill.
* Remove all uses of AsyncTask from DeviceAdminReceiver
* Pass all calls through EmailBroadcastProcessorService
* Minor restructuring of EmailBroadcastProcessorService to support
  this use.

Change-Id: Ic6257ea5eff1bd466a736e0f93cb89b1cf8aa73e
2010-12-30 00:16:55 -08:00
Marc Blank 7fbcefff7d Respect user's background download preference
Bug: 3312462
Change-Id: Ibd77b8de8782c4681ed122ac2f30374ca695e0ef
2010-12-30 00:05:15 -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 6ebaa90847 Reduce/eliminate UI thread access in MailService
* Make most calls to AccountBackupRestore return immediately w/o DB access
* Move most workers in MailService into async runnables
* Remove account restore / null check from ACTION_SEND_PENDING_EMAIL
* Strengthened unit test on Mailbox.findMailboxOfType() because after
  removing the account check (above), sendPendingMessages depends on
  findMailboxOfType() returning -1 on a missing account.
* Clean up a bunch of warnings (no longer use deprecated Config.LOGD)

Bug: 3133763  (and probably others)
Change-Id: Id39707bca7a8ebf5000f84d542013411ff0f422e
2010-12-22 16:34:48 -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 69fc25244b Move download cancel logic into helper
Bug: 3255707
Change-Id: I7f92bd1bb90a4430426123551075746ba9d4af85
2010-12-08 16:57:59 -08:00
Marc Blank 3bbc690600 Add watchdog to AttachmentDownloadService
* Detect attachment downloads that have stalled and restart them
* Catch a couple of cases in which we weren't sending callbacks

Bug: 3122242

Change-Id: Id2bfd3b26182004b301cf8665f4feb6e62b98b73
2010-11-30 10:16:05 -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 fdc41d4ffc Delay appearance of "stop" button when loading attachments
Bug: 3082804
Change-Id: Ib8b0fcec36a7303b2094bd0e49645d11aa2ff2db
2010-11-01 13:48:53 -07:00
Marc Blank a7fbf44511 Merge "Harden AttachmentDownloadService" 2010-10-29 16:29:13 -07:00
Andrew Stadler 34e6205d44 Simplify setupSyncReportsLocked
* Remove three unneeded DB lookups
* Eliminate race condition that could cause NPE
* Remove protocol field from report, it wasn't needed (we already
  set the sync interval to -1 which has the same effect.)

Note, the problems were introduced unintentionally, due to the merged
result of three different CL's:
 I168b3db49bf422b33d05f25cfff1c7be15150c2b
 I74a3dae21d9ec16f9903bdf2a1c28092ae89cc50
 I53e935f8bf08e0bda6e2cd483229a6377ed39d74

Bug: 3139451
Change-Id: Iadbed267f88808aeace0a2f011e4acf79074af70
2010-10-29 11:38:28 -07:00
Marc Blank b961c78ff4 Harden AttachmentDownloadService
* It's possible that endDownload will be called for a request
  that has been dequeued.
* Harden endDownload against this eventuality, so that we clean
  up properly without throwing exceptions

Bug: 3142618
Change-Id: If61136ed1ea972248fc5f9388beaaf84754f9931
2010-10-28 17:21:28 -07:00
Andrew Stadler 4f71ade96e Remove BOOT_COMPLETED log.
Change-Id: I3eb06076ad61dab0f38e32e736e7dbbcf8dde065
2010-10-27 16:19:55 -07:00
Marc Blank eed42e83ab Cleanup for dump() in AttachmentDownloadService
Change-Id: Id875d3278953ecb3a98ab8b1d290f3883e974c4f
2010-10-27 08:59:13 -07:00