Only make mailbox syncing expedited if the incoming request was

In CalendarSyncAdapterService and ContactsSyncAdapterService,
when we get an onPerformSync(), we just make a new sync request
for a particular exchange mailbox. The trouble is that if the
new request is "expedited", and the original request was not,
then the original request will be canceled. When this happens,
after the second sync completes, the original will be started
again. This can put us in a rapidly spinning infinite loop.

With this CL, our new sync request will only be expedited if
the incoming request was also expedited. This should prevent the
infinite loop. It unfortunately means that background calendar
and contacts syncs can take extra long to start, because we must
wait for the sync manager to decide to run the original sync,
and then wait again for it to perform the actual mailbox sync.
That's a good enough trade off for now.

Change-Id: I51689f4a54b3b9bae2f797730287e30eb39f4649
2 files changed