Use dedicated executor for main

This commit is contained in:
M66B 2022-12-30 08:27:14 +01:00
parent 987042be96
commit 3ff735b1cc
1 changed files with 6 additions and 2 deletions

View File

@ -41,6 +41,7 @@ import androidx.preference.PreferenceManager;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
public class ActivityMain extends ActivityBase implements FragmentManager.OnBackStackChangedListener, SharedPreferences.OnSharedPreferenceChangeListener {
static final int RESTORE_STATE_INTERVAL = 3; // minutes
@ -49,6 +50,9 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
private static final long SERVICE_START_DELAY = 5 * 1000L; // milliseconds
private static final long IGNORE_STORAGE_SPACE = 24 * 60 * 60 * 1000L; // milliseconds
private static final ExecutorService executor =
Helper.getBackgroundExecutor(0, 1, 3, "main");
@Override
protected void onCreate(Bundle savedInstanceState) {
long now = new Date().getTime();
@ -167,7 +171,7 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
protected void onException(Bundle args, Throwable ex) {
// Ignored
}
}.execute(this, args, "message:linked");
}.setExecutor(executor).execute(this, args, "message:linked");
return;
}
@ -337,7 +341,7 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
})
.show();
}
};
}.setExecutor(executor);
if (Helper.shouldAuthenticate(this, false))
Helper.authenticate(ActivityMain.this, ActivityMain.this, null,