Commit Graph

52 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
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
Makoto Onuki 308ce92847 Better fix for the PendingIntent issue.
Refactor the changes introduced in Ib02842bb.

- Now Welcome and AccountSettingsXL accept intents with URLs of the following
style, and get IDs from query params, rather than extras.

Welcome:
content://ui.email.android.com/view/mailbox?ACCOUNT_ID=1&MAILBOX_ID=2&MESSAGE_ID=3

AccountSettingsXL:
content://ui.email.android.com/settings?ACCOUNT_ID=1

- Now the "new message" and "login failed" notifications use these new style
intents, so the system wouldn't merge PendingIntents for different accounts.

Also:
- Moved all notification creation logic to NotificationController.
  (Except the one in CalendarSyncEnabler; which is used only to support
  upgrading from pre-froyo and I don't think it's worth refactoring.)

- Note the "password expired/expiring" and "security needed" notifications
aren't changed; they still use extras to store account IDs.  This is okay
because these notifications are not per-account.

Bug 4065269

Change-Id: I70737438d2e7c45fd7488a5b0a7105c8568e02f7
2011-03-23 14:49:38 -07:00
Makoto Onuki 553037ba4e Merge "Fix NPE in NotificationController" into honeycomb-mr1 2011-03-09 16:03:17 -08:00
Makoto Onuki 43c455eb26 Fix NPE in NotificationController
This would happen when a message has no from addresses.

Bug 4027170

Change-Id: I1da091a6a55b274805ee6b3e109cbeb55a21fae1
2011-03-09 15:12:30 -08:00
Makoto Onuki dd6e6b8504 Fix bug 3509555 make notification always open right account
The problem was that:
- Each account now has own new message notification
- But PendingIntens for these all point to the same activity,
  only with different long extras (for acount IDs).
- Framework merges these intents, because extras don't count
  as a "difference"  in this case.
- So when multiple new message notifications are shown, they'll
  all share the same intent internally, so they'll all open the
  same account.

A quick workaround seems to be to set a unique URI to each intents.

Bug 3509555

Change-Id: Ib02842bb32634cfdf01ae2d684dd04dfede23832
2011-03-09 10:24:36 -08:00
Andy Stadler f489413142 Add contextual dialogs after notifications
* When security settings notification is clicked, inform user that
  they need to change settings (before dumping them in security
  settings.)
* On an authentication failure, present a dialog to the user explaining
  that the username or password may be incorrect.
* When the device pin/password is expiring or expired, present a dialog
  to the user explaining that it needs to be updated.

Bug: 3238657
Change-Id: I8fca446fa3c1bf87a95938553dbdc362c3df220e
2011-02-18 18:23:18 -08:00
Andy Stadler c6d344ad2a Refresh email notifications (part I)
* Use strings that fit properly in new notifications
* General cleanups & rewrites from Roy
* Remove showWarningNotification() and use postAccountNotification()

This is part I.  Part II will add dialogs triggered by some of these
notifications, to provide more explanation to the user of what's wrong
and how to fix it.

Bug: 3238657
Change-Id: Ib51bcb4412f8a09a6f97653f0b5f8642efe2ac1e
2011-02-16 16:38:18 -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
Todd Kennedy 8d8537cd2e Resolve build warnings; part 3
Fixes deprecation warnings

NOTE: This does not resolve hostauth deprecation; that will be fixed
in a separate CL.

Change-Id: I47115516da34effbf885615cb439c9d3e6f95b84
2011-02-03 12:43:12 -08:00
Andy Stadler c1c3b6f21e Use generic contact icon for notifications & messages
* Copies the icon from contacts
* Used whenever the sender doesn't have a local photo
* Used in notifications and in messageview

Bug: 3282187 (notification)
Bug: 3285156 (memory leak from the placeholder graphic)
Change-Id: I528cae20355aa8cce7be37b26f32aa90e092708b
2010-12-15 15:26:30 -08:00
Makoto Onuki 74e094834c New style for the new message notification
Bug 3176956

Change-Id: Id7418fb8bb942230266815167f0a2e79062a9116
2010-12-06 14:51:19 -08:00
Andy Stadler 1ca111c19c Add password expiration plumbing
* Set aggregated expiration values with DPM
* Fix min/max logic when aggregating, and fix unit test
* Add expiration tests when checking if policies are active
* Add expire-password to uses-policies set
* Handle password refresh (clear notifications and sec. holds)
* Handle password expiration (warning and/or wipe synced data)
* Unit tests for provider-level methods
* Refactor common security notification logic
* Placeholder notification strings (need final)

Bug: 3197935
Change-Id: Idf1975edd81dd7f55729156dc6b1002b7d09841f
2010-12-01 12:58:36 -08:00
Makoto Onuki 8d3ef1d01e Correctly set intent to new message notification
Bug 3219763

Change-Id: I7826e762713228ee4ca1ca1d57b4d7603df81a66
2010-11-22 11:36:17 -08:00
Joe Onorato 2e578032d0 Use new notification API to get the new features.
Change-Id: I47a6c46ebb7999663ec16f049c99c418f4333213
2010-11-21 16:26:33 -08:00
Makoto Onuki 6f3d167cfa Don't show non-incoming message in notification.
Filter out non-incoming messages using a subquery.
(because the message table doen't have the mailbox type.)

I was initially thinking of adding a new content URL for
the message table joined with the mailbox table, but it turned out
to be a bit of pain, so ended up using a subquery.
(one of the problems was that both tables had the "_id" field.)

Bug 3177220

Change-Id: I276efb70db1589835f3ddb8c7da4773e72d8691b
2010-11-10 10:22:41 -08:00
Makoto Onuki 7126e5ae53 Fix & clean up intent handling
- Make sure an account shortcut really opens the account by
  adding the FLAG_ACTIVITY_CLEAR_TOP flag to shortcuts

  * Shortcuts have to be re-created for this fix to take effect.

- Remove Welcome.createOpenCombinedInbox/OutboxIntent, which don't work
  with the new combined view.

  * createOpenCombinedInboxIntent() is not used already
  * createOpenCombinedOutboxIntent() is used, but is not final UI, so
    removing it is okay.

- Fix MessageListXL.actionOpenMailbox -- now it really uses the passed
  mailbox ID.

Bug 3144066

Change-Id: I2ee3f84c62a135351c10266c7ca6d5178c3a0ca2
2010-11-02 18:18:43 -07:00