Commit Graph

894 Commits

Author SHA1 Message Date
Jerry Xie 7037a0bd3d Disable, suppress, remove broken and obsolete Email tests
Change-Id: Ia4dcba1c6966f23dd2a15e69324b7345aed8f944
2013-12-16 18:18:51 -08:00
Tony Mantler 9c8c471f97 Convert SetupData into a retained fragment
This will keep it from being recreated quite as much while off-thread tasks are possibly mutating it.

Change-Id: Ic9873489906339c33a76b8a600c0fc28016debc4
2013-12-09 12:02:12 -08:00
Jerry Xie d241290f0b Add makefile for EmailTests
Change-Id: Ic441b5cea9efd0b714a00a69c5b8483ddd11fafa
2013-12-06 17:33:36 -08:00
Jerry Xie 17d3a29c9d Get Email units to compile
Change-Id: I171a0e2421c5006d9862ad94f886932146547020
2013-12-05 11:11:21 -08:00
Yu Ping Hu bc8bc050b0 During upgrade, ignore protocols whose strings don't change.
Copied from https://googleplex-android-review.googlesource.com/#/c/389215/
in order to submit for ur10, also made a minor change to early out when
we know it's a no-op.

Bug: 11258856
Change-Id: I28415e97225a216c16abb6ad7c48a860c5370173
2013-11-14 18:19:12 -08:00
Tony Mantler 2ed113c713 Foreign characters may be letters and digits, but they're not allowed in Uri/Url schemes
b/11356390

Change-Id: Ic510607ab5f671e3f3f474ea3c2f4af7e9966cb1
2013-10-31 16:39:03 -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
Tony Mantler c6953b7755 Reimplement QuickResponse support
b/8622751

Change-Id: Id079efcf34dce15b5f5057f937582c0e198d3d50
2013-08-16 14:08:54 -07:00
Yu Ping Hu afe097f318 Simplify account reconciliation.
- Rather than handle by type, do them all at once.
- Simplify when reconciliation happens.

Bug: 9056861

Change-Id: If264678c82c63090246ef8ff857c8e46f6672c85
2013-07-26 16:06:14 -07:00
Yu Ping Hu aa0ca16a27 Remove references to account mailbox.
Exchange implementation no longer uses them.

Change-Id: I221a914f2428c0c7989f79392ca82f7a8f4b1c52
2013-06-17 19:51:47 -07:00
Scott Kennedy 560bfadc31 Unify LogTag
There is now only one LogTag class. The static initializer of
GmailApplication (existing) and EmailApplication (new) will now set
the log tag to "Gmail" and "Email", respectively. Up until that code
is run, it will be "UnifiedEmail".

"setprop log.tag.Gmail VERBOSE" (or .Email) will trigger all logs to
be printed as long as they go through LogUtils, regardless of what tag
is used by that individual log. This lets us still turn on logging
everywhere in one command, but also lets us use more descriptive tags
(like the class name).

And since we no longer have three com.android.mail.utils.LogTag
classes, builds will be much easier.

Also, we now use LogUtils everywhere.

Change-Id: I55f1c7a66ce50ead54877a13e40256422a56dc39
2013-06-05 20:06:15 -07:00
Andrew Sapperstein 6be411edd0 Refactoring to support eml viewer in UnifiedEmail.
Moved two files out of Email into UnifiedEmail and
removed their dependencies on EmailContent. As a result,
those classes now return the data directly via a data only
class.

Change-Id: Iaf0618dd6879c9dc2a41943d3d15428904b65768
2013-06-04 15:37:40 -07:00
Jack Bates 4fd97a3050 Fix SMTP RFC violation for better interoperability
Space after colon violates RFC 5321 (and RFC 821): "Since it has been a common
source of errors, it is worth noting that spaces are not permitted on either
side of the colon following FROM in the MAIL command or TO in the RCPT command"

Change-Id: Ie5330bf2bd01cd8f734134dadd742cf16df70d7a
Signed-off-by: Jack Bates <jack@nottheoilrig.com>

