Commit Graph

127 Commits

Author SHA1 Message Date
Jorge Ruesga 08ace26ed6 email: imap push
Change-Id: I8a184a5644e4322ee65d969e14cd47fe119f5df2
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:05:32 -07:00
Jorge Ruesga 8210da8b50 email: suggested contacts
This change adds support for suggested contacts (email addresses not in the contact
provider and received via email). The implementation creates a new separate
"extras" database (to avoid conflicts with future aosp changes). In the table
SuggestedContacts are stored every email address present in every email inserted
in the database.
This allow to display this contacts in the RecipientEditTextView when compose an email.
Suggested contacts are selected by account (only those ones received by that account).

This features is opt-out by default, but it can be activated in general settings by
choosing the suggested contact mode:

* none: Not active
* recents: Those received within the last 7 days
* all: All the suggested contacts

Change-Id: I156c3b1e2c4e4cff985a2183bc72b805bd596f3b
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:03:21 -07:00
Ricardo Cerqueira 7fbf9f957c DBHelper: Support upgrades from CM11
Add the new columns when coming from v126, add the old ones when
coming from any other value (or creating) so that they're there
when the feature gets reintroduced

Change-Id: I48ec042b30afbcefd43bdad0042147b6b0d2249f
2015-10-18 14:02:20 -07:00
Anthony Lee 8b7fd49b13 Fix restoreBodySource key so it returns the correct value.
The previous version of this function would return the _ID value
instead of the SOURCE_MESSAGE_KEY value from the Body row.

Bug: 17720266
Change-Id: Ie4cfc988b0659892b68d31472ef0c41d4aa98c68
2014-10-21 13:19:45 -07:00
James Lemieux 40236a8931 Display sync errors using snackbar and not as a TL footer
b/16463253

The FAB compose button overlaps the action button found in the TL footer
when network errors occur during sync. To avoid this overlap, the snackbar
is used to display these errors and they no longer appear as a TL footer.

In order to signal the sync error to AAC for display in the snackbar, the
Folder.lastSyncResult needed to be encoded in the manner that AAC reads.
This was not happening for POP/IMAP/Exchange accounts, so a large portion
of this change is encoding that value properly every place it is written.

To ensure the value is read/written properly everywhere, common methods were
introduced in UIProvider that do this work. UIProviderTest was also added
to ensure the read/write methods agree with each other.

Finally, the display of the "Load More" TL footer was updated to match the
latest spec.

Change-Id: I9d3ae1157f288f05b0fed4d1385858f6c9ebfbf9
2014-09-29 17:51:27 -07:00
Martin Hibdon 3c2f782c35 When we migrate Exchange folders, set the sync status to INITIAL_SYNC_NEEDED
b/17443087
When we migrate exchange accounts, we copy mailboxes over to the
new account (in order to preserve sync frequency and window).
The problem with this is, you may have many accounts/mailboxes.
After starting the app, it may take quite a long time before all
mailboxes are synced. If the user visits some mailbox near the
bottom, they'll see a misleading "folder is empty" view.
Now, when migrating, we'll set the uisyncstatus to INITIAL_SYNC_NEEDED.

Here I needed to add INITAL_SYNC_NEEDED to the list of states
that EmailConversationCursor will consider incompletely loaded.

Change-Id: Idef13adf9d691c03665830a2f926b1806d7591da
2014-09-26 16:02:22 -07:00
Anthony Lee 3d16e5d4b9 Move over to the new AttachmentService.
Change-Id: I4a687b003884ea6a92a755fcbf394001bfc96a38
2014-06-25 09:56:29 -07:00
Paul Westbrook 4038f464de Enable supression of combined account
This enables the client of the provider to suppress the email combined
account.  Later, the UI can enable a combined account that spans all of
the account types

Change-Id: I77e201f751019240af2274a1f74e2124b9889aab
2014-06-20 00:09:07 -07:00
Tony Mantler c1265d2090 Merge "Move email bodies to files" into ub-mail-master 2014-05-15 16:43:00 +00:00
Tony Mantler 82a207132b Move account backup/restore to userdata in AccountManager
Change-Id: Iea9f2a1b1f2d87e07d63cbb1df5a0d6355ea4031
2014-05-14 15:15:49 -07:00
Tony Mantler 7525feb244 Move email bodies to files
Change-Id: Icfd0c4ab2ad25cc02b45cf41e7a205c17948ef2c
2014-05-14 13:27:49 -07:00
Tony Mantler 2f97a7c658 Clean up unused code and warnings in Account
Change-Id: I40475eb6c8afa6b7b28fd143b9ad4fd268ff4657
2014-05-13 10:46:30 -07:00
Tony Mantler 2f288864b6 Fetch email bodies using ContentResolver#openInputStream
This brings us further along the path to storing email bodies
outside of the database.

