From dafe6fbd908a7045d09f22482ea6c816c35e3230 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Mon, 17 Nov 2025 20:52:42 +0700 Subject: [PATCH] fix: Re-added functions in ExecutorsModule.kt --- .../launcher3/concurrent/ExecutorsModule.kt | 70 +++++++++++++++++++ .../util/dagger/LauncherExecutorsModule.kt | 5 +- 2 files changed, 71 insertions(+), 4 deletions(-) diff --git a/concurrent/src/com/android/launcher3/concurrent/ExecutorsModule.kt b/concurrent/src/com/android/launcher3/concurrent/ExecutorsModule.kt index 55eee71ac8..fb2f64a9f6 100644 --- a/concurrent/src/com/android/launcher3/concurrent/ExecutorsModule.kt +++ b/concurrent/src/com/android/launcher3/concurrent/ExecutorsModule.kt @@ -66,6 +66,76 @@ import kotlinx.coroutines.asCoroutineDispatcher @Module interface ExecutorsModule { + // Unordered background executors + @Binds + @ThreadPool + fun provideThreadPoolExecutor( + @ThreadPool listeningExecutorService: ListeningExecutorService + ): Executor + + @Binds + @ThreadPool + fun provideThreadPoolExecutorService( + @ThreadPool listeningExecutorService: ListeningExecutorService + ): ExecutorService + // end unordered background executors + + // Ordered background executors + @Binds + @Background + fun provideBackgroundExecutor( + @Background listeningExecutorService: ListeningExecutorService + ): Executor + + @Binds + @Background + fun provideBackgroundExecutorService( + @Background listeningExecutorService: ListeningExecutorService + ): ExecutorService + + @Binds + @LightweightBackground(LightweightBackgroundPriority.UI) + fun provideUiLightweightBackgroundExecutor( + @LightweightBackground(LightweightBackgroundPriority.UI) + listeningExecutorService: ListeningExecutorService + ): Executor + + @Binds + @LightweightBackground(LightweightBackgroundPriority.UI) + fun provideUiLightweightBackgroundExecutorService( + @LightweightBackground(LightweightBackgroundPriority.UI) + listeningExecutorService: ListeningExecutorService + ): ExecutorService + + @Binds + @LightweightBackground(LightweightBackgroundPriority.DATA) + fun provideDataLightweightBackgroundExecutor( + @LightweightBackground(LightweightBackgroundPriority.DATA) + listeningExecutorService: ListeningExecutorService + ): Executor + + @Binds + @LightweightBackground(LightweightBackgroundPriority.DATA) + fun provideDataLightweightBackgroundExecutorService( + @LightweightBackground(LightweightBackgroundPriority.DATA) + listeningExecutorService: ListeningExecutorService + ): ExecutorService + // end ordered background executors + + // UI executors + @Binds + @Ui + fun provideUiExecutor( + @Ui listeningExecutorService: ListeningExecutorService + ): Executor + + @Binds + @Ui + fun provideUiExecutorService( + @Ui listeningExecutorService: ListeningExecutorService + ): ExecutorService + // end UI executors + // The following methods provide the CoroutineContext for the executors. companion object { diff --git a/src/com/android/launcher3/util/dagger/LauncherExecutorsModule.kt b/src/com/android/launcher3/util/dagger/LauncherExecutorsModule.kt index b80fa575cf..595140d19d 100644 --- a/src/com/android/launcher3/util/dagger/LauncherExecutorsModule.kt +++ b/src/com/android/launcher3/util/dagger/LauncherExecutorsModule.kt @@ -34,9 +34,6 @@ import dagger.Module import dagger.Binds import dagger.Provides -import java.util.concurrent.Executor -import java.util.concurrent.ExecutorService - /** * Module that provides the executors for Launcher3 as per the [ExecutorsModule] * interface. @@ -89,4 +86,4 @@ abstract class LauncherExecutorsModule { return MoreExecutors.listeningDecorator(Executors.THREAD_POOL_EXECUTOR) } } -} \ No newline at end of file +}