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
* 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
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
This prevents things from always failing if the server requires a client
SSL certificate.
Note that the solution used to determine if a certificate request was
made for a given request is approximate; it is timestamp based and can
theoretically give a false positive. In practice, this is very unlikely,
since another cert request had to have happened around the same time,
AND the response must be a 401/403.
Change-Id: Ieb77cf91db3bd52ba4adf1fb07357fef7e204ba5
There were two places where account flags were being set on setup: one
was in manual setup when the user selected the account type
(pop/imap/eas), and another was when it was automatically determined
from XML. The two paths were inconsistent and one was setting bits like
SUPPORTS_SEARCH but the other wasn't.
This fixes being able to search in IMAP
Bug: 5011932
Change-Id: I50eada7485aaef4e2a85d25fa7eb9ac7ab03093a
* 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
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
Supress "Body part ended prematurely" and "Unexpected end of headers detected".
I believe these happens because we feed partial messages to the parser.
We've kept these logs only "just in case", but I don't think it's ever been
usueful...
Change-Id: I29e5e48abf71612eed656ce6569246caf8a320bc
* 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
1) Have CachedCursor implement CrossProcessCursor; still need to
figure out how this ever worked
2) Close cursor used internally in findMailboxOfType
Bug: 4869024
Change-Id: Id20d37b7b83e133aa4d5fe9293a42ae217024f01
* 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
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
When the KeyStore fails to give us back a certificate for any reason (it
was removed from the keystore perhaps), propagate the error back up.
Change-Id: I4f0ef783c1665589cc8ccb43d95da43a297a3e9a
This introduces an exception which needs to be thrown from a KeyManager
when it tries to establish a connection with a server requesting a
certificate.
Change-Id: I06dfad7789ed5d320b630e7e4380e15da42a48df
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
This introduces the ability for clients (i.e. the exchange service) to
register "special connection types" that use a client certificate stored
in the system keystore. The alias is encoded into the URI scheme for
those clients, and the socket factory used for those connections will
use the approprate KeyManager.
Lots of TODO's, including bubbling a lot of this up to the higher level
and wiring the UI to actually set the alias in the HostAuth table.
Change-Id: If5e1901c5b58731fdabd3e6b6da7198134b512d2
* Also, a convenience method to test the base flag
* Follow-up CL will add these flags for Exchange
Change-Id: I38dc1d19e89805989e674c17919db238b4913a1c