Change-Id: I96296114ade0d561df724878ed92999306bcd176
2014-05-08 15:50:57 -07:00
Anthony Lee 533093abd7 Make sure that queries against the Body table have ID columns.
Performed some cleanup and updated the source key projection
to include an ID to make sure that EmailMessageCursor works
properly.

Change-Id: I272fac474de876fdd2a08136e0ba97b3f5dc2c7e
2014-04-28 16:11:04 -07:00
Tony Mantler 3c73a04bec Continue purging the unused reply parts
Change-Id: I47b5bbe50ba36e68ad7ba80647f401b992660ba1
2014-04-18 14:04:23 -07:00
Tony Mantler fd69e5b036 Purge unused/obsolete body fields
Change-Id: Idafa09b58f5753e4cb3cad754c861cc8e3d80c34
2014-04-17 14:32:10 -07:00
Tony Mantler 9caaebb142 Bypass the cursor completely when passing message within EmailContent contexts
We should investigate using PFDs when passing to the UI layer too, for consistency

Change-Id: I21ad1987926b93af20287ae8e49bfc7a4ad99570
2014-04-16 16:49:29 -07:00
Tony Mantler 3dd85723a1 Cleanup in EmailContent
Change-Id: Ifa251eb206779f59ea003f99395d454c7e407bc2
2014-04-14 12:54:39 -07:00
Tony Mantler 2aeb498d4e Fix attachment loading for messages which have been forwarded
These attachments have a contentUri where the attachment ID is not equal
to the ID of the actual attachment.

b/13900073

Change-Id: Ic62b8165be2e80bc47eac40dc9eb5ac53c3cd6c5
2014-04-08 14:18:56 -07:00
Anthony Lee eba80c114e b/9564335. Add support for a maxAttachmentSize column in the Account
table and connect the data to the Settings object in the existing
location (SettingsColumns.MAX_ATTACHMENT_SIZE).

Change-Id: Iaf48995757511e1dfb65aa35ff6d81bbc47187bd

Conflicts:
	src/com/android/email/provider/DBHelper.java
2014-03-19 17:33:29 -07:00
Tony Mantler 0f8d16f56a Fix content observing
b/12834957

Change-Id: I00e2fc48e1d78665e0cdcfc3f4fb483f5a047252
2014-02-05 16:58:54 -08:00
Tony Mantler 062f27fa37 Clean up AccountSettingsFragment loading
Also extend EmailContent to allow registering a ContentObserver

b/12816752

Change-Id: Ida873ac10101af92c627858d1d86c3a5ccd4ab26
2014-01-30 14:05:20 -08:00
Martin Hibdon ab29555b72 Log the stack trace if we do a DB operation on the UI thread
Change-Id: I0b9e7fff502ef5ee0f8b373cb3352958b8de08c2
2014-01-03 09:07:01 -08:00
Martin Hibdon 0b25179dab Allow database to hold oauth credentials
Change-Id: I127297fd78c7676995f1dcfa59fbbcafe4e72e8e
2013-12-09 16:18:28 -08:00
Martin Hibdon e39f2b0f27 Add fallbacks if sentDate is not set
b/11520812
This should make behavior better if the imap server
does not set the date header.

Change-Id: I593e14ce0a94179a39779ec47831fb8d3caef95b
2013-11-12 11:52:01 -08:00
Yu Ping Hu 5181cd6d4a Add a provider call to get device friendly name.
For now, it sends the device model name as friendly name, in lieu
of actually having a user-supplied friendly name. This is wrong
for at least two reasons:

1) We need to have an actual user-supplied friendly name, but that's
   not easy to find.