cherry-pick of https://android-review.googlesource.com/#/c/32640/
2013-04-05 13:42:13 -07:00
Yu Ping Hu 8e2c4056ca Clean up dead code. Should be a no-op for functionality.
Also includes a fix for saving a draft that's already
been saved (used to create a new one).

The following were unused:
- accountIdAddToField
- mailboxIdAddToField
- uisendmail
- uisavedraft
- uiupdatedraft
- uisenddraft

Deleting those also allows us to remove the translation
from the Bundle used by calls to the ContentValues used by
update (since the update paths are now gone).

Change-Id: I87f2875e3272177a128a8ff65541e51b1f2d05fc
2013-03-14 14:40:39 -07:00
Scott Kennedy 7fdde9bb4a Cache column name/indexes so we can use getColumnIndex()
MatrixCursor doesn't do this, so we need to add our own cache.

Depends on Ia5ffd31f54a2a335f495df5e0d1a0886ee08c14b

Change-Id: Ica78e3cec747bf86fcef16508156e359216c64fe
2013-02-06 17:09:42 -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
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 c5afb16430 Add a bunch of stuff missed earlier
Change-Id: I7f707446a963912fe5786dacb5569e68db572d1c
2012-06-28 12:16:59 -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 83adfb99a0 Continue generalization of account setup
* Put most setup parameters in services.xml (at a later date
  these can be obtained directly from services, but we're not
  in a position to modify Exchange until next OS release)
* Make more parts of setup reference service information rather
  than directly refer to specific protocols
* Base account type buttons on declared services
* Continue the effort to make Stores obsolete

Change-Id: I50d08f3c0676e606b6b6c09fc22571ee5a7690e6
2012-06-14 14:27:39 -07:00
Marc Blank 323eea8ac8 Don't use a repeating alarm for AttachmentDownloadService
* Guarantees we can't have runaway alarms
* Manually merged from Email1

Bug: 6494254
Change-Id: I7f272f650ab34d50ec71ad503951ada3bbf203af
2012-05-18 14:09:46 -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 ebb79619e8 Move account delete logic to EmailProvider
* This functionality had to move away from Controller

Change-Id: I557918a325eab8c83a9728fa1ce33dde8b86158f
2012-03-09 12:59:21 -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
Marc Blank 9227dbbf0f Add back attachment loading callbacks for IMAP
* Remove newly unused code

Change-Id: Ifea2193deaf35734a031500c807ce9e3abd88fb1
2012-02-19 15:21:25 -08: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 63d60d9eb1 Split EmailProvider into two classes (and about time)
Change-Id: Ia72e8c83ea16718077ffe8b8d284d18b6f9f0786
2012-02-03 12:50:49 -08:00
Andy Huang f20f3e216f am 56d6f4a6: Merge "Style cleanup in email message header to make it more like Gmail" into ics-mr1
* commit '56d6f4a6f13b53051d17579c54cebe0372515f3d':
  Style cleanup in email message header to make it more like Gmail
2011-11-03 05:17:42 +00:00
Andy Huang 358a815701 Style cleanup in email message header to make it more like Gmail
Linkify email addresses in expanded message details
Remove divider line in upper header on phone
Embolden sender name
Twiddle expanded details line spacing and padding to match Gmail
Add space char to collapsed details recipient enumerator (comma)

Bug: 5520692
Bug: 5520787
Change-Id: Iad4a265168d111aa01654a33a9a14f7968fc3181
2011-11-02 15:50:00 -07: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
Marc Blank 8919237f34 Merge "Fix findExistingAccount to treat underscore properly" 2011-10-21 11:30:42 -07:00
Marc Blank 0ff0e155c5 Fix findExistingAccount to treat underscore properly
Bug: 2318959
Change-Id: Ia39ed29084dc8111c61ff552fa65519789b7c23a
2011-10-20 18:41:26 -07:00
Ben Komalo 41495761db Delete stale test.
This test has been disabled for over a year. I call it unnecessary and a
burdern at this point.

