Commit Graph

60 Commits

Author SHA1 Message Date
Jessica Wagantall de1a096980 Android 6.0.1 Release 72 (M4B30X)
-----BEGIN PGP SIGNATURE-----
 
 iEYEABECAAYFAlfz3TAACgkQ6K0/gZqxDngnnACfWpBBPD+MBlDoVY2FWqXt7Sqb
 hJwAnjOXT7GJvfSU5u5YclHC75odF/kw
 =1TOl
 -----END PGP SIGNATURE-----

Merge tag 'android-6.0.1_r72' into HEAD

Android 6.0.1 Release 72 (M4B30X)

# gpg: Signature made Tue 04 Oct 2016 09:47:44 AM PDT using DSA key ID 9AB10E78
# gpg: Can't check signature: public key not found
2016-10-06 11:50:32 -07:00
Rohan Shah a549245b2f Limit account id and id to longs
The security issue occurs because id is allowed to be an arbitrary
path instead of being limited to what it is -- a long. Both id
and account id are now parsed into longs (and if either fails, an
error will be logged and null will be returned).

Tested/verified error is logged using the reported attack.

BUG=30745403

Change-Id: Ia21418545bbaeb96fb5ab6c3f4e71858e57b8684
(cherry picked from commit 9794d7e8216138adf143a3b6faf3d5683316a662)
2016-08-26 16:22:04 -07:00
Jorge Ruesga 34fb128e43 email: junk icon
Change-Id: I5c5ad8e76025c92c2b11dd1948e32eaa5efe8fd5
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
(cherry picked from commit b9984debe6b72f06cbf9bf72baa54b80f017eb38)
2016-01-13 05:03:18 -08:00
Jorge Ruesga c929853c2d email: return default folder name for subfolders
For subfolders of system folder type return the remote folder name instead of translate
it to the default folder type resource name. Subfolders shouldn't be considered as
system folders. For example a SPAM folder of a SPAM root folder (Junk/Ham should
be displayed as  Ham instead of Junk).

Change-Id: I2644b8da336e3f0983d24355aefe961aa8acf30b
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
(cherry picked from commit db1ca54cd325c64971240d92ed11dad175d83579)
2016-01-13 03:18:14 -08:00
Jorge Ruesga 6adbdc9f6b email: fix empty body update
Currently, body text and html are removed from the content values to be stored as files
in the filesystem. This could lead to a IllegalArgumentException because we passed
an empty content value to the update operation. We must ensure that we update
at least one item.

Related BUGDUMP-4037330 and http://forum.cyanogenmod.org/topic/112563-massive-data-use

Change-Id: Ib9ba10eb2cb86598bef6e5f8bc11553d09fc4ef8
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:06:01 -07:00
Danny Baumann a9aaccb8f6 Allow saving attachments even if there's no intent handling them.
For e.g. compressed files that doesn't mean they can't be opened, as
they still can be unpacked by the file manager.

Change-Id: I53c80b7bedb44732bc1cf346a83c1f6e39fb0da0
2015-10-18 14:06:01 -07:00
Danny Baumann a73579b5b3 Don't cancel PendingIntents used for AlarmManager.
Creating new ones (which is the implicit effect of FLAG_CANCEL_CURRENT)
causes PendingIntent.equals() to return false for the new and the old
instance, which in turn leads to AlarmManager failing to remove the
alarm.

Also remove the unneeded request code offsets. The intent actions for
the various actions are already distinct, so we need to only identify
between the intents that have the same actions; using the mailbox ID as
request code is sufficient for that purpose.

Change-Id: I9030c24a9c6b1c722b246601fde741f7027d3de7
2015-10-18 14:06:01 -07:00
Danny Baumann 99c6d7b40a Optimize connection loss and re-gain behaviour.
Schedule the ping restart through AlarmManager to be able to cancel it
properly on connection loss, and make sure to only restart idle
connections that aren't already idling (which may happen e.g. on bootup
or if there was a sync request in the 30 second wait window).

Change-Id: If62ffa0981a7a0a71ed7764a9724c07466c6d8a3
2015-10-18 14:06:01 -07:00
Danny Baumann a0ef884d04 Refine thread handling.
Remove mailboxes from the list synchronously and just do the network I/O
and thread joins in the background.

