Commit Graph

26 Commits

Author SHA1 Message Date
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 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 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 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 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 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
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
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
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
Anthony Lee 824a80491c Calculate available background threads for AttachmentService correctly.
Also iterated on some logging to help debug Attachment issues:

Bug: 17789960
Change-Id: I77331f9a41f5c95ed228e8ca5fd36a66db5b78ee
2014-10-02 15:29:03 -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 ce6916b32a Don't allow disabling of the camera with managed profiles
Change-Id: I2e6085084682b04ef7973bc433214b5b3ab2da79
2014-09-25 13:48:11 -07:00
Paul Westbrook bb68c13afa Changes to support smaller email tombstone apk size
This reduces the tombstone down by 100K

A follow-on cl will remove the unused resources from the tombstone build

Bug: 17414014
Change-Id: I5d38811b17a5273ec726e750ab123e10e36cee04
2014-09-16 13:59:07 -07:00