Bug: 2938323
Change-Id: I98bd67a0ed3bb1b880a5e7b6bcf8c90b8cf2de46
2011-10-20 16:50:38 -07:00
Ben Komalo 513486cfb5 Fix per account starred mailboxes.
We always switched to combined view when we tapped "Starred" in a
mailbox list. This was confusing since tapping to show the mailbox list
will take you to the mailbox list for the combined view, even if there's
only one account on the device! Other confusing things happened like
showing coloured account chips, even if there's only one account.

This fixes it so that we pass the account ID when building the
selection. Lots of wiring to make it happen, but very little change
overall.

Bug: 5388326
Change-Id: I1fe52f211cceca0c1b26581e200f3c7adcd0734a
2011-10-12 19:44:39 -07: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
Marc Blank 1b65e834c3 Allow multiple wildcards in providers.xml; add hotmail domains
* Change handling of the providers.xml file to allow asterisk
  as a placeholder for an individual domain name part
  (the previous behavior was a very greedy wildcard)
* Add hotmail aliases using the new scheme
* Update unit tests

Bug: 5318329
Change-Id: I73a0dfcb956830b18c5460a1b3ddfc58459d08c9
2011-09-14 16:59:02 -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
Ben Komalo 0e6a521747 Move IntentUtils to emailcommon.
This is needed so Exchange can fire up Email activities.
No change other than the move.

Bug: 5122497
Change-Id: I6ee3f61654745fafd444314ecf75eb8ae6bbd01d
2011-08-08 14:39:19 -07:00
Ben Komalo cb1d65c478 Fix mailbox finding and unit tests.
We seemed to not properly fallback to querying the database if the cache
did not contain a mailbox of a specific type. We may want to consider
caching mailboxes related to PIM data, but for now this is a quick fix.

Also fixes unit tests.

Bug: 5019661
Change-Id: Idcac0a6f15aa7f174890ae586f478fbb8f6e05b7
2011-07-25 16:51: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 81a153463b Remove "Move" action on POP.
Bug: 5010614
Change-Id: If0a94840e9dc104566ba39d2e3240883dab5bba0
2011-07-20 13:21:06 -07:00
Ben Komalo 1ecfb5311b Remove illegal references to IsolatedContext
This fixes a crash on account deletion, leaving around bad accounts that
were in limbo
Also remove a test for an unsupported operation

Bug: 5051951
Change-Id: Ieebc7f769075614ae1a656cf123d8ce0313e611d
2011-07-20 10:52:47 -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
Ben Komalo e71a19a523 Build default mailboxes for POP3
Bug: 4580535
Change-Id: Ic800eed387d3e9e64e95cce691d13d98b4a48045
2011-07-17 17:48:31 -07:00
Ben Komalo 3c4061ae61 Merge "Filter out inbox from recent mailboxes" 2011-07-17 17:28:28 -07:00
Ben Komalo 0932da35f5 Filter out inbox from recent mailboxes
Bug: 5039553
Change-Id: I9b58e9331028250f9bc3027429d2a6ec418186d6
2011-07-17 16:21:01 -07:00
Marc Blank b81a31b29b Handle message sets in a single EmailAsyncTask
* This prevents the possibility of RejectedExecutionException when
  selecting large numbers of items

Change-Id: I8f9ba287d69021fdb99b4a8a30cc79755f669b97
2011-07-16 16:11:00 -07:00
Ben Komalo 0796b8aa61 Don't save empty drafts.
Note: all unicode sending unit tests are broken due to chip issues. I've
filed a separate bug on that.

Bug: 5012204
Change-Id: I17392f65e5bd8349780b79d9cbe10492d8e7a7d9
2011-07-15 16:47:36 -07:00
Ben Komalo d6ad9b8c03 Fixup recent mailboxes.
The default recent list should be pre-populated and fall off the list as
normal. The previous implementation showed a default list if there were
no touched mailboxes, but then the default list disappeared as soon as
there was one touched.

