1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

Properly abort operations

This commit is contained in:
M66B 2020-09-21 21:10:59 +02:00
parent d5e1cf1ae1
commit f11867bedb
2 changed files with 4 additions and 1 deletions

View file

@ -530,6 +530,8 @@ class Core {
if (ops.size() == 0) if (ops.size() == 0)
state.batchCompleted(folder.id, priority, sequence); state.batchCompleted(folder.id, priority, sequence);
else
state.error(new OperationCanceledException("Processing"), session);
} finally { } finally {
Log.i(folder.name + " end process state=" + state + " pending=" + ops.size()); Log.i(folder.name + " end process state=" + state + " pending=" + ops.size());
} }

View file

@ -35,6 +35,7 @@ import android.net.NetworkInfo;
import android.net.NetworkRequest; import android.net.NetworkRequest;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.OperationCanceledException;
import android.os.PowerManager; import android.os.PowerManager;
import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification;
import android.text.TextUtils; import android.text.TextUtils;
@ -1358,7 +1359,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
ServiceSynchronize.this, ServiceSynchronize.this,
folder.name + " " + Log.formatThrowable(ex, false)); folder.name + " " + Log.formatThrowable(ex, false));
db.folder().setFolderError(folder.id, Log.formatThrowable(ex)); db.folder().setFolderError(folder.id, Log.formatThrowable(ex));
state.error(ex, session); state.error(new OperationCanceledException("Process"), session);
} finally { } finally {
if (shouldClose) { if (shouldClose) {
if (ifolder != null && ifolder.isOpen()) { if (ifolder != null && ifolder.isOpen()) {