Change-Id: I2a339e5982c103b69f1212627f1cc98e98a8a068
2015-10-18 14:06:01 -07:00
Danny Baumann c96099279b Properly unregister alarm manager callbacks.
Change-Id: I2d474bc1cee168a5b76b8710b382498cd6c2fd59
2015-10-18 14:06:01 -07:00
Danny Baumann a7bc7d8572 Use AlarmManager to schedule an IDLE connection restart.
We also want to restart it during sleep.

Change-Id: Ib2c26e06fb923487b10d94edc1bbd743ebb39fb1
2015-10-18 14:06:01 -07:00
Danny Baumann 739281a727 Don't auto-register IDLE when gaining connection.
We request a sync in this case anyway, which in turn starts the IDLE
connection anyway. If we're starting IDLE earlier, we do unnecessary
work as the sync will tear it down just a few moments later.

Change-Id: I9b99023fbe1aaab72638f6ef9d29223d9a325b7b
2015-10-18 14:05:32 -07:00
Danny Baumann cb4fda8286 Do less work on IDLE refresh.
Don't do a full reconnection, but just a stopIdling/startIdling pair. In
order to be able to do that, make sure the IDLE connection is fully shut
down when stopIdling() returns, for which some refactoring was needed to
avoid a deadlock on mIdledFolders: the ImapIdleListener callbacks
acquire this lock, so stopIdling() now MUST NOT be called with
mIdledFolders lock held.

Change-Id: Ifa1677d7845722ccee2b1b9380c7b7e4014bcd97
2015-10-18 14:05:32 -07:00
Danny Baumann 9e42c23d4c Improve debug logging.
Change-Id: I13a99d5caadcc7bd2682791527f71a697d07f8d0
2015-10-18 14:05:32 -07:00
Danny Baumann 624321751a Use an inexact timer for the IDLE refresh.
Also use a wakeup timer, as we can't rely on the screen being turned on
at refresh time.

Change-Id: If64c164fd151c63404d0d63d9c463556cc3d0658
2015-10-18 14:05:32 -07:00
Danny Baumann 59553089b9 Don't throw a NPE when operating on a destroyed list.
Change-Id: Ie4ca1fdd55031efa56448bf0237d0edab51ea349
2015-10-18 14:05:32 -07:00
Danny Baumann 03f09f6450 Fix some more argument order issues.
Change-Id: I1ea17a0fba4ff3af03ee8c0acbe9967bed92aae1
2015-10-18 14:05:32 -07:00
Danny Baumann b9532055e2 Simplify logic.
Make sure that either messages are fetched or a sync is initiated, and
there can be no situation where neither happens.

Change-Id: I73ec2482a5a86c54309634f434b7d8fd77d7c079
2015-10-18 14:05:32 -07:00
Danny Baumann c59103c933 Fix some typos.
Change-Id: Idd3018a03023efe02c3bcf40b44c8f5a5e304436
2015-10-18 14:05:32 -07:00
Danny Baumann 006ea81b71 Don't solely rely on the presence of RECENT for checking for new mail.
It may happen (depending on server and/or timing) that only an EXISTS
response is sent to the IDLE connection when new mail arrives. Don't
discard that response, but evaluate it to determine whether there's new
mail by checking whether the message count increased.

Change-Id: Ia49714e6cd42dd71dfda8b7bbdf1fd622972edda
2015-10-18 14:05:32 -07:00
Danny Baumann d13071399f Don't re-sync when refreshing the IDLE connection.
The refreshing (done every 25 minutes) should be a cheap operation.
Instead, do a (quick) re-sync after idling failed.

Change-Id: Idfcc775417dc02417142e51ca546c9564c660aab
2015-10-18 14:05:32 -07:00
Danny Baumann fd42df6fc0 Reset idling flag when cancelling early due to being cancelled.
Change-Id: Idde5f3a3fa04a1aa80ef4cdb9e3ba1ab01d3fcb5
2015-10-18 14:05:32 -07:00
Danny Baumann cd69d44da0 Add some debug statements.
Change-Id: I9295bedb5b7908c8ee873285c255816373d2c602
2015-10-18 14:05:32 -07:00
Danny Baumann 36f18be31c Assign debug tags to IMAP communication output.
Allows better tracking of the output if multiple connections are active.

