Commit Graph

526 Commits

Author SHA1 Message Date
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
349055aad4 Allow ProviderTests to work with ContentCache
Bug: 3204331
Change-Id: I5399345c2b759fb34d3dc7c694eb0eef8d7de493
2010-11-17 10:19:30 -08:00
Andy Stadler
2199c7ddf5 Minor cleanups for ContentCache
* Change CounterMap to not extend HashMap
* Renamed remove() to subtract()
* Comment out a failing test
* Add a flag that prevents any objects from being cached

Change-Id: I74754133b505178e8b0166390f69509f006a3da2
2010-11-16 22:49:04 -08:00
Marc Blank
fab77f147f EmailProvider content caching
* In this CL, we cache individual rows, based on the CONTENT_PROJECTION
  defined for the most common queries (Account, HostAuth, Mailbox, and
  Message)
* Queries on individual rows (most often Class.restoreClassById()) will
  look to the cache first, rather than querying the database
* Queries on smaller projections will build MatrixCursor's from cached
  data
* Write-through caching updates the cache with changed columns
* Experiments with live data indicate that > 95% of queries that are
  cacheable (single row, no selection) can be retrieved from the cache,
  thereby saving a great deal of disk access.
* Timing experiments show that cache hits are > 40x faster than cache
  misses
* Unit tests for the various classes exist, with more coming

TODO
----
* More unit tests

Change-Id: I386a948a2f4cc02b6548d07d9b2fefd1e018a262
2010-11-16 08:58:05 -08:00
Makoto Onuki
2ac1eaf8c3 Account selector rework.
- Show email address
- Show inbox unread message count

Initially I thought of using a join to get accounts with their unread
counts with one query, but there were enough subtle issues that I gave up
on the idea.

Instead it uses a MatrixCursor to build a completely new cursor,
based on a regular accounts cursor.

Change-Id: I09e8762f131cc2bd3637e1a3d302088a3b5b2479
2010-11-10 17:41:29 -08:00
Makoto Onuki
77303a483b Merge "New message view command layout" 2010-11-10 14:09:38 -08:00
Makoto Onuki
931ca67a1f New message view command layout
UI Changes:
- "Move", "Delete" and "Mark as unread" became action bar commands.
- The message view bottom panel now only has "newer" and "older" buttons,
  with  the current position in the message list.  (shown as POS of TOTAL)
- The buttom panel is now shown only on portrait

Non UI changes
- MessageOrderManager now keeps track of the current cursor position
  as well as the total message count.

- Fixed the "move_action" string, which was wrongly marked as non-translatable.

Bug 3169454

Change-Id: I599543f9e11000a4ee283d31fbd407b2ab53ac44
2010-11-10 11:08:14 -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
Andy Stadler
54ab7a27a3 Fix NPE in pop3 checkcapabilities
* This happens if an open fails immediately (error message in the
  initial banner) followed by a checkSettings.
* The fix is to harden checkSettings to force a clean connection
  every time.

Bug: 2170147
Change-Id: If7403bf517477d2b03b21d71caab511fe45e234c
2010-11-04 23:34:26 -07:00
Andy Stadler
ba4e72a947 Cleanup various IMAP/POP manual account setup defaults
These defaults affect manual setup only.  There should be no changes
observed in automatic setup, and no changes observed in EAS setup.

* user $email instead of $user as default login
* guess "imap." or "pop3." for server name
* propagate the incoming server name to the outgoing server name, and
  replace "imap.", "pop3." or "pop." with "smtp."

Also, fixed a couple of leftover places where we were trimming
passwords (and should not be, since some people insist on having
spaces in their passwords.)

Bug: 2978634
Change-Id: I9b0e345aa9550b5e1cc29aaa22109f03da61af20
2010-11-03 09:31:45 -07:00
Makoto Onuki
730cc6724a Add "Combined view".
- Don't show combined mailboxes with regular mailboxes in the mailbox list.
- Add "Combined view" to the account selector instead.
- "Combined view" has all the combined mailboxes and accounts.
- Renambed these combined boxes.  (e.g. "Combined inbox" -> "Inbox")
- Regular account view still has "Starred" mailbox, but it's actually
  "combined" and not per-account.
- Re-order special mailboxes per latest wireframe.

Bug 3138004

Change-Id: I4c5860c6774b10c55ba0ca599373e51105432cf8
2010-11-01 11:51:51 -07:00
Marc Blank
02d59d2194 Delete secured accounts if device admin is disabled
* Update unit test

