Commit Graph

69 Commits

Author SHA1 Message Date
Tony Mantler 8196f82ce2 Use update notification intent to trigger notifications
This ensures the SuppressNotificationReceiver object quiesces the notification while we're viewing the folder

b/11789666

Change-Id: I98f388844b29458e7ea7deee398f7d8536b1919c
2013-11-21 13:18:57 -08:00
Tony Mantler a2b82c1a92 Coalesce notification updates to avoid spamming the notification tray
b/11115818

Change-Id: I1d8bfbb87c279c9967eee7295f31ddd7728b200c
2013-10-18 10:24:44 -07:00
Tony Mantler 32614f3746 Clean up usage of Account.name when accessing account/folder prefs
b/11185963

Change-Id: Id928732bee5f67887252b1f949a8e4d396fffaa6
2013-10-11 16:44:57 -07:00
Tony Mantler ac1d3249fb Remove notifications while we still know what type of account this is
Also add null check just in case

b/11070468

Change-Id: I187b9b084512a2b994f4a0a3b750ade5eee50624
2013-10-04 12:27:20 -07:00
Tony Mantler 840408c41c Remove mAmAccount from the email provider account object
b/11070468

Change-Id: I51bad4be41800e4cd6dae42744005ade784cdf82
2013-10-04 10:21:25 -07:00
Tony Mantler f086deac70 Change notification code to key off android.accounts.Account
b/11023774

Change-Id: I6dd267591148378265b0f12c7ea6d74b450a0f3d
2013-10-03 13:26:55 -07:00
Andrew Sapperstein 5dcb447c04 Moved some stuff from Email to Unified.
b/10542802.

Change-Id: I9623ce85cae6f67ec647e1712e8c392a35311171
2013-08-29 17:41:26 -07:00
Scott Kennedy 1b8e0fa23f Clean up a bunch of warnings
Bug: 9565838
Change-Id: I5e95562bbf463f057cbcc4a9884427a774473b45
2013-06-25 15:34:32 -07:00
Scott Kennedy d8302b01fa Ensure notifications get cancelled when necessary
There were a few places calling the old notification code to cancel
notifications. These calls were completely unnecessary.

Also, when an account is removed, we now clear all notifications that
may exist for that account.

Bug: 7935576
Change-Id: I58f7e194c3f9a928e932b3b1b87475e7d3653b6a
2013-05-22 18:36:07 -07:00
Andrew Sapperstein 625409b169 CL to support method signature change.
Helps fix b/7923968. This is just a one-line
change. The real change is in the UnifiedEmail code.

Change-Id: I60808c0265e911394cbffa92214d10626769ca9a
2013-04-22 13:59:16 -07:00
Yu Ping Hu 7cc82371ec Improve error logging for mailboxNotification.
Change-Id: I5b16ac46ce8cdd6e8f791c9cea7d7ead7e053bdc
2013-03-28 19:10:23 -07:00
Yu Ping Hu 1dd937bf18 Prevent NPE when getting a bad mailbox id.
The mailboxNotification query apparently can return bogus
mailbox ids. This underlying bug still needs fixing.

Bug: 8482721
Change-Id: Icfbd0d986ab32fe878a0dbe09a3276322c75cafe
2013-03-26 15:00:30 -07:00
Paul Westbrook 95bb350f38 Fix NPE when adding account with security policy
When adding an Exchange account with a security policy, Email
generates a notification to let the user enable the policy. The
code that generates the notification attemptes to load the folder
as part of the base notification.  Before the account policy has been
configured, it isn't possible to load the folder.  We need to handle
a null folder when generating the notification

Also, imporoved the logging when an exception is thrown from the
PolicyService

Bug: 8341882
Change-Id: I33ff57adc3c130e8318910e352146b8ea56f9a2c
2013-03-07 23:00:47 -08:00
Scott Kennedy b34608228f Move notifications to UnifiedEmail
This involves redoing the persistence model, to split general,
account, and folder settings into separate SharedPreference stores.

It also requires some preferences to be moved into UnifiedEmail.