Change-Id: I900c9f9ecda06d3191c4cf82af7e774ae70b7dac
2015-10-18 14:05:32 -07:00
Danny Baumann e680bf0ddc Fix argument order.
Change-Id: I087937c1323cfa1fd3d5400ef0a69d7476e36d20
2015-10-18 14:05:32 -07:00
Danny Baumann f364a9b70d Simplify code.
Change-Id: I6c783afb9c436a35176134bfe7ae5264f2255b2f
2015-10-18 14:05:32 -07:00
Jorge Ruesga 377660c356 email: catch the correct exception while closing the buffers
BinaryTempFileBody#getBody()#getInputStream() returns a
MessagingException not an IOException. This causes
"com.android.emailcommon.mail.MessagingException: Unable to open body"
exception messages and attachment messages not flagged as loaded.

Change-Id: Ia8f25dd0a212ce52e3dd202c523c5db4a009604f
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:05:32 -07:00
Danny Baumann 0672de3149 Fix ArrayIndexOutOfBoundsException.
This crash happens when the server isn't able to resolve the MSN:

FATAL EXCEPTION: IdleReader 3:Inbox
Process: com.android.email, PID: 3200
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
      at com.android.email.mail.store.ImapFolder.extractImapChanges(ImapFolder.java:1641)
      at com.android.email.mail.store.ImapFolder.access$700(ImapFolder.java:77)
      at com.android.email.mail.store.ImapFolder$1.run(ImapFolder.java:294)

Change-Id: I8a8c7cf3f2949630ee9db3646e5832246d69132d
2015-10-18 14:05:32 -07:00
Jorge Ruesga 96a2b55e39 email: fix NPE
Fix possible NPE when protocol don't offers offerLookback (pop3)

Change-Id: Id924e06e691d0ed99179fcd37fd213ac379340fd
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:05:32 -07:00
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 087a0406a3 email: fix Account table creation
Due to a bug in commit 44a064e5f16ddaac25f2acfc03c118f65bc48aec,
AUTO_FETCH_ATTACHMENTS column could not be available in the Account table.
Since cm12 and up doesn't use this column, we are leave as is it. In case
the feature were added, then we need to create a new exception to ensure
that the columns is re-added.

Change-Id: I1803e343dde2e841fdc99b4489a74eb08b0a8352
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:03:25 -07:00
Jorge Ruesga 598a070c27 email: support for auto-sync multiple IMAP folders
This enables to auto-sync multiple IMAP folders, not only Inbox. Default to Inbox only.
This changes relays in the syncloopback attribute to configure the folders to add to
sync process.

Change-Id: I8973cfd6ddec33446256bc8b48418558e27596b5
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:03:22 -07:00
Jorge Ruesga f119f904ed email: don't block extras database
This will call other setences (like delete accoutns) to block access. Just integrate
in the normal database transactions

Change-Id: I48d7028f2ceddcdfbc170acd1a1fe32f0322b6e6
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2015-10-18 14:03:21 -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
Daniel Volk c2c258f261 Don't fetch deleted messages from IMAP folder
Fetching messages from an IMAP folder within a specific date range returns
messages marked as deleted, also. Unlike every other getMessages() method,
which filter out deleted messages.
This leaves server deleted messages untouched in the mail conversation
view, even when the folder is synced manually.

This patch adds "NOT DELETED" to the IMAP search command, when searching
for mails in a given date range.

Change-Id: I49e4adfcab9a1de1d1baa4700462a82df651f3cb
2015-10-18 14:02:23 -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
Ashwini Munigala 11f2252994 Add MAIL_SERVICE WAKEUP, SEND, MOVE, READ, DELETE MESSAGE action
Add change in Email App to process following intents
from Bluetooth App, for MAP MSE support.

- org.codeaurora.email.intent.action.MAIL_SERVICE_WAKEUP
- org.codeaurora.email.intent.action.MAIL_SERVICE_DELETE_MESSAGE
- org.codeaurora.email.intent.action.MAIL_SERVICE_MOVE_MESSAGE
- org.codeaurora.email.intent.action.MAIL_SERVICE_MESSAGE_READ
- org.codeaurora.email.intent.action.MAIL_SERVICE_SEND_PENDING

Change-Id: I2b46265ba20c6f333c9e6d1b19ee73f5a066f1ff
2015-10-06 03:30:32 -06:00
Martin Hibdon f0bbcd85ea Add additional analytics regarding our SSLSockets
b/18104622
There were some suggestions for additional info to log.
Now we also log the protocol being used, along with the
cipher suite, and whether or not we are accepting all
certificates (i.e. whether or not we are verifying
hostnames.)

