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
* 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
* 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
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
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
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
- 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
* Rename ExchangeUtils to EmailServiceUtils
* Create calls for Exchange to use (eventually remove these)
* Get rid of lots of nonsense in ExchangeStore
Change-Id: Ic538cfe1de57eca24088ee1f590264283d12f511
- "UNSEEN new messages" is the title for multiple new messages
- the small number in the right shows the unread count
Change-Id: I48f761b727ea8abc9277d737a08789fa63d10871
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
* 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
* 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
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
* 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
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
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
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
* 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
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
* Remove per-store limitations
* Use constants for VISIBLE_WINDOW, rather than having the
potential for differences between Stores
Change-Id: Idd5e0874bba6e3390e4f093bcb03f4b1bb399c11
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
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
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
MFA was the only subclass of MA and the abstraction no longer made sense.
Collapse the two into a single adapter class.
Change-Id: I32c6f027bc37f3da08626f743c3f494e5f48c3f0
The ability to change mailboxes using the spinner is currently only implemented
for the two-pane UI. one-pane implementation will come in a future CL.
Change-Id: If72e9d9d607508553c918f5523e748e8a481ff84
This will make the message list a lot snappier.
We were using two different loaders for the message list; one is to load
the meta information and the other to load the actual message list.
Unify them using the CursorWithExtras pattern.
Change-Id: I02957bbca1b1fb74ca6eca14ad2535dfdbf03a5a
we need to return 5, post filtered, results. previously, we were returning
5, pre filtered, results. Also add a test to catch this condition.
Change-Id: Id25f4bf79081c42a2012e0e51b36142120c83b20
Upon hitting reply all, all email addresses except that of the source message sender
go in the CC: field. Previously they all went in the TO: field. Updated 3 tests
in MessageComposeTests.java (testReplyAllAddresses1(), testReplyAllAddresses2(), and
testReplyAllAddresses3()) to reflect this new behavior.
Bug: 4534058
Change-Id: I852daebdd8843a45f685eecc67f757c87925bb6c
Now we reuse the same instance of the fragment for nested mailbox
navigation. (Don't use fragment transaction)
"CursorWithExtras" now only has the child count, so I removed the
bundle version and added a concrete class to MailboxFragmentAdapter.
With this CL the nested mailbox navigation on 1-pane should work, but
not back navigation. (Back press event isn't connected to the
fragment yet.)
Change-Id: I2c23651d9c8edb5fe062c68bbb9b462c8949ded4
The new widget UX allows for a single display mode for the widget. This can
be configured when the widget is added or at a later time during widget
re-configuration.
We don't have the configuration activity (yet). We first need to restructure
the widget to take a single account / mailbox combination. Hooking up the
configuration activity will occur in a future CL.
Change-Id: I38a5796c44938a6abd0d2bb50ac77241cc86a497
- Also removed the accoundId parameter, which wasn't used.
- Also cleaned up MailboxListFragment.onDrop.
(the restored Message was only used to get the account id, but
it's no longer needed.)
Bug 4384642
Change-Id: I8f6635011dae0529a82972617101e1c130090b76
We need to pass around the account ID with onMailboxSelected too.
(It's kinda sad it wouldn't have happened if we had par-account starred
mailbox.)
Also made sure MailboxListItem.mMailboxId now really contains only a mailbox
ID. Before this chage, we stored an account ID to this for an account row
on the combined mailbox.
Bug 4452811
Change-Id: I732fd8eb18f787f4a700a45a40768f96e3bb8751
Account shortcuts used to point at MessageList directly with a
content://com.android.email.provider/account/ACCOUNT-UUID URI.
Hook these intents and open Welcome instead.
On Eclair and before, we stored an account-ID directly as an extra,
but this style is no longer supported.
Bug 4208879
Change-Id: I9fecb0723743377a6d7c7e84626e8613f2356492
The key for the Store cache was not adjusting properly for account
changes (such as port changes, etc...). As such, it was possible to
get an invalid store.
Now, there's problem with leaking Account objects if the store account
changes (see bug 4440839). This is "okay" for now since account changes
are fairly uncommon and Account objects are light. However, this should
be fixed at some point.
Change-Id: I4ddcbc3e2759b7b1374d0300706373678dedec94
No real code changes; just moving where code / constants live. Removed
one unused method of Store.
Change-Id: Ie7532381759a568cb23601e1071c8e199b6beb07
Split out ImapConnection to its own class. This allows us to update ImapStore
without worrying about links between it and the connection.
Also, added a bit more safety to the classes in terms of correctly freeing
resources. Whenever the connection is closed, it now releases all resources.
Additionally, if the connection is ever put back in the pool, any response
data is released.
Change-Id: Ie3bda40d677707a0d6655f57175e58dece539e19
- Moved the method to EmailCommon.
- Use *_SELECTION for magic mailboxes
(meaning we now use subqueries for magic mailbox selections, rather than
building the mailbox ID list by ourselves)
Change-Id: I3ebf6af62fd912fea6faea0f75e05fc61c87af3b
This activity already supports phone and tablet mode.
Only renames in this change - no other change.
Change-Id: Ieca17137af45e3860812091f69cd4d9b55ddf3ec
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
* This is a serious bug dating back to the first Honeycomb release
* It was possible that a newly created Message could not yet be
committed to the database when the AttachmentDownloadService
tries to download one of that message's attachments.
* ADS, when it sees that the message (apparently) doesn't
exist, deletes the Attachment (it appears to be orphaned)
* The effect is that the user never sees one of the attachments
in a message.
* This bug has been reported externally
* The fix is simply to check for the message's existence before
deciding to delete it (this check will always work properly)
Bug: 4409692
Change-Id: I106ed2fe88d2435ad7a462fced5cb307c2559fd6
The primary purpose of this CL is to remove phone activities, so the
one pane implementation is very much temporary and primitive, but it
should offer minimal operations.
Change-Id: If57f81db7c605c95664d49044a5cc082beda59c0
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
The notifiaction table will be used by the updated notification controller.
The table stores the key and the associated last notified message key and
message count.
Change-Id: I037b5374ab51620f1cffc8b41391db858cfd3a2d
This introduces tab navigation on large screens with action bar (a
dropdown for the phone view is yet to be implemented, though the
internals are ready for it).
This requires the side effect that restoring a draft
reply/replyall/forward will attempt to also load the source message in
full for additional information. If that load fails for whatever reason,
the draft just remains a "compose" as it used to before.
Bug: 3117253
Change-Id: I9cff5ed4a5e9abd1338b6dbde28ceb3e4dc2b761
* 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
Now attachments are actually stored in an explicit list, instead of
being inferred from the state of the UI. This makes it possible to
switch states and restore attachments, and test.
Change-Id: I8c5f80f17f8c9e78d880ac4a1ac6ae22c2ec0579
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
* 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
- "save draft" no longer closes the message
- ensure consistent state if there are successive saves
- misc changes to the way a message is loaded if there is a pending save
Bug: 3072398
Change-Id: I9cd01319772293e4d410020ab27603821a95ec9f
* javadoc methods
* rename some methods
* remove duplicate code; now new message and other account notifications
are created with the same code
Change-Id: Iecf70494b6407a9a73380de103390a59d006191b
- Now all the UI stuff is owned by the UI controller
- Except temporary UI (exchange search and per-mailbox-settings)
- Except error banner
This should be moved too eventually, but I consider it as a low-priority.
I'll leave it as-is for the time being.
- Moved RefreshTask too. The spec for refresh has dependency to the UI.
(i.e. implicit refresh of the mailbox list may not be necessary for
the phone.)
Also renamed the main activity to EmailActivity.
Change-Id: I00585856bdacf69aa4e104178a5cf7352ff6d592
- Now we always use a fragment as a callback, rather than assuming the parent
activity implements it.
- Use a generics trick to make sure the callback fragments really implements
Callback.
(Might be abuse of a language feature, but it's at least safer than runtime
check...)
Bug 4314669
Bug 4345496
Change-Id: If4048d456b298784097e202cffab170177ac7b2d
not making any real code changes:
* removed deprecated, unused methods
* remove 'throws' clauses when that exception is never thrown
* renamed method Controller#moveMessage()-->moveMessages()
Change-Id: Ifd006f760f0c19283e94a11a45c71295c8da35f7