Commit Graph

95 Commits

Author SHA1 Message Date
Marc Blank e714bb9d15 Convert authorities, intents, and account manager types
* Tested ok on wiped Nexus
* Tested ok on S3
* Upgrade verified on Nexus

Change-Id: If5d4ce594f8a309cdb59589d10b1d33f3b79326c
2012-08-31 23:26:36 -07:00
Marc Blank 70edcf0538 Integrate Imap2 into Email
* Also, convert imap accounts to imap2
* The original imap service remains, but is no used
* There remain some questions about how the upgrade
  should work in terms of settings

Change-Id: I0e05edad6a1553f428a2c2fa3daf1df878d4b5f7
2012-08-22 14:17:57 -07:00
Marc Blank f419287f22 DO NOT MERGE: Move emailcommon2 sources to emailcommon
Change-Id: I06df7e467cd2e0117df8b8db3ddc6ff9da13f1c7
2012-06-28 11:15:06 -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 c84467afe1 Start of IMAP conversion to Service architecture
* Handle startSync and loadMore
* Use SyncManager rather than MailService for periodic sync
  and upload sync
* First of many CL's to disentangle sync from UI
* Note that the large majority of this CL is a refactoring
  of IMAP specific code out of MessagingController and into
  ImapService; MessagingController will eventually be
  removed entirely from the app, as will much of Controller

Change-Id: I13546d0694479b33cf93c25920dedc1d38227f6c
2012-02-13 11:04:56 -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
Ben Komalo 7688300055 Fix sync window settings for EAS setup on phones
- the container is the one that should be visible/gone - individual
fields should just be visible
- also do drive by javadoc fixes

Bug: 5052310
Change-Id: I45c4b6b7f94b2b62ac94eeff0ab97bf34c9e117a
2011-07-20 11:27:11 -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 9863dac3ee Prevent NPE when creating account...
* Yet more whack-a-mole

Bug: 4544677
Change-Id: I35eb0850b3abb13ca82dc5b19bb5511d894b5722
2011-06-23 10:52:21 -07:00
Makoto Onuki 9dad9ad973 Move restore account to EmailProvider.
In order to reduce the UI initialization code, move
let EmailProvider restore accounts when it opens the DB.

Backup can be moved too, but I just leave it as a TODO.

Change-Id: Id5c1810904db6abaecbfecbaa8d2d53834ebf07b
2011-06-20 18:19:17 -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 577ddb7dd7 Remove notifyNewMessages() service callback
Since the notification controller now operates exclusively using database
observers, there's no reason for the exchange service to call the
notifyNewMessages() service API.

Change-Id: Iaa7e2f5eae786162eab23b02b03ce6d1e8a738e9
2011-05-13 09:10:28 -07:00
Todd Kennedy 5701e0a555 Suspend notifications for currently shown account
We will suspend notifications whenever we display the message list for an
account (including "combined inbox").  As soon as the message list is paused,
notifications will be resumed.

Change-Id: I481a0f59ce68f89c32210d862d0267f3f334063b
2011-05-12 14:03:14 -07:00
Todd Kennedy bb7787bd3d Merge "Create a new notification service" 2011-05-11 07:55:58 -07:00
Todd Kennedy 71bd208ddd Create a new notification service
We can remove the preferences stuff 'cuz the service "should be" longer
living. And, even if the service is terminated (either by the user or by
the system) we'll receive a new notification when the service comes back.
This is probably desired behaviour anyway.

Change-Id: I4850a9473401536e8fb20385b780d4736ce80a8e
2011-05-11 07:54:07 -07:00
Todd Kennedy d31d64d330 Merge "Use observers to manage new message notifications" 2011-05-10 17:09:07 -07:00
Todd Kennedy 83693a6aca Use observers to manage new message notifications
We were sort of using observers to maintain the new message notifications.
However, other parts of the code would poke into the notification controller
to set things such as a list of newly added message IDs. Now, we rely
exclusively on db observers to manage notifications.

As a side effect of this, we now set the notification text correctly to be
the most recently _added_ message. This may be different than the most recently
sent message [since there may be a non-negligable delta between when the
message was sent and when it was received].

NOTE this still suffers from an outstanding bug where we continue to get
notifications when the Eamil UX is visible. That and monitoring changes to the
account table will be addressed in future CLs.

Change-Id: I4c68273716cc685574a1ca71e5d634f53fe0d882
2011-05-10 15:36:07 -07:00
Marc Blank 0993190caf Complete rewrite of account backup/restore code
* Use EmailProvider to backup/restore into a backup database
* Remove all of the old AccountBackupRestore code
* Get rid of the legacy Account class and all of the Preferences
  crap that referenced it
* Remove corresponding tests

Change-Id: I2de75aafdacc87246174303961e58547303f641e
2011-05-09 10:39:17 -07:00
Todd Kennedy c4cdb11d24 Remove notification if messages seen off device
If we receive new messages, we may display a notification to the user. If
those same messages are read elsewhere (i.e. via a web client), we will
remove the notification.

Change-Id: Iba09afe01942e0deaac8210fd6f9b315b1c8c93f
2011-05-05 12:00:27 -07: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 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
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 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
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
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 d3e4f3ca7e Use notifications for login failures
* For now, clicking on the notification takes the user to the
  Welcome activity, as we don't have final flows for the new
  account setup UI
* Need comment on strings; the problem is that notification
  text must be rather short if we're to use the standard
  notification display.  It looks like newer UI will allow
  3 lines instead of 2, however.
