Commit Graph

129 Commits

Author SHA1 Message Date
Marc Blank 3594ac8146 Implement initial UIProvider operations (UnifiedEmail)
* Add support for folder list, conversation list, and message view
  queries
* Open up EmailProvider (temporarily) to allow access from
  UnifiedEmail (signatures don't currently match)
* Modify make file so that we can reference definitions in
  UIProvider

Change-Id: If73c59aa9edfdac5619ff2c6b9cedfdfe4e93d6f
2012-01-12 11:18:01 -08:00
Paul Westbrook 75987dbe0c am 17d522b5: am 07676012: Fix widget updates
* commit '17d522b51c9aa564e1989095e0264264642c2432':
  Fix widget updates
2012-01-09 16:37:39 -08:00
Paul Westbrook 07676012f7 Fix widget updates
Fix widgets that stop updating.  If the Launcher got killed, the Email
widget service gets unbound.  When this happens the cursor loader for the
widget is stopped.  Since widget is relying on the loader to update the data,
when the loader is stopped, the widget would never update.

Now when email recognizes a change, it will send a broadcast intent, which
will cause the widget service to be started, if it isn't.

Bug: 5811810
Change-Id: Ia840e58f10e780b94440119662c2e48e7785c507
2012-01-09 13:14:47 -08:00
Marc Blank c31736c0d7 am af637589: Fix typo in CL; sigh
* commit 'af6375894fe4b405f205a22a7ee9118a36fef428':
  Fix typo in CL; sigh
2011-11-11 15:13:50 +00:00
Marc Blank af6375894f Fix typo in CL; sigh
* Facepalm

Bug: 5582884
Change-Id: I060518a4bbb2c08e1abef934c81d72ec4fbcb565
2011-11-10 17:08:54 -08:00
Marc Blank 406641ce09 am 00099da1: Merge "Make EAS Email syncable after GB/HC -> ICS upgrade" into ics-mr1
* commit '00099da1b3b9d91574187e70182e5384debb3731':
  Make EAS Email syncable after GB/HC -> ICS upgrade
2011-11-09 21:19:26 +00:00
Marc Blank 8ff1842ab1 Make EAS Email syncable after GB/HC -> ICS upgrade
* In the same upgrade step in which we add AccountManager accounts
  to IMAP/POP accounts, we now make Email syncable for EAS accounts
* This step is hit by all users upgrading from GB/HC -> ICS

Bug: 5582884

Change-Id: I11a06e2ad72ffed20c31f5d8be81705642f552a5
2011-11-08 09:16:15 -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 2c57e7036d Fix upgrade code.
In HC MR2 we introduced a column for a parentKey, but AFAICT, did not
use it. It was populated with a null value. The first upgrade code in
ICS assumed it was '0' which failed to upgrade it properly.

This prevents IMAP accounts from being broken when upgrading from GB ->
ICS.

Bug: 5252620
Change-Id: I000253b7c02ac1706710bdb21a820293f09cbea5
2011-09-13 17:18:34 -07:00
Ben Komalo 32bed4bb8e Fix unit tests.
- make attachment download service injectable
- fix assertions for account manager account checks
- update message compose ID's so they're consistent on tablet/phone

Bug: 5198343
Change-Id: I9976f5b9e5590dd61fb0a62937d3f9203fefe236
2011-08-24 10:24:42 -07:00
Marc Blank a08f654a1a Merge "Catch case where provider reports returning null in error" 2011-08-05 09:56:35 -07:00
Marc Blank 577e604df0 Catch case where provider reports returning null in error
* Missed this one

Change-Id: I080bd3b910827336fcfde818564067db5b4ec3cc
2011-08-05 09:50:56 -07:00
Marc Blank 20b511ff68 Handle GB->ICS upgrade of POP3 accounts properly
* Heh.
* We were using the login from the HostAuth in creating the Account
  Manager account, but it should be the email address from the
  Account itself; in IMAP (and usually in POP3) these are the same
* But not for juno.com!
* Updated unit test coming in another CL (tests are broken in a
  strange way, and the bug is FAST-blocker)

Bug: 5110013
Change-Id: Id11799e8b30a0420804f00c2d2f265e44e39c4c0
2011-08-04 19:03:07 -07:00
Marc Blank 36aef9fb74 Add logging to v21->v22 upgrade; small cleanup
Change-Id: I6659998a3ad2490c923061aab5328469c3222e25
2011-08-02 11:51:21 -07:00
Marc Blank 27a04fecfb Fix EmailProvider database upgrades
* Two of the upgrades (v21->v22 and v25->v26) need to be fixed so
  that they don't reference columns that might not exist.
* Oops

Bug: 4439595
Change-Id: I4a8c556be22bb85fb78807416cd1d6b81c6ef118
2011-07-29 21:53:44 -07:00
Marc Blank 0306da14e3 Correct recently added EmailProvider logging
Change-Id: Ica61b7bcbe455448a1a261c83defa840ab1abf3e
2011-07-27 21:57:06 -07:00
Marc Blank 7390b18776 Log return of null from query()
* This shouldn't happen, but ... log it just in case

Change-Id: I8b8df3fec84c9dd14ebb222ee665b0712f63f213
2011-07-27 16:48:35 -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
Marc Blank b2a8c2ce4c Start/stop AttachmentDownloadService as needed
Bug: 5033646
Change-Id: Ic0e75b28d0d8d5665c3f3ca864a9532fee05df8c
2011-07-17 18:06:20 -07:00
Ben Komalo 4de538be2d Prevent account flip flopping from compose
There were two issues:
- the default account ID from the provider wasn't consistent: it was
using a snapshot from the cached data but that simply returns a Map, and
the values aren't guaranteed to be sorted (and indeed I saw that the
order was different on consecutive calls!)
- hitting app up from Compose always just kicked you out to the inbox
for the default account, but it probably should have used the account of
the compose screen, since it can be specified in the Intent

