mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-01 14:13:22 +01:00
Introduce thread priorities for threads and handlerthreads.
This commit is contained in:
@@ -14,6 +14,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.signal.core.util.ThreadUtil;
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
|
||||
@@ -80,7 +81,7 @@ final class DeviceTransferClient implements Handler.Callback {
|
||||
this.context = context;
|
||||
this.clientTask = clientTask;
|
||||
this.shutdownCallback = shutdownCallback;
|
||||
this.commandAndControlThread = SignalExecutors.getAndStartHandlerThread("client-cnc");
|
||||
this.commandAndControlThread = SignalExecutors.getAndStartHandlerThread("client-cnc", ThreadUtil.PRIORITY_IMPORTANT_BACKGROUND_THREAD);
|
||||
this.handler = new Handler(commandAndControlThread.getLooper(), this);
|
||||
this.autoRestart = () -> {
|
||||
Log.i(TAG, "Restarting WiFi Direct since we haven't found anything yet and it could be us.");
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.signal.core.util.ThreadUtil;
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.signal.devicetransfer.SelfSignedIdentity.SelfSignedKeys;
|
||||
@@ -70,7 +71,7 @@ final class DeviceTransferServer implements Handler.Callback {
|
||||
this.context = context;
|
||||
this.serverTask = serverTask;
|
||||
this.shutdownCallback = shutdownCallback;
|
||||
this.commandAndControlThread = SignalExecutors.getAndStartHandlerThread("server-cnc");
|
||||
this.commandAndControlThread = SignalExecutors.getAndStartHandlerThread("server-cnc", ThreadUtil.PRIORITY_IMPORTANT_BACKGROUND_THREAD);
|
||||
this.handler = new Handler(commandAndControlThread.getLooper(), this);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public final class WifiDirect {
|
||||
|
||||
WifiDirect(@NonNull Context context) {
|
||||
this.context = context.getApplicationContext();
|
||||
this.wifiDirectCallbacksHandler = SignalExecutors.getAndStartHandlerThread("wifi-direct-cb");
|
||||
this.wifiDirectCallbacksHandler = SignalExecutors.getAndStartHandlerThread("wifi-direct-cb", ThreadUtil.PRIORITY_IMPORTANT_BACKGROUND_THREAD);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user