Bug: 5020673
Change-Id: Ifad607a9d36feff837ab42d039ce9209f223f345
2011-07-14 12:03:16 -07:00
Ben Komalo acd985efb4 update one more test for default account changes
Change-Id: I36344a9c0a29d718ec9dd3d51d9abfbc435252f0
2011-07-13 17:10:16 -07:00
Ben Komalo 52e66110d8 Unit test updates for default account changes
Change-Id: Id619de198a84d1da43068a90474ed76ece9a30b5
2011-07-13 15:16:55 -07:00
Ben Komalo cf7cd933db Filter out Search mailbox from recents.
Bug: 5015109
Change-Id: I4e4982bbedc388529eb2f3a9c06ecac47a0a85f0
2011-07-11 13:07:22 -07:00
Makoto Onuki 2ac164f609 Fix bug 4982804 / nested fragment transaction
Post MessageOrderManager callbacks instead of calling them directly
to break the loop.

Change-Id: I033121f7bdbadf6edd7a0fab87b960b737da820e
2011-07-10 12:00:46 -07:00
Ben Komalo e76962b1b9 Revert "Enable SD card encryption policy when emulated"
This is a manual cherry-pick of c379ebe372
This reverts commit 7fd14be804

The introduction of proper SD cards breaks the invariant that "external"
storage can be encrypted. Unfortunately, this means that accounts with
that policy bit set will have to be removed for now.