Depends on Ibe2e3f93ec164370535ffc5f5b2409544cc8d36d (UnifiedEmail)

Change-Id: Ie6ec389b5b5d2e7ab1b299d0877811ae716526e2
2013-02-08 09:48:22 -08:00
Scott Kennedy f9997921cb Change Email vibrate setting from tri-state to checkbox
Migrate the old value as necessary.
Update the unit tests.

Cherry-picked from I1c276ffde3496cbc66846ed4a007088d39f20382 with
minor changes.

Bug: 7624838
Change-Id: I1b3fa331b62f556701bacba5ce9cd64305d9b52a
2012-11-29 12:16:33 -08:00
Scott Kennedy 722b7bc29d Do not vibrate in vibrate mode if ringtone is silent
An empty string as the ringtone URI was triggering the system
vibration while in vibrate mode.

Bug: 7624838
Change-Id: Ide1cb2d8ac5d1295c18770bd053dd1cd0a50feb0
2012-11-28 18:33:00 -08:00
Paul Westbrook 986881efe6 Fix multi message notifications
When multiple messages are received, now the View intent
will take the user to to contents of the mailbox, instead of
the viewing the last message

I have filed bug 7216375 to track the issue about receiving
multiple messages in different syncs

Bug: 7129870

Change-Id: I3fdf4680c62565615fcbefc75d72c2a721942604
2012-09-23 13:11:06 -07:00
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
Mindy Pereira f986f44eca Reduced the number of calls that did the same thing in the Folder class.
The new method is just Folder.toString

Change-Id: I28fe0cc6e0adb110645941acd4990957283e5b03
2012-07-30 13:26:13 -07:00
Marc Blank dba0b20d95 Handle ALERT response to login command
* Allow AccountService loginFailed API to take a reason string
* Present the reason string in the dialog shown from the login
  failure notification
* Handle ALERTs in IMAP login responses (for example, some servers
  will occasionally require web login and we need to inform them,
  rather than simply saying the password is wrong)
* This fixes a longstanding bug in our Imap1 implementation

Change-Id: I8b270cd5d4746559b6c8a78bce02f0e7c525bdea
2012-07-27 13:36:41 -07:00
Mindy Pereira ab076fa633 Account and Folder are both json objects now.
We dont have a seperate parcelable account and serialized account
string (for pending and regular intents)

Fixes b/6805342 Email crash on opening message from notification bar

Change-Id: I5b310fbafefb8dd82b9e222421fb624703b1676b
2012-07-16 14:35:44 -07:00
Marc Blank f419287f22 DO NOT MERGE: Move emailcommon2 sources to emailcommon
Change-Id: I06df7e467cd2e0117df8b8db3ddc6ff9da13f1c7
2012-06-28 11:15:06 -07:00
Paul Westbrook 65432baf25 set FLAG_ACTIVITY_TASK_ON_HOME on notification intent
Bug: 6384825
Change-Id: I9fc577ab3acdc608ce6e1781d438cc049c6ddcd6
2012-04-26 18:26:57 -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 bc7f451442 Fix IMAP/POP notifications
* Make sure the default Inbox is always notified
* Use correct "new" count for mailbox

Change-Id: Id66c76e415589f6eb6fdad0649ae039fd45c1205
2012-03-05 10:23:38 -08:00
Marc Blank 9a5e2a798e Fix clearing of mailbox notifications
Change-Id: Ieb98a8908ec067229dd449790da55085585ef17b
2012-02-26 12:52:57 -08:00
Marc Blank bf5caf97c5 Notify by mailbox, rather than account
* Update EmailProvider, removing two no-longer-used columns in Account and
  Mailbox

Change-Id: Ie0f10eb0ca315d73e82be968f7760a51a239ba3f
2012-02-24 14:51:59 -08:00
Mindy Pereira 2df61456f4 Clear back stack and make this the top level stack.
Fixes b/5716835 back stack in email gets messed up in certain circumstances

