b/11174975
There are already several database fixing steps that
occur when the database is opened, add another one
to correct uninitialzed mailbox parent keys.
This is because we use a two pass system for adding
mailbox rows, first to insert the rows, and second to
assign parentKeys to child rows. We need two passes
because we may insert a child row before its parent,
so the parent's rowId is unavailble. But if the process
dies before the second step is complete we'll be in
an inconsistent state.
Change-Id: Ifaeeaca7e82c1e99656033bc1a9f25d7acb67517
b/11158759
Make the default sync setting for drafts folders 0
(never automatically sync), and disable the settings
control so that it cannot be changed.
Also add a db upgrade step to set any existing drafts
folders to not sync, and clean up any Exchange synced
draft messages.
Change-Id: I256bde231d722089ef2a623482f570a20eccf1de
b/11081520
This improves perceived performance, the inbox
messages will come in before contacts and calendar
Change-Id: Icd9630d9cd2fb79a54d0ed2c11702a1a3091ed7e
Some changes that allow a notification to open Account Settings for a specific
account
Bug: 10930585
Change-Id: Ib329e339b405ccbc0631d5ce6a23bf8fa6d62b83
Deletes all messages in a mailbox, resets the sync key and requests a sync.
Only supports Mail mailboxes for now.
Change-Id: Iab8c051631f38687c02a22cb80ce4f50c2d9c6f1
Also ignore messages without server ids for moves and
state changes.
Also cleanup to match needs of EAS upsync.
Bug: 10678136
Change-Id: Id4d5229b8479e61bd718b707b0d2bc77a9e68046
b/10653370
This prevents NPEs if a serviec happens to still be running
when an account is deleted.
This mirrors a similar pattern in the gmail app.
Change-Id: I6fd8ae5ffe41580df0a321ec22535403e3f32eee
We need to track changes that need to be unsynced. Because
Exchange handles moves differently from other changes, we
create two different tables. The tables are structured as
change logs to better handle error cases.
Change-Id: I4df90c75f36707fa117aed9718508426e60e0749
These settings need to be migrated from the database, not the
SharedPreferences file that likely shouldn't even exist.
Everything added to Account.java was removed in
Ie6ec389b5b5d2e7ab1b299d0877811ae716526e2
when it was believed to be unnecessary.
Bug: 10211615
Change-Id: If6193758febda8a3272d82792492503549a44e32
This will better handle the case where the Email package name
changes from the "orignal package name"
Bug: 9763397
Change-Id: I8e01620551ce473e389e6a13963caaf685aea221
If two threads call EmailContent.init(), one of them may use
uninitialized EmailContent contstants
Bug: 10355491
Change-Id: Iedcad01345989df62baf755bf4d63c123e307b7c
This isn't a great situation -- it suggests the PolicyService
is having some sort of RemoteException -- but when it happens
we should just treat it the same as if the policy is not
enforced.
Bug: 10315113
Change-Id: If2fbe1648a5c6f3df13cef02c8dc5bc6e858f2d9
b/10075523
Now, every 15 minutes we'll sync the last 24 hours.
Every 4 hours we'll perform a full sync, which will
take either the last 7 days, or until the oldest message
we already have locally.
Change-Id: Idc55a46a28af2a68cc324e414d51d88373941595
uifolders and uiallfolders cursors now setNotificationUri on
the appropriate uri. That uri is notified whenever:
- A folder is inserted, deleted, or modified.
- A message is inserted or modified (since this can affect
message counts).
This second one is still not quite right: there are some
conditions where counts aren't updating correctly.
While I was here, I renamed the notification uris to
avoid collisions between different versions of the app.
Bug: 9111855
Change-Id: Ia29bb6a65b4f673bf352fdf0e14270b3f1443ca8
I'm formalizing the concept of folders that must exist,
and the list of such folders should be accessible to all
sync adapters.
Change-Id: I9e4d2d51aa495d211eab2d1e36c3fa197a1ac00d
- Restore message_count in the database.
- For UI queries on outbox, trash, and drafts,
use message count instead of total count.
Note this won't be the right thing to do when we properly
sync trash & drafts, but we'll address that when those syncs
are fixed.
Bug: 10098601
Bug: 10113686
Change-Id: I647c74396ee12ed981d89bfb654cc6d0a25cac95
The old callback mechanism is deprecated, in favor of making
calls on the ContentProvider.
Bug: 9842867
Change-Id: I65f559e593cda24456c4ffb96f785e054626dd0b
Rather than use null, just force the valid default value.
Also rename SYNC_WINDOW_UNKNOWN to SYNC_WINDOW_ACCOUNT to
better reflect how it's actually used.
Bug: 9989995
Change-Id: I8d0b466fe3bc2e4c651c309d4815cea201058d22
By the time the remote call actually runs, the account
may be deleted from the DB, so the account id is likely
useless.
Bug: 9021105
Change-Id: If28b4b8c4b5c52be35c6ff68b326c4ea28d7f7b4
This was unused, and I want to write a query in Exchange
that wants to get a message's mailbox key, so I'm taking
this over.
Change-Id: I142394bfd30df8c88c5e1b48347a8532a4758857
This is part of moving away from the explicit setCallback,
which either has race conditions or is very noisy, or both.
(Each IEmailService call that wants callbacks should just
pass the callback explicitly.)
I'm not yet changing how the services actually handle the
call. Each protocol will need to fix this on their own.
Bug: 9735207
Bug: 9842867
Change-Id: If8cf69ffe82f3544ace9e58b1db5a183f38d038a
The user no longer has control over this. Now, the "default" account
(which is only used for prepopulating the name of new accounts is
either the last used account (to be defined), or the first account in
the database.
This removes a setting, and simplifies a lot of code.
We may also want to auto-select the default account when entering the
compose screen from the combined view, but we do not currently have
an easy way to do that.
Bug: 7442992
Change-Id: Iff5bb36d8cbd327334211b670fa4851cbda6b9a0
Fixes b/9193813. Previously we returned
a value from the database in all cases.
This meant that system folders were not
translated.
Change-Id: Ife568651886bfb6de76221b8bc5d013dac8fa21a
We are no longer doing per-mailbox sync intervals; instead,
mailboxes opt in to syncing, and the account sync interval
controls what happens.
Change-Id: I8ae32ea25079abbb63bb6a6a282bf5c06de73fca
EAS push only gets changes to the contents of collections,
but not for changes to accounts or folder structure. This
adds a new sync type to fetch only accounts, and adds a
periodic sync of this type for push accounts.
Change-Id: I1e9337252dbb5e53db3f7c5953e089de2c69d18c
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
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
Exchange used to just re-check version on first sync.
Version is known during validation so might as well use it.
Change-Id: I004fe671a1ad30a7cfe0a0659b74b20ee2136771
- Update syncTime for IMAP and POP whenever we sync.
- Change load more to simply include the delta in the RPC
rather than using the visibleLimit column.
- Add a query to get the message count for a Mailbox.
- Refactor code for updating totalCount and determining
the new message count when syncing.
- Remove dead code from Mailbox.
- Remove uses of visibleLimit from code.
Note that visibleLimit and messageCount in Mailbox table are
no longer useful and will be removed in a later change.
Bug: 8579767
Bug: 8523146
Change-Id: Ieb67e3b6f1c82c3b21b972c5a1e557cd75dc21db
The proxy for local services were not intializing the TempDirectory.
Also, move the TempDirectory initialization out of the try/catch block.
Otherwise if Device.getDeviceId threw an exception, the temp directory
wouldn't be initialized
Bug: 8531456
Change-Id: Iea34e0b03203d6c6fe6e5d1ae9902d081bd90c27
Also restores the trash icon. I'm not using the "correct"
icon -- it's the menu icon, not a folder icon -- but it
looks correct. Also, the "unread messages" icon is likewise
the menu icon for mark unread.
Bug: 8527132
Bug: 8444885
Change-Id: I7d3bc286f80f130e6f08ff1340a013d81700406e
The code for syncing new messages from client to server
somehow never got moved from Email1 to Email2.
This change also includes minor cleanup on system mailbox
flags.
Bug: 8531552
Change-Id: I1f9396635ba14cb6e641d2bc1b506c6d702f6b2e
The problem was that when the attachment was attempted to be opened
from the Exchange process, it didn't have access to the cached file.
Instead, use a content provider uri to reference the cached file.
Bug: 8400456
Change-Id: I80abd66642e938cf09f73bf0e9bd049aa8d7ba1d
This permits us to move shared code for looking up system
folder names to emailcommon, which is also in this change.
Also renames emailcommon2 to emailcommon.
This is part of a multi-project submit with
I4a071a07c3e33aaa4ea404eb66a8db1eabc9ef0e and
I5746c0353783f9b29d52d6540472588c6542a6a2.
Bug: 8383232
Change-Id: I6c6eec4f1bcf2abd54c1ed05da1add8d894ee403
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
Cache attachments in a email directory when sending to allow sending
to succeed when the content provider has a permission
Bug: 7381557
Change-Id: Icf9faead2048de237228625f998b42feade48978
This involves redoing the persistence model, to split general,
account, and folder settings into separate SharedPreference stores.
It also requires some preferences to be moved into UnifiedEmail.
Depends on Ibe2e3f93ec164370535ffc5f5b2409544cc8d36d (UnifiedEmail)
Change-Id: Ie6ec389b5b5d2e7ab1b299d0877811ae716526e2
Migrate the old value as necessary.
Update the unit tests.
Cherry-picked from I1c276ffde3496cbc66846ed4a007088d39f20382 with
minor changes.
Bug: 7624838
Change-Id: I1b3fa331b62f556701bacba5ce9cd64305d9b52a
If we're on a tablet, we will pop up a dialog that asks the user what
they want to do. When they select an option, we save it, and take
the original action, and auto-advance to their preference.
Depends on I7b11bd0d17e6cc184b67c8c943531146fc964b49
Bug: 7328118
Change-Id: Ied57eee4d90ad1d61316032d0796f9205fdd1962
* The default is to send all attachments, of course, but with
smartSend, we need to exclude the original ones or they will
be duplicated
* Another CL in Exchange is required to fix the bug
Bug: 7005505
Change-Id: I0e8bab2fb53dd4d60c82f2ef9a525ff7b015f2eb
* Much, much faster
* Remove message length pass and lots of other useless code
* Create pseudo-attachment for long messages (click to download) that
includes size (so user can determine whether it's worth it)
* Handle download of message via pseudo-attachment; real attachments
are then created as necessary.
TODO: Add real UI with UX input (or modify existing to clean up the
loose ends)
TODO: Optimizations for loading the whole message
TODO: Get server delete working (isn't working currently anyway)
Change-Id: I31f3809fc5a2f9fd490d33cfed70d2930654e71d
* Refactor/simplify Transport/MailTransport
* Add serverCert column to HostAuth table in EmailProvider
* During first connection to server, save the server certificate
in the HostAuth; on subsequent connections, ensure that the
certificate presented has the same public key as the one
stored
* For now, we'll just fail to connect (with a CertificateException)
if there's a mismatch
TODO: Add some UI to handle different certificates
Bug: 6888866
Change-Id: Ia79497e89eaad8d43617b50d3771121b2ed7f687
* Allow AccountService loginFailed API to take a reason string
* Present the reason string in the dialog shown from the login
failure notification
* Handle ALERTs in IMAP login responses (for example, some servers
will occasionally require web login and we need to inform them,
rather than simply saying the password is wrong)
* This fixes a longstanding bug in our Imap1 implementation
Change-Id: I8b270cd5d4746559b6c8a78bce02f0e7c525bdea
* Change getCapabilities API to take an account, rather than
the id of the account
* getCapabilities() can therefore execute even before Exchange
is fully up and running
Change-Id: Id4c2a9942ea7a21e0c56401c50206b680274b43e
* Handle sending mail and moving to sent folder
* Implement picker for sent folder
* Upload sent items to server
* Add support for "automatic" sync window
* Move some files from Email -> emailcommon
* The added files are copied directly from Email (and can be
removed if/when Imap2 is merged back with Email)
Change-Id: I3a6a3d224826e547748be2f1b567b6294ad5db89
This CL includes the following:
* New Imap2.apk generation (not included in builds)
* "Push IMAP" option for accounts when Imap2.apk present
* Account creation/setup
* 2-way sync of messages, deletions, flag updates
* Push (messages, flags)
* Folder list hierarchy handling
* Message text (one plain or html part)
* Picker UI for trash folder (placeholder)
* Capabilities handling/UI command
Major Imap2 new features:
* Push
* Multiple folder sync
* Sync window (like EAS)
TODO:
* Picker UI for sent folder
* Upload of sent messages to server
* Search
* Multiple viewable parts
* Probably lots more, incl. unit tests
Change-Id: Ia5d74073d9c307e0bdae72a7f76b27140dde7d14
* Also, while we're here, create default "last touched time" for drafts and
sent so that they appear in the initial recent list
Change-Id: Ie2fe20b34625b5616dac5581f9bbd015f52a82bc
* Handle startSync and loadMore
* Use SyncManager rather than MailService for periodic sync
and upload sync
* First of many CL's to disentangle sync from UI
* Note that the large majority of this CL is a refactoring
of IMAP specific code out of MessagingController and into
ImapService; MessagingController will eventually be
removed entirely from the app, as will much of Controller
Change-Id: I13546d0694479b33cf93c25920dedc1d38227f6c
* Currently, we store a generally incompatible packed string format
for to, from, bcc, cc, and reply-to columns
* Change this to UI-compatible, comma-separated RFC822 strings
* Upgrade database to use new format
Change-Id: I42c01d72b49531c4324d3956edf5ff362d5c9120
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
* We need to call this out to the user (a surprised user is an
unhappy user)
* Required for fix to bug referenced below
Bug: 5533550
Change-Id: I64a870a703de7e02ce882aefc3636a1668021eb8
* We need to call this out to the user (a surprised user is an
unhappy user)
* Required for fix to bug referenced below
Bug: 5533550
Change-Id: I7da337057b9b28300ddd485283920e12c1ae53da
* 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
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
When the socketfactory init code was moved, I forgot to re-add in the check
to skip hostname verification. This made "Trust all SSL certificates"
checkbox useless.
Bug: 5450563
Change-Id: Ie4cba749aaf8c0fd9f9c43f09ebf354c6600d4f0
* We weren't updating the account object passed in to setAccountPolicy,
which is problematic if the object is cached and used subsequently
in the code (it would have stale policy values)
Bug: 5245056
Change-Id: I279570dfd66c4a65d751f73e2e56578be186d339
* Rather than returning false, which can cause unexpected
results, e.g. locking out an account until reboot
* Partial fix for the referenced bug (there might be other
causes)
Bug: 5221119
Change-Id: I5b47093a3411deb6995624887197297323db0d2d
This is needed so Exchange can fire up Email activities.
No change other than the move.
Bug: 5122497
Change-Id: I6ee3f61654745fafd444314ecf75eb8ae6bbd01d