Bug: 2817683
Change-Id: Ia7117c34e7bbba13ac4f2ff375d19b3ef94ef49c
2010-10-27 09:03:21 -07:00
Marc Blank
4a66884b74 Merge "Use notifications for login failures" 2010-10-27 08:57:27 -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
Makoto Onuki
be1aa37dc5 Don't use sendMailCallback() -- don't track outbox status
There're differences between how SMTP and EAS use this callback.
We should eventually unify the behavior, but till then let's not
use sendMailCallback().

Bug 3116377

Change-Id: Ic5ecf16251c11ab2bd2e16e29bd417f1ece67f14
2010-10-22 15:45:51 -07:00
Makoto Onuki
8c3629c978 Merge "Skip testCommaInserting if screen is off or locked." 2010-10-21 13:54:34 -07:00
Makoto Onuki
e9919377ee Skip testCommaInserting if screen is off or locked.
sendKey() doesn't work if the screen is off or locked.

We could probably use a WakeLock and KeyguardLock to force the
screen to be on, but that'd require adding unnecessary permissions
to the email app. (not the test apk)

Bug 1737038

Change-Id: Ic036dc4d12770e82bc5de1133d6dd34cd8465f30
2010-10-21 13:51:46 -07:00
Makoto Onuki
a44c0349fa Merge "Don't move drafts to trash" 2010-10-20 17:37:42 -07:00
Makoto Onuki
77aabd9519 Don't move drafts to trash
Now deleted drafts are really deleted, rather than getting moved to trash.

Also rewrote the test to avoid creating AsyncTasks on the test thread.
In this case it seems to be running fine, but I've had problems doing this
before.

Bug 3099179

Change-Id: Ice5298bf94312ce764d90aa35c5a6c5262ec5b42
2010-10-19 13:54:05 -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
Marc Blank
6af171cae6 Fix errors in MockProvider unit tests
Change-Id: Ibfe6d72547f182332fddf82a842a131f920f5e7f
2010-10-16 21:12:12 -07:00
Makoto Onuki
7fdd88e37c Merge "Put the dest mailbox name in the "message moved" toast" 2010-10-14 15:36:37 -07:00
Makoto Onuki
ee7205d100 Put the dest mailbox name in the "message moved" toast
Also removed obsolete todo

Bug 3075984

Change-Id: I10ce9df29c4913c328d2a962151d4a9f2e6e1408
2010-10-14 15:14:46 -07:00
Makoto Onuki
9b5001a34c Don't use negative IDs with ListView
ListView uses the _id column for some operations, including
onSave/RestoreInstanceState, and if the column contains negative values
they don't work as expected.  The same assumption seems to be in other places
as well, so let's just avoid using negative IDs.

With this CL we now use two different IDs, one for ListView, which will
never be negative, and the other for us, the actual mailbox ID.

Bug 3049315

Change-Id: I263b4895212b5f8bb80c98acaf5c4eccd0bfef55
2010-10-14 14:42:46 -07:00
Marc Blank
9ce8f4d2a3 Use original all-day flag when upsyncing exceptions
Bug: 3087410
Change-Id: I4bed0039758e98d4b85054876f192605eb00ee82
2010-10-13 14:10:36 -07:00
Marc Blank
fde172f576 Fix CalendarSyncAdapterTests
Bug: 3077174
Change-Id: Ic0ba851969e852488a72241c8fba9f466c5bc3a6
2010-10-08 17:17:04 -07:00
Makoto Onuki
02a750dd64 Fix tests
Bug 3077014
Bug 2992255

Change-Id: I1e8127327158b0821177d0744a60132f89dccdd8
2010-10-08 14:53: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
feb8869c4f Remove unused method Utility.getIconIds()
And redirected the related tests to getIcon().

Bug 2894555

Change-Id: I1d90f01e7476ca79bddd644e123ad979d6ebe987
2010-10-05 16:15:38 -07:00
Makoto Onuki
085f7eb121 Extract the throttling part from ThrottlingCursorLoader
Extracted into the Throttle class as I'll need this logic elsewhere.

Bonus: Now it has tests.

Change-Id: Ie9a5933f8e5015dda6985ba76814f1f945266178
2010-10-01 17:46:59 -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
Marc Blank
0efe738e05 Add Uri for Message queries that include a LIMIT
* Use a query parameter (e.g. ?limit=2); LIMIT works with any
  query

Change-Id: Idd106ab4b61aec237ac9676a201e797c4f65f15b
2010-09-28 10:58:36 -07:00
Andrew Stadler
87fcd03a1b Improve handling of content-disposition
* Check array returned by split("=")
* Add unit tests for this case
* Also add unit tests for quoting removal

Bug: 3040796
Change-Id: I170f3cd483fe35186194edeb0c3142fb0e2e9b75
2010-09-27 15:09:35 -07:00
Andrew Stadler
fb4333b3a5 Allow spaces in passwords
* Separate/identical fixes for incoming, outgoing, exchange
* Unit tests
* Some protocols will fail anyway (e.g. POP3)