Bug: 5012008
Change-Id: Ic9a753b261e047790453bc1a9417bc0c6d2f87f9
2011-07-13 14:46:50 -07:00
Marc Blank 2bdf7ee0f0 Delete orphaned mailboxes/messages/policies at provider startup
Bug: 4972132

Change-Id: Icc756a9e28b77de052261903089b040d229e7b5d
2011-07-01 09:21:09 -07:00
Marc Blank c0a9fa9c68 Fix NPE
Bug: 4969186
Change-Id: I27fbdf7a496ee73caf36a90bf56b91c90133b3b7
2011-06-28 11:05:02 -07:00
Marc Blank 5d7ff8577d Synchronize access to mailbox type map
Bug: 4967543
Change-Id: I71380d0d2d5664cf92a9b698bfdad516eeb5c80f
2011-06-27 20:23:40 -07:00
Marc Blank 9a01353f14 New search implementation for IMAP in MessagingController
* Add protocolSearchInfo column to Message table; this can be used
  to store information related to search results.  For IMAP, we
  store the serverId of the mailbox that the message lives in on
  the server
* Add upgrade code for this column
* Change MessagingController to use the proper serverId for remote
  operations, depending on whether the Message is a search result
  or not
* Fix some smaller issues with earlier code

Change-Id: I0c7f1d89a4659b95701d02646c0e8426680e2f6a
2011-06-23 22:02:00 -07:00
Marc Blank deb345aceb Support FLAG_SUPPORTS_SEARCH for IMAP accounts
* Update existing database to add this flag for IMAP accounts
* Set flag when creating IMAP accounts
* Change temporary UI to use the flag exclusively

Change-Id: Idefccd3a74d2222fe8a0ba47116dee981a0ae1f5
2011-06-23 10:36:35 -07:00
Marc Blank c09ca39cde When looking for default account, check for empty cursors
* At present, we will cache empty cursors (i.e. where the query
  result had zero rows)
* If a widget (or shortcut) references a deleted account, this will
  create a cached entry for that account, and the defaultAccountId
  code will try to retrieve the isDefault column from that (empty)
  cursor
* To fix this, we simply skip over empty cursors when looking for
  a default account
* We will also look into whether it makes sense to cache zero-
  length cursors

Bug: 4883043
Change-Id: Id998506f77bd6cda6cb1f5d8ce65d689dde4d2c5
2011-06-22 18:45:54 -07:00
Marc Blank 6353774647 Fix problem with getDefaultAccountId() with no explicit default
* This wasn't working with the new code and the unit test wasn't
  testing this case.
* Updated code in EmailProvider and added a test case

Change-Id: I75c23423c4f43e4201d446886d92a5312fa8a084
2011-06-22 15:45:17 -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
Makoto Onuki 369905c95d Fix crashing tests
Some of the tests are still failing, but at least now we can go through till
the end.

- Fixed NPE in WelcomeTests (caused by the mock context not returning a proper
  layout inflator.)
- Removed the rainy day test from MessageFileViewTest.
  (Not setting a proper intent will result in the argument check in
  MessageFileViewFragment)