Change-Id: I6fb593a520931b16e973f025c00709f7e76bb4d9
2011-12-08 13:36:47 -08:00
Marc Blank 2736c1a11c Rewrite of security policy handling and service code
* Remove PolicyService APIs policiesRequired, policiesUpdated,
  isSupported, clearUnsupportedPolicies, and isActiveAdmin
* Add PolicyService API setAccountPolicy, which is the sole
  method by which security policies are promulgated
* Add protocolPoliciesEnabled and protocolPoliciesUnsupported
  to the Policy class; these are packed, localized strings
  indicating policies that the protocol itself have enabled
  and/or cannot support (i.e. these are policies that are
  unknown to the DPM, e.g. don't load attachments)
* Differentiate in security notifications between three kinds
  of policy changes - changes that don't require user
  intervention (e.g. reducing requirements), changes that
  require user intervention (the legacy notification), and
  changes that make the account unsyncable (e.g. the server
  adding an unsupportable policy). Handle all possible policy
  changes cleanly.
* Make security notifications per account (with multiple
  accounts, notifications would get arbitrarily munged)
* Expose ALL enforced policies via the account settings
  screen in two categories: policies enforced (including
  both policies enforced by the DPM and policies enforced
  by the protocol) and policies unsupported (note that these
  can only be seen if policies are changed after an account
  is created; we do not allow the creation of an account
  when any required policies are unsupported).  Add a
  button that forces a sync attempt, for accounts that
  are locked out, but whose policies have changed on
  the server (this would otherwise require a reboot).
* Updated unit tests

Bug: 5398682
Bug: 5393724
Bug: 5379682
Change-Id: I4a3df823913a809874ed959d228177f0fc799281
2011-10-25 10:32:34 -07:00
Ben Komalo f13fee5d78 Drop in notification for multiple new mails
Bug: 5058000
Change-Id: Ic852004f8f154943742cf40ccfb6063a736d4cae
2011-08-17 17:10:06 -07:00
Marc Blank d9b2a8f237 Make "security required" notification ongoing
* While investigating the referenced bug, it was discovered that
  canceling the "security required" notification (with "X", rather
  than the "cancel" option in the dialog) causes the notification
  to be unavailable until a reboot
* This puts the account needing a security update in the position
  of being unsyncable, and might explain the referenced bug (we
  have no confirmation of that step; on the other hand, the tester
  can't now reproduce the problem, so an unusual action like this
  is to be expected)
* The fix consists of making this particular notification "ongoing",
  which prevents the user from dismissing it; arguably, this should
  always have been the case anyway...
* Consider this fix for backport into LTE and MR2 branches

Bug: 5072343
Change-Id: Ia7419236cf9389380d1e079b1a9a6f425015c487
2011-07-28 13:59:16 -07:00
Ben Komalo 48a3a1c51c Ignore notifications for unloaded messages
Seems like POP envelopes could get into the database and tickle the
NotificationController even before we got the full subject/sender. Just
ignore those things until the basic info is loaded.

Bug: 5061271
Change-Id: Iadfbff8a1615d2644880f5cae3727768f4f9549a
2011-07-22 13:31:47 -07:00
Ben Komalo 23a4b15e08 Fix notification issues.
- use title as ticker text
- also properly play notification sounds on new messages. Before, if you
left a notification unread, and a new message comes in, no sound would
be played. Since fixing that, it introduces another issue where on
initial sync, tons of new messages come in (and the sync could take > 1
min). We throttle them with a 15 second interval. The notification is
always updated to reflect the most up to date information, but sounds
will never be played closer than 15 seconds together.

Bug: 5020191
Bug: 5067059
Change-Id: I5ca474fd3b210ee856035bd78bd72931da80fe40
2011-07-22 12:06:11 -07:00
Ben Komalo eb9dcfaf18 Guard against null items in NotificationController
If the account is in the process of being deleted, large parts of its
data may be being removed in parallel with notification processing. We
never handled this very well.

Bug: 5058333
Change-Id: Ic588b68438a9c5829e7e3fd5c8d52e21a037b9f4
2011-07-21 12:24:18 -07:00
Marc Blank aca9426581 Remove NotificationService; use Account columns for data storage
Bug: 5023662
Change-Id: I84df3b474dd6320327851003af985144cc16348e
2011-07-19 18:19:59 -07:00
Ben Komalo e9188307f2 Fix notification Intent.
This changes it so that the message list is shown if there are multiple
unseen messages.

Bug: 5011855
Change-Id: I14cbcfaa32cc5e2b4cb718449c62b8f39b290d4d
2011-07-10 14:02:50 -07:00
Ben Komalo 6f93d2edca Update notification text according to design
- "UNSEEN new messages" is the title for multiple new messages
- the small number in the right shows the unread count

Change-Id: I48f761b727ea8abc9277d737a08789fa63d10871
2011-06-23 17:48:25 -07:00
Marc Blank 6e418aa41a Improve EmailContent caching...
* Guarantee that up to 16 Account (with HostAuths), and Policy rows
  are always cached.  Also, 6 commonly used Mailboxes per Account
  (Inbox, Outbox, Drafts, Sent, Trash, and Search)
* Precache these rows when EmailProvider starts up
* Ensure that newly added, precachable rows are cached when created
* Clean up some inefficient/wrong caching code
* Fix a commonly called method in NotificationManager in which we
  load a single Mailbox row using selection vs withAppendedId
* Confirm that we don't read from the database in typical use and
  heavy message loading
* Add a special URI for finding mailbox by type (using the cache)
* Add special-case code for EmailContent.count(Account.CONTENT_URI)
  which is used in a number of places (including on the UI thread)
  and whose value is easily determined
* Add a special URI to get the default account id
* Confirm that all unit tests work

The goal here is to be able to load all Account, HostAuth, Policy,
and Mailbox objects (by id) without worrying about disk access.
There will still be a single disk read for uncommon Mailbox reads,
but this should be considered acceptable.

Change-Id: Ibc9aa7acc73185e360b0b6f3053b90a985e97210
TODO: Unit tests
2011-06-21 21:39:19 -07:00
Marc Blank f5418f1f93 Move Account into its own top-level class
Change-Id: Ide7c991b7d4d418dbe17164421425bf898ba64ee
2011-06-13 15:37:22 -07:00
Makoto Onuki b36ac01792 Changes for NO_XXX
- Added Message.NO_MESSAGE
- Renamed PSEUDO_ACCOUNT_ID_NONE to NO_ACCOUNT
- Removed PARENT_KEY_NONE and use NO_MAILBOX instead
- For starters, cleaned up the UI controllers to use them.

Change-Id: I6cfd87ece2fced8e9f7c76d034c4d1dbf9e4db10
2011-05-17 14:36:00 -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
Ben Komalo 2866284a6d Rename AccountSettingsXL -> AccountSettings
This activity already supports phone and tablet mode.
Only renames in this change - no other change.

Change-Id: Ieca17137af45e3860812091f69cd4d9b55ddf3ec
2011-05-13 09:58:15 -07:00
Todd Kennedy f437892348 Open message if only one message in notification
If there is only one unread&unseen message in the notification, clicking the
notification will automatically open the message view fragment. Otherwise,
the message list fragment will be opened.

Change-Id: I22778258836a36f289d71b99a6214ec82778f385
2011-05-13 08:41:48 -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 e7fb4ac9e3 Add account observer to NotificationController
The notification controller now observes changes to the account database and
adds or removes message observers as appropriate.

Change-Id: I1670fcfd6ce744030199b86708a6ada55b239a84
2011-05-11 17:22:56 -07:00
Todd Kennedy dfdc8b6da3 Fix NPE in NotificationController
bug: 4409317
Change-Id: I7e515ba7c4fa7114e2bf9ecf6cb473cb3506ad1c
2011-05-11 13:45:42 -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 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
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
Todd Kennedy 958b15e8f3 basic code cleanup of the notification controller
* javadoc methods
* rename some methods
* remove duplicate code; now new message and other account notifications
  are created with the same code

Change-Id: Iecf70494b6407a9a73380de103390a59d006191b
2011-04-28 11:58:49 -07:00