2) This really shouldn't be a provider query -- it should be something
   the Exchange can know locally (ideally this is a system preference
   but that's not currently implemented). This workaround just lets
   us have some reasonable value that we can update easily.

Bug: 11161234
Change-Id: If83ad768736de19c9d0e833d1f86a6ce9daf5039
2013-10-30 11:50:41 -07:00
Martin Hibdon c86fbb5bcb Add an additional mailbox key column to message table
b/11294681
The problem is that when we try to open an attachment for a
message in search results, it fails. The reason is that part of
loading the attachment, we need to open the remote folder the
message is in. For search results, the message's mailboxKey is
the special fake "search_results" folder, which doesn't actually
exist on the server.
For this change, I've added a new column called "mainMailboxKey".
For search results, this column will be populated with the real
mailbox the message is in. It will be blank for other messages.

This is a quick and low risk fix for this bug, but it's kind
of awkward. We would prefer to do one or both of the following
some time after MR1.

1. Make the "search_results" folder be a virtual folder, the same
way that unread, starred, and other virtual folders are. For these,
there is actually no mailbox row in the database, just some
queries that check various flags in the messages and behave
like folders in the UI. The messages actually still reside in the
real folders.
2. Remove the requirement to open the folder at all to load the
attachment.

Change-Id: I825ab846f78bf8b041a5d1d579260dc5d7b4c522
2013-10-23 14:58:57 -07:00
Yu Ping Hu d0b81a0d06 Treat updates into non-existent body rows as inserts.
Bug: 11245727
Change-Id: I648b0267e9149f3f431ce01be9789087f73edab1
2013-10-21 16:35:45 -07:00
Yu Ping Hu 3f24a9e2c7 Don't push things that haven't performed initial sync.
Also remove the ping kick.

Bug: 11081520
Change-Id: I21d5050886b2c352771013f4f3e5b9282482d508
2013-10-04 14:36:43 -07:00
Tony Mantler 768c6b86db Don't show "No messages" when starting a search on Exchange
Also clean up some finals

b/11027351

Change-Id: Ib76cc90b04acb531d53b2d6bdc4e3b0ad911f72c
2013-10-01 12:02:47 -07:00
Martin Hibdon aad690f699 Improve display of attachments in pop
b/10714298
This is related to this CL in UnifiedEmail
https://googleplex-android-review.git.corp.google.com/#/c/363626/1

Change-Id: Idea2827791ed52e7558b11aaea07b1f3f1764db5
2013-09-20 17:39:05 -07:00
Alon Albert 29d886ced7 Implement a resyncMailbox Method
Deletes all messages in a mailbox, resets the sync key and requests a sync.

Only supports Mail mailboxes for now.

Change-Id: Iab8c051631f38687c02a22cb80ce4f50c2d9c6f1
2013-09-19 08:27:41 -07:00
Yu Ping Hu e984940465 Fix MessageStateChange to include mailbox id.
Also ignore messages without server ids for moves and
state changes.

Also cleanup to match needs of EAS upsync.

Bug: 10678136
Change-Id: Id4d5229b8479e61bd718b707b0d2bc77a9e68046
2013-09-15 15:43:35 -07:00
Yu Ping Hu ca79aba675 Add the MessageMove & MessageStateChange tables.
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
2013-09-09 15:47:26 -07:00
Scott Kennedy 0a710bde68 Fix notification preference migration
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
2013-08-26 14:19:54 -07:00
Yu Ping Hu 336e65b6e1 Add the moved messages query.
Change-Id: I6dea8055c5d1a4195b9613f684fbd1f5e8d807fd
2013-08-23 15:50:10 -07:00
Martin Hibdon b4d4729fa2 Merge "Add PingDuration to the Account table" into jb-ub-mail-ur10 2013-08-22 00:17:25 +00:00
Martin Hibdon 52135c6e87 Add PingDuration to the Account table
b/10328857
this is so that we can keep the current ping
duration and restore it on startup.

Change-Id: I7ae11fd21687cb9013222924934154c5ebe1f7e7
2013-08-21 17:00:55 -07:00
Paul Westbrook e568f1bd37 Use resources for authority/package name
This will better handle the case where the Email package name
changes from the "orignal package name"

Bug: 9763397

Change-Id: I8e01620551ce473e389e6a13963caaf685aea221
2013-08-20 17:55:47 -07:00
Paul Westbrook 5440a40532 Prevent NPE
If two threads call EmailContent.init(), one of them may use
uninitialized EmailContent contstants

Bug: 10355491

Change-Id: Iedcad01345989df62baf755bf4d63c123e307b7c
2013-08-16 20:27:24 -07:00
Tony Mantler c6953b7755 Reimplement QuickResponse support
b/8622751

Change-Id: Id079efcf34dce15b5f5057f937582c0e198d3d50
2013-08-16 14:08:54 -07:00
Tony Mantler 6d24534804 Continue rewriting QuickResponse support
Change-Id: I95530e84d91f4becb3de5280af83ce546e1ed093
2013-08-12 11:40:16 -07:00
Martin Hibdon c75f5880ab Implement two part imap sync
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
2013-08-07 12:26:24 -07:00
Yu Ping Hu 5ff368b845 Improve message counting, ah ah ah!
- 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
2013-07-31 14:27:01 -07:00
Yu Ping Hu 0a68a255c5 Delete unused projection.
My previous CL was a lie. Turns out I don't need this at all.

Change-Id: I090efbd19f10f0fa58566acac1886b6da54d3319
2013-07-18 17:54:03 -07:00
Yu Ping Hu 966f237e77 Hijack an unused projection.
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
2013-07-18 11:54:10 -07:00
Scott Kennedy 229c070b0b Change the concept of a default account
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
2013-06-27 10:22:22 -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
Yu Ping Hu 17d5bbf768 Improve mailbox sync and load more.
- 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
2013-04-11 21:06:08 +00:00