Accounts with the security policy set will be forced to go through
security provisioning on the next sync, using the regular mechanisms of
showing a notification with "Security update required", and then having
it fail. :(

Bug: 4466311
Change-Id: I68119b14f8d198779c2073296e228bc6772136ee
2011-07-04 16:16:07 -07:00
Makoto Onuki 1600adab97 Merge "Fix bug 4978035 Precondition failure: Not combined mailbox" 2011-07-01 10:19:46 -07:00
Makoto Onuki a6212c88e0 Fix bug 4978035 Precondition failure: Not combined mailbox
Also added test.

(For some reason the message count doesn't get set properly on tests...
I'll investigate it when I get around to it...)

Change-Id: I83f3b6f2079da06b2d4973419d2296e6492de1d3
2011-07-01 10:18:13 -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
Makoto Onuki 8de5bda815 Close cursor properly.
Also, don't issue separate query()s for each recent mailbox.

Bug 4977956

Change-Id: I3ccd437a7efd5c3599c4a1952ba091a7b3b815bf
2011-06-29 19:21:14 -07:00
Marc Blank 0b8e04c84d More Store cleanup
Change-Id: I8f542175b4468c7a320322a57bfdaf19a7320165
2011-06-29 15:22:05 -07:00
Marc Blank 244d306ebb Remove more useless code
* Strike another blow for sanity!

Change-Id: Id95b441f9577abda66f04113793d6b1c60500ebe
2011-06-29 14:07:25 -07:00
Marc Blank 77160c8c08 Merge "Don't cache ImapFolders" 2011-06-29 13:34:44 -07:00
Marc Blank 2720a818d5 Don't cache ImapFolders
* ImapFolder is currently very unsafe for use by multiple threads,
  causing, among other things, the referenced bug
* Since ImapFolder is very lightweight, there's no particularly good
  reason to be caching them anyway
* Rename isOpenForTest to isOpen

Bug: 4972084
Change-Id: I2bf17b9cfc8549a222e991f3e59abfd00a4d3afd
2011-06-29 13:02:55 -07:00
Marc Blank ea8034affa Merge "Clean up Store implementation" 2011-06-29 13:01:36 -07:00
Marc Blank 35b0e95ca7 Clean up Store implementation
* Remove unused argument from newInstance/constructor
* Create ServiceStore class, the superclass of ExchangeStore (and,
  eventually, all Stores, until they can go away completely)

Change-Id: Ic5237236c5349ecf006538c58b63c1efe8e4ea61
2011-06-29 12:50:43 -07:00
Makoto Onuki 50d934360d Fix the "onPostExecute executed even when cancelled" issue
Renamed onPostExecute to onSuccess and made sure it won't called
if a task is cancelled in time.

Also removed isCancelled().  To implement it right we should make sure
that onPostExecute() isn't finished when setting mCancelled, but it's a bit
of a pain to implement right, and we don't really have to use it.

Change-Id: I3a0baf504506ffc4952a5553f7098a8415842fa3
2011-06-29 10:22:38 -07:00
Ben Komalo 6b256f1fa1 Wire through results count in search header.
Change-Id: I817236d9c3294acb25b62724cc8c99d47df7f354
2011-06-28 17:11:16 -07:00
Makoto Onuki a08fd4c74d Merge "Introducing DelayedOperations" 2011-06-27 17:42:01 -07:00
Ben Komalo f8acc29628 Merge "Introduce a SearchCursorLoader" 2011-06-27 17:32:25 -07:00
Makoto Onuki 6b968c1dce Introducing DelayedOperations
This helps post runnable to the handler and cancel pending runnables
at once.

It'll be used for delay-call methods that initiate a fragment transaction,
and cancel then in onSaveInstanceState().

Change-Id: Ib8bdb0e676e756854ab067a27e5e0f397219a4b4
2011-06-27 17:00:50 -07:00
Ben Komalo 37c8a70d64 Introduce a SearchCursorLoader
This loader will abstract away the waiting for the controller to cleanup
the existing contents of the search mailbox

After some additional, to-be-done plumbing, I'd like
Controller.searchMessages to return some results info (like # of results
at the least) so that the SearchCursor returned can relay that
information to the client (which can then do a lot more interesting
things at that point).

Change-Id: Ifcba0ddf7170c56dac9f3b44128988a5aa4ca887
2011-06-27 15:43:21 -07:00
Marc Blank bc1fa23031 Merge "Clean up/simplify ExchangeUtils/ExchangeStore" 2011-06-27 14:27:25 -07:00
Makoto Onuki 4689cb7100 New account spinner
- Don't use the action bar spinner.
  Instead use a custom view to show the current account.
  (It's not a spinner; now we show the dropdown list by ourselves,
  which gives us more detailed control.)

- Also show the current mailbox name/unread count with the account name.

- Removed the mailbox info loader in ABC.
  Instead, now the AccountSelectorAdapter loader loads the current
  account/mailbox name, and the unread count as extras.

- Now ABC.Callback.onMailboxSelected passed an account ID as well
  as a mailbox ID.

- There's new code paths that can cause the "fragment transaction in
  onLoadFinished" exception.  We need to fix this properly, but
  for now we just use commitAllowingStateLoss().

Bug 4948352

Change-Id: I73bb8b7530f8328ca1c86382ac0a54086ad061d7
2011-06-27 13:19:27 -07:00
Marc Blank 66a47b8dac Clean up/simplify ExchangeUtils/ExchangeStore
* Rename ExchangeUtils to EmailServiceUtils
* Create calls for Exchange to use (eventually remove these)
* Get rid of lots of nonsense in ExchangeStore

Change-Id: Ic538cfe1de57eca24088ee1f590264283d12f511
2011-06-27 12:14:04 -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
Makoto Onuki 80d3875d30 Action bar: Use laoder to get current mailbox info
Before this CL, we had this crazy plumbing from MailboxListFragment
to ActionBarController to update the current mailbox name/message count.

This wouldn't work on 1-pane, so now ABC just gets the current mailbox id
from UIC and loads the name/count with its own loader.

Also...
- Fixed bug 4904450 and bug 4460470: Now we consistently use FolderProperties
to get proler display names and message counts.

- Renamed some confusing names in AccountSelectorAdapter

Change-Id: Ic7bea6da6d2859006fb8f9263024c7d5e62b1e7f
2011-06-23 16:06:45 -07:00
Ben Komalo 53300963ff Save/restore message list context
This fixes opening messages after rotations. Oops.
Bug: 4905495

Change-Id: Ibb9984245f7a040b65d472ad4103da587c28c83b
2011-06-23 12:38:42 -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
Jorge Lugo f1d9367909 Merge "Fix behavior if replying to own sent message" 2011-06-22 10:48:02 -07:00
Marc Blank 0404a331ad Merge "Improve EmailContent caching..." 2011-06-21 23:46:37 -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
Ben Komalo 505ac4b09b Prevent NPE when account can't be found for policy
Added some tests to ensure no orphaned policy

Bug: 4686450
Change-Id: I64a1f5de05f3e73052cb41828ed6bf1a2e26d22a
2011-06-21 18:26:16 -07:00
Jorge Lugo 67be1d5f6b Fix behavior if replying to own sent message
If the address of the account is in the reply-to: field (or from: field
when reply-to: is empty), now populates the To: field with the same To:
field on reply.

Bug: 3504182
Change-Id: I17d7fe4be002b302decb8f0dae95f33d452b7adc
2011-06-21 17:03:46 -07:00
Makoto Onuki c9af8b2dbf Merge "Wait for initial sync in Welcome." 2011-06-21 14:37:12 -07:00
Makoto Onuki 95ad0f0e93 Wait for initial sync in Welcome.
Change-Id: I5052e8a3e3af5565184c391200b9ab63dff4b50b
2011-06-21 13:58:42 -07:00
Marc Blank 0fd968623d Merge "Fix MailService unit tests" 2011-06-21 13:20:27 -07:00
Marc Blank cbc842c5c9 Fix MailService unit tests
* These broke when we split Email/Exchange
* We now use a test authenticator and a test account type, which
  is actually far cleaner than dealing with actual accounts

Change-Id: Ib7c9f884eac484c33642a8036f47466ce641c567
2011-06-21 13:03:48 -07:00
Makoto Onuki ce4cce05b2 Fix failing tests
Fixed activity tests and and activity.setup tests.

Bug 4762098
Bug 4766087
Bug 4590590

Change-Id: Ifbd49f38c59854c65b6c48a1b03ca8153bfa558b
2011-06-21 11:18:32 -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 ae95fbf4d0 Merge "Added quick responses." 2011-06-20 15:10:06 -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 627bc6ed57 First implementation of IMAP search
* Broke up synchronizeMailboxGeneric into three pieces; it's still
  horrible, but this at least stops my eyes from bleeding
* Remove unused method/tests from Folder interface

Change-Id: Ib4d979536be657137cf70ca535cf429d707be41b
2011-06-16 20:26:52 -07:00
Ben Komalo d09cff0888 Make "don't allow camera" a supported policy.
This sends the bit to the DPM. Separate changes have been/will be made
to change the provision parser and support it in the DPM.

Bug: 4185316
Change-Id: I44872ceb095a28539b047a0641cc499c7186a9b3
2011-06-16 10:44:48 -07:00
Marc Blank f5418f1f93 Move Account into its own top-level class
Change-Id: Ide7c991b7d4d418dbe17164421425bf898ba64ee
2011-06-13 15:37:22 -07:00
Marc Blank 85e4c101b0 Remove storeUri's except during auto-setup
* Remove per-store limitations
* Use constants for VISIBLE_WINDOW, rather than having the
  potential for differences between Stores

Change-Id: Idd5e0874bba6e3390e4f093bcb03f4b1bb399c11
2011-06-09 13:34:43 -07:00
Todd Kennedy 9d2dae6750 Set proper default values for new mailboxes
When creating mailboxes (specifically 'drafts' or 'sent'), we need to ensure
that its default values for flags & server key are set correctly. In most
cases this is "okay" because the mailbox will be created on the server and
the values for these fields will be reset. However, in cases where system
mailboxes cannot be created on the sever (for example, the 'drafts' folder
on any POP3 account or an IMAP gmail account), these default values do not
get updated and we are unable to view the contents of these mailboxes.

bug 4356871

Change-Id: I9e6a394145f471b555c5827d5114bca243dbc37c
2011-06-09 11:39:14 -07:00
Todd Kennedy 348b2f9f11 test uid search w/ and w/o parens
some imap servers will not work if the uid command contains parenthesis, while
other imap servers will not work unless the uid command contains parethesis. we
need to verify that we send both formats.

bug 4526165

Change-Id: I04a31f06a0f0fa0f03777a22b23281af574cd549
2011-06-09 10:38:44 -07:00
Todd Kennedy 7984aa60a0 Add new field to mailbox test
there's a new field in the mailbox class that was causing a unit test failure.

bug 4552358

Change-Id: Id17a99b55248cdc9e4c5ea455506f72e52687599
2011-06-09 10:14:52 -07:00