Change-Id: Iad1fa4d2867d4a27830d54cc7fafcd0d32e0b23b
2014-10-24 14:46:33 -07:00
Martin Hibdon 93a9662d8d Add analytics to track of what cipher suites are being used
b/18001842
I do this in MailTransport, which is only used by POP and IMAP.
I can't log Analytics in SSLSocketFactoryWrapper, because that
is in emailcommon and would cause a circular dependancy between
emailcomman and UnifiedEmail.
This will not yet work for Exchange, because it gets its socket
indirectly through EmailClientConnectionManager, using a
SchemeRegistry. Still, it will be helpful to get this info for POP
and IMAP.

Change-Id: Ibb9d22c83c49d0ba5090295b5321ca6afb09e65b
2014-10-24 11:46:48 -07:00
Martin Hibdon 764d7b2f66 Merge "Disable smart foward/reply" into ub-gmail-ur14-dev 2014-10-21 20:08:50 +00:00
Martin Hibdon 99665fe7bf Disable smart foward/reply
b/17720266
When replying to a message, sometimes the wrong message
is included in the reply. This seems to be related to
smart reply/forward, since it only has ever been known to
happen on an Exchange 2013 server. For now, disable smart
reply/forward.
We do this by making the EmailProvider always zero out the
FLAGS_SUPPORTS_SMART_FORWARD bit on the account. This way
we can control this feature from the Email app, rather than
Exchange.

Change-Id: I88bb5f06a1098f9f085592b0a3cf1a01d9eb3fc7
2014-10-21 13:07:36 -07:00
Tony Mantler a2f1da2bdc Fix handling AOL's login rejection
Found while investigating b/18031180

b/18049329

Change-Id: I2c86449008fb5e89c84db1a0753b8a61f42305b9
2014-10-20 17:20:59 +00:00
Martin Hibdon f61e098a41 Correctly update UI_SYNC_STATUS upon search
b/17377040

Change-Id: I5cf9281fa204ac780b737215a86362a8317d63b6
2014-10-16 14:22:49 -07:00
Régis Décamps 2128e36569 Merge "Resend notifications when Accounts are changed" into ub-gmail-ur14-dev 2014-10-15 12:38:35 +00:00
Martin Hibdon 79cb83cad1 Set mailbox uiSyncStatus when IMAP and POP folders are created
b/17443087
Now for certain folder types, when they are first created,
the uiSyncStatus is set to NEEDS_INITIAL_SYNC. This prevents
us from displaying the empty state until after the sync has
completed.

Change-Id: Ib04c915f6972ecb75092dd50e90dee8647ee2f64
2014-10-14 15:52:58 -07:00
Martin Hibdon 5fde01e4a9 Merge "Set the search mailbox's syncState as soon as a search is requested" into ub-gmail-ur14-dev 2014-10-10 20:12:43 +00:00
Martin Hibdon 00fbbb24b3 Set the search mailbox's syncState as soon as a search is requested
b/15868294
b/17377040
When we do a search, we clear the current contents of the search mailbox,
and then send a request to whatever service is appropriate (IMAP or
Exchange.) The service then begins a sync and updates the sync state.
The thing is, this leaves a time window when the sync state is still
NONE, but no contents have been loaded yet.
So now, as soon as the search request is made, we set the sync state
to LIVE, then send off the request. That should keep the empty state
view hidden until we actually do the sync.

Change-Id: Ia97e1cf2773db460fdf32aaa45205c4e6034527d
2014-10-10 11:35:27 -07:00
Martin Hibdon 89272781fa EmailProvider now supports query and getType for cached file urls
b/17573792
This is needed so that we can send cached files as attachments.
This case comes up if you edit a draft with an attachment,
view the attachment, and then share that with Email.
Also, update the manifest so that EmailProvider grants
uri permission for cachedFiles.

Change-Id: Ib32ae8360b627823af9361cba05e0e5dbd0ae4ca
2014-10-10 11:17:52 -07:00
Régis Décamps ac03b55765 Resend notifications when Accounts are changed
When AccountManager notifies of account change, resend notifications
because the existing ones can point to an account that doesn't
exist anymore.

Bug: 17713589 Gmail crashes when accessing an old notification for an account that has been deleted.
Change-Id: I6c2cf5234006f4859fea5bbaa52970963bcfccdd
2014-10-08 13:27:00 +02:00
Martin Hibdon 46f1b89fef Merge "Get SSLSocketFactory from GmsCore" into ub-gmail-ur14-dev 2014-10-03 02:14:01 +00:00