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

@@ -16,6 +16,9 @@ package com.android.launcher3.util;
* limitations under the License.
*/
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -24,13 +27,10 @@ import android.content.res.Configuration;
import android.graphics.Point;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManager.DisplayListener;
import android.os.Handler;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
import com.android.launcher3.MainThreadExecutor;
import java.util.function.Consumer;
/**
@@ -78,7 +78,7 @@ public class ConfigMonitor extends BroadcastReceiver implements DisplayListener
// Listen for display manager change
mContext.getSystemService(DisplayManager.class)
.registerDisplayListener(this, new Handler(UiThreadHelper.getBackgroundLooper()));
.registerDisplayListener(this, UI_HELPER_EXECUTOR.getHandler());
}
@Override
@@ -122,7 +122,7 @@ public class ConfigMonitor extends BroadcastReceiver implements DisplayListener
if (mCallback != null) {
Consumer<Context> callback = mCallback;
mCallback = null;
new MainThreadExecutor().execute(() -> callback.accept(mContext));
MAIN_EXECUTOR.execute(() -> callback.accept(mContext));
}
}