mirror of https://github.com/M66B/FairEmail.git
Clear handling operations
This commit is contained in:
parent
8dcb084a58
commit
16f8759a08
|
@ -1138,15 +1138,17 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
|
|
||||||
// Observe operations
|
// Observe operations
|
||||||
Handler handler = new Handler(getMainLooper()) {
|
Handler handler = new Handler(getMainLooper()) {
|
||||||
|
private List<Long> handling = new ArrayList<>();
|
||||||
private LiveData<List<EntityOperation>> liveOperations;
|
private LiveData<List<EntityOperation>> liveOperations;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(android.os.Message msg) {
|
public void handleMessage(android.os.Message msg) {
|
||||||
Log.i(account.name + "/" + folder.name + " observe=" + msg.what);
|
Log.i(account.name + "/" + folder.name + " observe=" + msg.what);
|
||||||
try {
|
try {
|
||||||
if (msg.what == 0)
|
if (msg.what == 0) {
|
||||||
liveOperations.removeObserver(observer);
|
liveOperations.removeObserver(observer);
|
||||||
else {
|
handling.clear();
|
||||||
|
} else {
|
||||||
liveOperations = db.operation().liveOperations(folder.id);
|
liveOperations = db.operation().liveOperations(folder.id);
|
||||||
liveOperations.observe(ServiceSynchronize.this, observer);
|
liveOperations.observe(ServiceSynchronize.this, observer);
|
||||||
}
|
}
|
||||||
|
@ -1156,7 +1158,6 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Observer<List<EntityOperation>> observer = new Observer<List<EntityOperation>>() {
|
private Observer<List<EntityOperation>> observer = new Observer<List<EntityOperation>>() {
|
||||||
private List<Long> handling = new ArrayList<>();
|
|
||||||
private final ExecutorService folderExecutor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
private final ExecutorService folderExecutor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
||||||
private final PowerManager.WakeLock wlFolder = pm.newWakeLock(
|
private final PowerManager.WakeLock wlFolder = pm.newWakeLock(
|
||||||
PowerManager.PARTIAL_WAKE_LOCK, BuildConfig.APPLICATION_ID + ":folder." + folder.id);
|
PowerManager.PARTIAL_WAKE_LOCK, BuildConfig.APPLICATION_ID + ":folder." + folder.id);
|
||||||
|
@ -1229,13 +1230,6 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(@Nullable Object obj) {
|
|
||||||
boolean eq = super.equals(obj);
|
|
||||||
Log.i(account.name + "/" + folder.name + " equal=" + eq + " observer=" + observer + " other=" + obj);
|
|
||||||
return eq;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2635,21 +2629,22 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
db.folder().setFolderError(outbox.id, null);
|
db.folder().setFolderError(outbox.id, null);
|
||||||
|
|
||||||
handler = new Handler(getMainLooper()) {
|
handler = new Handler(getMainLooper()) {
|
||||||
|
private List<Long> handling = new ArrayList<>();
|
||||||
private LiveData<List<EntityOperation>> liveOperations;
|
private LiveData<List<EntityOperation>> liveOperations;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(android.os.Message msg) {
|
public void handleMessage(android.os.Message msg) {
|
||||||
Log.i(outbox.name + " observe=" + msg.what);
|
Log.i(outbox.name + " observe=" + msg.what);
|
||||||
if (msg.what == 0)
|
if (msg.what == 0) {
|
||||||
liveOperations.removeObserver(observer);
|
liveOperations.removeObserver(observer);
|
||||||
else {
|
handling.clear();
|
||||||
|
} else {
|
||||||
liveOperations = db.operation().liveOperations(outbox.id);
|
liveOperations = db.operation().liveOperations(outbox.id);
|
||||||
liveOperations.observe(ServiceSynchronize.this, observer);
|
liveOperations.observe(ServiceSynchronize.this, observer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Observer<List<EntityOperation>> observer = new Observer<List<EntityOperation>>() {
|
private Observer<List<EntityOperation>> observer = new Observer<List<EntityOperation>>() {
|
||||||
private List<Long> handling = new ArrayList<>();
|
|
||||||
private ExecutorService executor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
private ExecutorService executor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
||||||
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||||
PowerManager.WakeLock wl = pm.newWakeLock(
|
PowerManager.WakeLock wl = pm.newWakeLock(
|
||||||
|
|
Loading…
Reference in New Issue