Merge "Fix ThemePicker for use_resource_processor: true" into main
diff --git a/res/layout/fragment_grid.xml b/res/layout/fragment_grid.xml
index f022268..e77da57 100644
--- a/res/layout/fragment_grid.xml
+++ b/res/layout/fragment_grid.xml
@@ -33,9 +33,11 @@
<com.android.wallpaper.picker.DisplayAspectRatioFrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
+ android:layout_marginHorizontal="24dp"
android:layout_weight="1"
+ android:paddingBottom="40dp"
android:paddingTop="20dp"
- android:paddingBottom="40dp">
+ android:clipChildren="false">
<include
android:id="@+id/preview"
diff --git a/src/com/android/customization/module/ThemePickerInjector.kt b/src/com/android/customization/module/ThemePickerInjector.kt
index 9e63127..8fd13d3 100644
--- a/src/com/android/customization/module/ThemePickerInjector.kt
+++ b/src/com/android/customization/module/ThemePickerInjector.kt
@@ -201,7 +201,7 @@
override fun getWallpaperInteractor(context: Context): WallpaperInteractor {
if (getFlags().isMultiCropEnabled() && getFlags().isMultiCropPreviewUiEnabled()) {
- return injectedWallpaperInteractor
+ return injectedWallpaperInteractor.get()
}
val appContext = context.applicationContext
diff --git a/src/com/android/customization/picker/clock/ui/viewmodel/ClockCarouselViewModel.kt b/src/com/android/customization/picker/clock/ui/viewmodel/ClockCarouselViewModel.kt
index cb79398..28f58c4 100644
--- a/src/com/android/customization/picker/clock/ui/viewmodel/ClockCarouselViewModel.kt
+++ b/src/com/android/customization/picker/clock/ui/viewmodel/ClockCarouselViewModel.kt
@@ -33,6 +33,7 @@
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.flatMapLatest
+import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.mapNotNull
@@ -65,6 +66,10 @@
ClockCarouselItemViewModel(it.clockId, it.isSelected, contentDescription)
}
}
+ // makes sure that the operations above this statement are executed on I/O dispatcher
+ // while parallelism limits the number of threads this can run on which makes sure that
+ // the flows run sequentially
+ .flowOn(backgroundDispatcher.limitedParallelism(1))
.stateIn(viewModelScope, SharingStarted.Eagerly, emptyList())
val selectedClockSize: Flow<ClockSize> = interactor.selectedClockSize