- Removed unnecessary null check in EmailProvider.getDatabase()

Bug 4766072

Change-Id: I48b92cc91d0417cd9980c131fda8f63a9a6eb990
2011-06-20 20:01:22 -07:00
Makoto Onuki 09a0e9b5dc Merge "Move restore account to EmailProvider." 2011-06-20 18:46:09 -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
Jorge Lugo 5a3888f35b Added quick responses.
Added "Insert quick response" button to MessageCompose's action bar. Clicking
it opens dialog with available quick responses. Selecting one of the responses
will insert it into message body at the current cursor location. Also added
menu in account preferences to create, edit, and delete quick responses.

Change-Id: I85f3f6b36801cf112ec9d7c31135a917456173d7
2011-06-20 13:31:50 -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 313586c8eb Introduce client cert alias for HostAuth.
Some email servers require client certificates to be presented to
establish an SSL connection. While this certificate will be maintained
by the system key store, we need to store the "alias" of the certificate
stored in that system store.

Wiring up to use the actual alias will be done in future CL's. It is
currently unused.

Change-Id: I8d1290151342daea9ceb0df8a4088405b44faa81
2011-06-07 18:48:23 -07:00
Todd Kennedy 2e112b2d12 Add new column to table creation method
Change-Id: I2c6fe80d06e54dbd10eba41f0a0aa758baffb1b0
2011-06-03 16:47:39 -07:00
Todd Kennedy 9dcb72e1ec Add "lastTouchedTime" column to the mailbox table
The last touched time will track the last time a message within that mailbox
was read. This will be used for the recent list.

Change-Id: I97a5fda52fd09b416fc3278a11a87b807da05c9c
2011-06-03 08:51:25 -07:00
Marc Blank f3ff0ba910 Create AccountManager acct for pop/imap on upgrade from GB
* Also, unit test for upgrade path

Bug: 4439595
Change-Id: I508a3d8ea70c1a894a412528314e42a39f3ae0e7
2011-05-25 08:31:24 -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
Makoto Onuki bfac9f2e8a Move some of the log constants from Email to Logging
Change-Id: If9f4e4e3adcdef897a0d6a4e153bb446a8b24fdd
2011-05-13 14:24:38 -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
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 a9ac20b96f Add lastSeenMessageKey column to the mailbox table
The last seen message key is the id of the last message that we've "seen" for
that mailbox

Change-Id: I197f8a191654225ada1ce553cc959db775809c88
2011-05-06 14:51:41 -07:00
Todd Kennedy bf30f94c2e Add operation and id to notification URI
In order to provide a bit more granularity for content observers, we add the
operation (e.g. "insert", "remove" or "update") as well as the id of the row
that has changed (if it's known).

Change-Id: I214d3c030872f888cde1a2db9b6b46f1bb121b7a
2011-05-06 11:36:00 -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 f91a03f520 Add new policies to Policy and associated data structures
* Update Policy unit test

Change-Id: I24a980537a73e40fca9fceb1b6ad6b2feaa9c342
2011-05-05 11:49:15 -07:00
Marc Blank 647007c31b Remove scalpel left in patient
Change-Id: Iea55718a815cf3eafdd2b506637c96aeac8e7cb2
2011-05-03 15:21:18 -07:00
Marc Blank aeee10e57e Rework of security policy storage
* Replace crazy (and soon to be "full") bit fields stored in an account's
  securityFlags with a row in a newly created Policy table (thus, fully
  expandable)
* Update code from database version 17 to 18; adds Policy table, a
  policyKey row in Account, and a revised trigger that deletes Policy
  information for deleted Accounts
* Update old PolicySet unit tests to work against the new Policy class
* Add test for the conversion of securityFlags to Policy
* Tested in a variety of scenarios; appears to be functionally equivalent

Change-Id: I1505ee75230d6a0d3c2b62a46326f39c2c7f9eb5
2011-05-03 11:11:47 -07:00
Todd Kennedy 22208771b7 Add hierarchical folders to IMAP
We now create folder hierarcies for IMAP. This also includes a nifty SQL
statement that will get your existing database into shape.

Change-Id: If07a0632e9b250cf0c33c3e16bfba5816beab94c
2011-04-25 15:11:38 -07:00
Andy Stadler 3a58509b2a Add parent key to Mailbox schema
Bug: 2028418
Change-Id: I79d48befe7754692a3cab6c8851105bb399431f5
2011-03-01 10:45:50 -08:00