Moving various common executors to a single location

Change-Id: I44bca49b8adb6fa22c3b48d10f674e42c28d792c
This commit is contained in:
Sunny Goyal
2019-08-15 14:53:41 -07:00
parent 4fa6f63ffd
commit 6fe3eec95c
59 changed files with 434 additions and 441 deletions

View File

@@ -15,14 +15,13 @@
*/
package com.android.launcher3.util;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.view.inputmethod.InputMethodManager;
/**
@@ -30,25 +29,15 @@ import android.view.inputmethod.InputMethodManager;
*/
public class UiThreadHelper {
private static HandlerThread sHandlerThread;
private static Handler sHandler;
private static final int MSG_HIDE_KEYBOARD = 1;
private static final int MSG_SET_ORIENTATION = 2;
private static final int MSG_RUN_COMMAND = 3;
public static Looper getBackgroundLooper() {
if (sHandlerThread == null) {
sHandlerThread =
new HandlerThread("UiThreadHelper", Process.THREAD_PRIORITY_FOREGROUND);
sHandlerThread.start();
}
return sHandlerThread.getLooper();
}
private static Handler getHandler(Context context) {
if (sHandler == null) {
sHandler = new Handler(getBackgroundLooper(),
sHandler = new Handler(UI_HELPER_EXECUTOR.getLooper(),
new UiCallbacks(context.getApplicationContext()));
}
return sHandler;