Make sure we hold WakeLock during mail sending (fixes #2180551)
* Don't runAsleep unless this is a Ping * Relates to #2178288 in that it's possible that the system could sleep while we're trying to send (not sure if this is possible; will check), so we prevent it by holding a WakeLock in this case Change-Id: Ib3f8786501b942e1cfcb7a0bbb07b8e3084e2a86
This commit is contained in:
parent
479b22a2f8
commit
ea878be117
@ -408,6 +408,7 @@ public class EasSyncService extends AbstractSyncService {
|
||||
protected HttpResponse sendHttpClientPost(String cmd, HttpEntity entity, int timeout)
|
||||
throws IOException {
|
||||
HttpClient client = getHttpClient(timeout);
|
||||
boolean sleepAllowed = cmd.equals(PING_COMMAND);
|
||||
|
||||
// Split the mail sending commands
|
||||
String extra = null;
|
||||
@ -432,13 +433,17 @@ public class EasSyncService extends AbstractSyncService {
|
||||
method.setEntity(entity);
|
||||
synchronized(getSynchronizer()) {
|
||||
mPendingPost = method;
|
||||
SyncManager.runAsleep(mMailboxId, timeout+(10*SECONDS));
|
||||
if (sleepAllowed) {
|
||||
SyncManager.runAsleep(mMailboxId, timeout+(10*SECONDS));
|
||||
}
|
||||
}
|
||||
try {
|
||||
return client.execute(method);
|
||||
} finally {
|
||||
synchronized(getSynchronizer()) {
|
||||
SyncManager.runAwake(mMailboxId);
|
||||
if (sleepAllowed) {
|
||||
SyncManager.runAwake(mMailboxId);
|
||||
}
|
||||
mPendingPost = null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user