summaryrefslogtreecommitdiff
path: root/src/com/android/launcher3/util/Executors.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/util/Executors.java')
-rw-r--r--src/com/android/launcher3/util/Executors.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/launcher3/util/Executors.java b/src/com/android/launcher3/util/Executors.java
index dec4b5ca8d..c622b71108 100644
--- a/src/com/android/launcher3/util/Executors.java
+++ b/src/com/android/launcher3/util/Executors.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.util;
+import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
+
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Process;
@@ -47,6 +49,12 @@ public class Executors {
POOL_SIZE, POOL_SIZE, KEEP_ALIVE, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
/**
+ * An {@link LooperExecutor} to be used with async task where order is important.
+ */
+ public static final LooperExecutor ORDERED_BG_EXECUTOR = new LooperExecutor(
+ createAndStartNewLooper("BackgroundExecutor", THREAD_PRIORITY_BACKGROUND));
+
+ /**
* Returns the executor for running tasks on the main thread.
*/
public static final LooperExecutor MAIN_EXECUTOR =
@@ -62,7 +70,9 @@ public class Executors {
/** A background executor to preinflate views. */
public static final ExecutorService VIEW_PREINFLATION_EXECUTOR =
- java.util.concurrent.Executors.newSingleThreadExecutor();
+ java.util.concurrent.Executors.newSingleThreadExecutor(
+ new SimpleThreadFactory(
+ "preinflate-allapps-icons", THREAD_PRIORITY_BACKGROUND));
/**
* Utility method to get a started handler thread statically