Merge "Import translations. DO NOT MERGE ANYWHERE" into main
diff --git a/src/com/android/customization/module/ThemePickerInjector.kt b/src/com/android/customization/module/ThemePickerInjector.kt
index 819f906..e01fa44 100644
--- a/src/com/android/customization/module/ThemePickerInjector.kt
+++ b/src/com/android/customization/module/ThemePickerInjector.kt
@@ -28,7 +28,6 @@
 import androidx.lifecycle.LifecycleOwner
 import androidx.lifecycle.ViewModelProvider
 import com.android.customization.model.color.ColorCustomizationManager
-import com.android.customization.model.color.ColorOptionsProvider
 import com.android.customization.model.color.ColorOptionsProvider.COLOR_SOURCE_PRESET
 import com.android.customization.model.grid.GridOptionsManager
 import com.android.customization.model.mode.DarkModeSnapshotRestorer
@@ -197,6 +196,10 @@
     }
 
     override fun getWallpaperInteractor(context: Context): WallpaperInteractor {
+        if (getFlags().isMultiCropEnabled() && getFlags().isMultiCropPreviewUiEnabled()) {
+            return injectedWallpaperInteractor
+        }
+
         val appContext = context.applicationContext
         return wallpaperInteractor
             ?: WallpaperInteractor(
@@ -206,7 +209,6 @@
                             client =
                                 WallpaperClientImpl(
                                     context = appContext,
-                                    infoFactory = getCurrentWallpaperInfoFactory(appContext),
                                     wallpaperManager = WallpaperManager.getInstance(appContext),
                                     wallpaperPreferences = getPreferences(appContext)
                                 ),
@@ -216,7 +218,7 @@
                     shouldHandleReload = {
                         TextUtils.equals(
                             getColorCustomizationManager(appContext).currentColorSource,
-                            ColorOptionsProvider.COLOR_SOURCE_PRESET
+                            COLOR_SOURCE_PRESET,
                         )
                     }
                 )
diff --git a/src_override/com/android/wallpaper/picker/di/modules/InteractorModule.kt b/src_override/com/android/wallpaper/picker/di/modules/InteractorModule.kt
new file mode 100644
index 0000000..81edb2f
--- /dev/null
+++ b/src_override/com/android/wallpaper/picker/di/modules/InteractorModule.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.wallpaper.picker.di.modules
+
+import android.text.TextUtils
+import com.android.customization.model.color.ColorCustomizationManager
+import com.android.customization.model.color.ColorOptionsProvider.COLOR_SOURCE_PRESET
+import com.android.wallpaper.picker.customization.data.repository.WallpaperRepository
+import com.android.wallpaper.picker.customization.domain.interactor.WallpaperInteractor
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+
+/** This class provides the singleton scoped interactors for theme picker. */
+@InstallIn(SingletonComponent::class)
+@Module
+internal object InteractorModule {
+
+    @Provides
+    @Singleton
+    fun provideWallpaperInteractor(
+        wallpaperRepository: WallpaperRepository,
+        colorCustomizationManager: ColorCustomizationManager,
+    ): WallpaperInteractor {
+        return WallpaperInteractor(wallpaperRepository) {
+            TextUtils.equals(colorCustomizationManager.currentColorSource, COLOR_SOURCE_PRESET)
+        }
+    }
+}
diff --git a/tests/module/src/com/android/customization/TestModule.kt b/tests/module/src/com/android/customization/TestModule.kt
index 19c42f8..84b870f 100644
--- a/tests/module/src/com/android/customization/TestModule.kt
+++ b/tests/module/src/com/android/customization/TestModule.kt
@@ -1,5 +1,8 @@
 package com.android.customization
 
+import androidx.test.core.app.ApplicationProvider
+import com.android.customization.model.color.ColorCustomizationManager
+import com.android.customization.model.theme.OverlayManagerCompat
 import com.android.customization.module.CustomizationInjector
 import com.android.customization.module.CustomizationPreferences
 import com.android.customization.module.logging.TestThemesUserEventLogger
@@ -66,5 +69,14 @@
         fun provideDefaultWallpaperModelFactory(): DefaultWallpaperModelFactory {
             return DefaultWallpaperModelFactory()
         }
+
+        @Provides
+        @Singleton
+        fun provideColorCustomizationManager(): ColorCustomizationManager {
+            return ColorCustomizationManager.getInstance(
+                ApplicationProvider.getApplicationContext(),
+                OverlayManagerCompat(ApplicationProvider.getApplicationContext())
+            )
+        }
     }
 }