mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-03 05:34:51 +00:00
Keep mbox export awake
This commit is contained in:
parent
d13f8f3e02
commit
31c6dd2692
2 changed files with 11 additions and 2 deletions
|
@ -1389,7 +1389,7 @@ public class FragmentFolders extends FragmentBase {
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
Log.unexpectedError(getParentFragmentManager(), ex);
|
Log.unexpectedError(getParentFragmentManager(), ex);
|
||||||
}
|
}
|
||||||
}.execute(this, args, "folder:export");
|
}.setKeepAwake(true).execute(this, args, "folder:export");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onEditAccountName(Bundle args) {
|
private void onEditAccountName(Bundle args) {
|
||||||
|
|
|
@ -52,6 +52,7 @@ import java.util.concurrent.Future;
|
||||||
public abstract class SimpleTask<T> implements LifecycleObserver {
|
public abstract class SimpleTask<T> implements LifecycleObserver {
|
||||||
private boolean log = true;
|
private boolean log = true;
|
||||||
private boolean count = true;
|
private boolean count = true;
|
||||||
|
private boolean keepawake = false;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private long started;
|
private long started;
|
||||||
|
@ -85,6 +86,11 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SimpleTask<T> setKeepAwake(boolean value) {
|
||||||
|
this.keepawake = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public SimpleTask<T> setExecutor(ExecutorService executor) {
|
public SimpleTask<T> setExecutor(ExecutorService executor) {
|
||||||
this.localExecutor = executor;
|
this.localExecutor = executor;
|
||||||
return this;
|
return this;
|
||||||
|
@ -183,7 +189,10 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
|
||||||
public void run() {
|
public void run() {
|
||||||
// Run in background thread
|
// Run in background thread
|
||||||
try {
|
try {
|
||||||
wl.acquire(MAX_WAKELOCK);
|
if (keepawake)
|
||||||
|
wl.acquire();
|
||||||
|
else
|
||||||
|
wl.acquire(MAX_WAKELOCK);
|
||||||
|
|
||||||
if (log)
|
if (log)
|
||||||
Log.i("Executing task=" + name);
|
Log.i("Executing task=" + name);
|
||||||
|
|
Loading…
Reference in a new issue