* Tested w/ IMAP, POP3, EAS, and SMTP

Bug: 2322253
Change-Id: I7ed6fa5599179870cbcdb14af062e956eff37ec5
2010-10-27 08:56:37 -07:00
Jean-Baptiste Queru 9a9c725174 Merge a059c4a1 from gingerbread-plus-aosp
Change-Id: I955120aff44d69bcd6fde165ac7ac974acbd3c78
2010-10-22 05:55:38 -07:00
Marc Blank 2a08ef0d28 Don't allow MailService to schedule EAS accounts
Bug: 3120208
Change-Id: I53e935f8bf08e0bda6e2cd483229a6377ed39d74
2010-10-21 16:49:41 -07: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
Makoto Onuki 241f18f237 Fix when to clear notification
I was assuming MailService.resetNewMessageCount cleared notification,
but it didn't.

Doing it in Activity.onResume is clearly wrong because we don't always
have an account ID there.  If we don't, we're passing -1, which clears
all notifications for all accounts.

We're now calling resetNewMessageCount() in MessageListFragment,
when we refresh the list, so we can remove it from onResume() for the Phone
UI as well.

Bug 3074056

Change-Id: Ib0bb2fbb0309a0784fb3a525927102f423e930df
2010-10-08 13:51:23 -07:00
Makoto Onuki 4b0d4f9f4d Fix "+ -1 more" in notification.
Need to reset lastUnseenMessageCount with unseenMessageCount.

Bug 3069406

Change-Id: I867dfaeb2d39cfd3511f956d60d2187031291780
2010-10-07 15:14:40 -07:00
Marc Blank fe6e3eae2a Fix MailService unit test
Bug: 2844726
Change-Id: I168b3db49bf422b33d05f25cfff1c7be15150c2b
2010-10-07 14:34:50 -07:00
Makoto Onuki 899c5b8661 Switch to tablet style notification
- Now we show separate notification for each account
- New notification has sender photo, sender name, and subject
  of the latest email
- Added the NotificationController class, which is intended to manage
  all notifications besides "new message" eventually.

The framework doesn't seem to be 100% ready, and it's not clear how to
add the 3rd line in the expanded notification at this point.  Need to
revisit it later to verify UI details.

Change-Id: I40193ee372cb6b2b7245c1588890f238b2469699
2010-09-29 18:35:17 -07:00
Makoto Onuki 08346b67b8 Refactor for new notification UI
- Move the notifiaction code into a bg thread.
  We need to access db to fetch the latest message
- Extracted ContactStatusLoader.load to synchronously load contact
  pictures.

Change-Id: I282ffb706ea8e14558bf29880a0fb952868b27e5
2010-09-24 16:22:47 -07:00
Makoto Onuki 550aa6163f DO NOT MERGE: Clean up member variables.
- Fix misnomered fields.  (e.g. static mMember -> static sMember)
- Reduce visibility.  (e.g. mark as private)
- Mark final / static if possible.

Note it's on master.

There's a lot more cleanup oppotunities in the activities, but they're going
to go through a major overhaul, so I didn't bother.

Backport of b3f7dd0169

Change-Id: Ic33f9518f23805716e2aec0ab42edb92107e066c
2010-09-20 14:03:29 -07:00
Makoto Onuki 261d6c3f0c Notify only account cursors when resetting new msg count
- Resetting the new message count is now correctly done on a BG thread.
- Added special content provider URI to reset the count.
  (/resetNewMessageCount)
- This URI only supports update, which will notify only account
  cursors.
- Fixed a problem that an insert with MAILBOX_ID/MESSAGE_ID/ACCOUNT_ID
  triggers two notifications.

- This CL changes how we use notification URIs, but unfortunately
  no tests for this part.  It turned out MockContentResolver doesn't
  support the notification mechanism, which made it very hard
  to write tests.

Bug 2911646

Change-Id: I35b30a7e6bf2d57510486c7ed19b9f263d8c9b58
2010-09-15 10:53:17 -07:00
Makoto Onuki 0be2d85bb8 Make notification open XL activity on tablet
* Now notification kicks Welcome, which knows which
  activity to use.
* Extracted cancelNewMessageNotification
* Also fixed 2909215.  There'll be only one XL activity on the app stack.

Bug 2945369
Bug 2909215

Change-Id: I2a7fec0d48a7618375cae55138ca51fefc70ff6e
2010-08-26 13:17:41 -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 0e6d972641 Convert Controller to a full service
Change-Id: I2078fd047ff46f85936c8bf798a5edd3678bb5b4
2010-08-20 13:34:09 -07:00
Marc Blank 09fd4d0a18 New asynchronous attachment loading code
* Create AttachmentDownloadService to manage all attachment downloads
  1) User requested
  2) Required for email forwarding
  3) Opportunistic downloads to enhance offline use
* New attachment related UI (pending UX approval, of course)
  1) MessageView (attachment actions, progress bar, etc.)
  2) MessageCompose (attachments for forwarded messages)
  3) Associated toasts, notifications, etc.

TODO:
* Unit tests
* Cache Management (separate CL)

Change-Id: I7864a5fb1c3f4f2be68d98341a971edc6cbacfe1
2010-08-19 14:01:08 -07:00
Marc Blank d14229872a Fix NPE in MailService
Bug: 2873538
Change-Id: Ida9135d3c8090abb63424cc2b2cb1b848785d571
2010-08-18 13:17:21 -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