TODO: Some sort of warning (master only - won't backport that)
Bug: 2981433

Change-Id: I82984e5912fc7fcb88e747815d0fe33cb36605e7
2010-09-27 10:04:03 -07:00
Makoto Onuki
d25d87c7ba Fix NPE with use of getFirstRowXxx
Make sure not to cast null into a primitive type.
(i.e. If null isn't expected as a return value, make sure to set a non-null
default value.)

Bug 3032143

Change-Id: I9a344d765c75a66f529ad8d99b00b2b919139f9c
2010-09-24 16:59:51 -07:00
Marc Blank
224442906b Merge "Handle EAS type 1 folders (user-created)" 2010-09-24 16:54:57 -07:00
Marc Blank
23f8d3be7d Handle EAS type 1 folders (user-created)
* If a type 1 folder has an mail folder as a parent (at any level),
  it is also a mail folder (and therefore, we should have it in our
  folder list)
* Before rejecting type 1 folders, look for parents and accept those
  that are mail folders
* Add unit test to verify logic

Bug: 2978410
Change-Id: I44cda1d1c1fd7f3976af53a1672736201cc995ff
2010-09-24 12:46:08 -07:00
Makoto Onuki
4209ea36b0 Make ThrottlingCursorLoader smarter
Now the class initially uses smaller timeout, and expand it when detecting
multiple changes in a short period.

This CL makes the UI look more responsive especially on the message list +
message view mode.  e.g. Starring on the message view will quickly be
reflected to the message list.

Bug 3024799
Bug 3027832

Change-Id: Ie2d44c3769d43e3fd0f54ee526556eb3bad5e288
2010-09-22 18:01:01 -07:00
Andrew Stadler
0813c7051f resolved conflicts for merge of 0d9ed341 to master
Change-Id: I198f760ef1734cf4a64c875236a2352859dc1a72
2010-09-22 14:37:44 -07:00
Andy Stadler
16657c9c20 Merge "Fix test failures" into gingerbread 2010-09-22 13:18:52 -07:00
Andy Stadler
6278dcdeaf Fix test failures
Methods were used by tests only and being stripped by PG.

Bug: 2894378
Change-Id: Ieb1dd0daa8bd380c66a7b1e6151c5e5b22cbe38c
2010-09-22 12:06:41 -07:00
Marc Blank
d46952e7b0 DO NOT MERGE: Test validity of port numbers in account setup
Bug: 1712475
Change-Id: Iced4875379a804b5072e4df0af25db7bf9473131
2010-09-21 17:46:15 -07:00
Makoto Onuki
0be6c7c5cf Merge "DO NOT MERGE: Fix handling IOException in ImapStore" into gingerbread 2010-09-21 10:24:48 -07:00
Makoto Onuki
32517753ea Merge "DO NOT MERGE: Handle multiple IMAP SEARCH results." into gingerbread 2010-09-21 10:24:44 -07:00
Makoto Onuki
75c6a611aa Merge "DO NOT MERGE: Test for interaction between ImapStore and vendor policy." into gingerbread 2010-09-21 10:24:40 -07:00
Makoto Onuki
7fbdc44c58 Merge "DO NOT MERGE: Extract MockVendorPolicy, add standard mechanism to inject it." into gingerbread 2010-09-21 10:24:36 -07:00
Makoto Onuki
415b27fbd3 Merge "DO NOT MERGE: Follow-up to the new IMAP parser." into gingerbread 2010-09-21 10:24:18 -07:00
Marc Blank
ef70c9872b Merge "DO NOT MERGE: Send intro text with SmartForward" into gingerbread 2010-09-20 19:18:58 -07:00
Marc Blank
9afbf947de DO NOT MERGE: Send intro text with SmartForward
* We need to include the intro text (--Original Message--, etc.) to
  SmartForwards, and somehow this got in a past updat
* Add unit test for forwarding
* Fix unit test for reply so that it works localized

Backport of I8d92f00d37a434840ec3eb237f3901cd5dc7ad09

Bug: 2477988
Bug: 2685784
Change-Id: I2b6654413a8eb5ca900f958f49ec9eee5161a365
2010-09-20 18:51:32 -07:00
Marc Blank
6512458784 DO NOT MERGE: Make sure signature is added to reply/forward
* Add this to processSourceMessage in the reply/forward cases
* Add unit tests for reply and forward case

Backport of I6be8383fe5f217a4bda8e669cb69f439bc8e96b6

Bug: 2734321
Change-Id: Ia59e8c4e2f9663f2a10cff066eddeff80bc06cef
2010-09-20 18:48:07 -07:00