Use media executor

This commit is contained in:
M66B 2023-01-01 11:43:43 +01:00
parent cf3effd43c
commit fb531a3caa
3 changed files with 9 additions and 2 deletions

View File

@ -997,7 +997,7 @@ public class EntityRule {
return true;
}
Helper.getSerialExecutor().submit(new Runnable() {
Helper.getMediaTaskExecutor().submit(new Runnable() {
@Override
public void run() {
try {

View File

@ -248,6 +248,7 @@ public class Helper {
private static ExecutorService sSerialExecutor = null;
private static ExecutorService sParallelExecutor = null;
private static ExecutorService sSerialTaskExecutor = null;
private static ExecutorService sMediaExecutor = null;
private static ExecutorService sDownloadExecutor = null;
private static int sOperationIndex = 0;
@ -271,6 +272,12 @@ public class Helper {
return sSerialTaskExecutor;
}
static ExecutorService getMediaTaskExecutor() {
if (sMediaExecutor == null)
sMediaExecutor = getBackgroundExecutor(0, 1, 3, "media");
return sMediaExecutor;
}
static ExecutorService getDownloadTaskExecutor() {
if (sDownloadExecutor == null)
sDownloadExecutor = getBackgroundExecutor(0, 0, 3, "download");

View File

@ -32,7 +32,7 @@ public class MediaPlayerHelper {
static void queue(Context context, Uri uri, boolean alarm, int duration) {
Log.i("Queuing sound=" + uri);
Helper.getSerialExecutor().submit(new Runnable() {
Helper.getMediaTaskExecutor().submit(new Runnable() {
@Override
public void run() {
try {