Offset preview to start if on wallpaper display

For static wallpaper preview, offset the preview to the start of the
wallpaper if the current display is the largest display(wallpaper
display) on multi-display devices. Other wallpaper remains the same.

Test: set multiple wallpapers w/wo fullscreen preview
Bug: 259745033
Change-Id: I34b593e706f2d60d7f213f229bc525214bdcca0d
diff --git a/src/com/android/customization/module/DefaultCustomizationSections.java b/src/com/android/customization/module/DefaultCustomizationSections.java
index 1097a71..c47a6e6 100644
--- a/src/com/android/customization/module/DefaultCustomizationSections.java
+++ b/src/com/android/customization/module/DefaultCustomizationSections.java
@@ -26,6 +26,7 @@
 import com.android.wallpaper.module.CurrentWallpaperInfoFactory;
 import com.android.wallpaper.module.CustomizationSections;
 import com.android.wallpaper.picker.customization.ui.section.ScreenPreviewSectionController;
+import com.android.wallpaper.util.DisplayUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -57,7 +58,8 @@
             WallpaperPreviewNavigator wallpaperPreviewNavigator,
             CustomizationSectionNavigationController sectionNavigationController,
             @Nullable Bundle savedInstanceState,
-            CurrentWallpaperInfoFactory wallpaperInfoFactory) {
+            CurrentWallpaperInfoFactory wallpaperInfoFactory,
+            DisplayUtils displayUtils) {
         List<CustomizationSectionController<?>> sectionControllers = new ArrayList<>();
 
         // Wallpaper section.
@@ -67,7 +69,8 @@
                         lifecycleOwner,
                         screen,
                         wallpaperInfoFactory,
-                        wallpaperColorsViewModel));
+                        wallpaperColorsViewModel,
+                        displayUtils));
 
         // Theme color section.
         sectionControllers.add(new ColorSectionController(
@@ -115,14 +118,15 @@
             PermissionRequester permissionRequester,
             WallpaperPreviewNavigator wallpaperPreviewNavigator,
             CustomizationSectionNavigationController sectionNavigationController,
-            @Nullable Bundle savedInstanceState) {
+            @Nullable Bundle savedInstanceState,
+            DisplayUtils displayUtils) {
         List<CustomizationSectionController<?>> sectionControllers = new ArrayList<>();
 
         // Wallpaper section.
         sectionControllers.add(new WallpaperSectionController(
                 activity, lifecycleOwner, permissionRequester, wallpaperColorsViewModel,
                 workspaceViewModel, sectionNavigationController, wallpaperPreviewNavigator,
-                savedInstanceState));
+                savedInstanceState, displayUtils));
 
         // Theme color section.
         sectionControllers.add(new ColorSectionController(
diff --git a/src/com/android/customization/picker/WallpaperPreviewer.java b/src/com/android/customization/picker/WallpaperPreviewer.java
index fa7dd81..354eec2 100644
--- a/src/com/android/customization/picker/WallpaperPreviewer.java
+++ b/src/com/android/customization/picker/WallpaperPreviewer.java
@@ -154,14 +154,16 @@
                         .loadPreviewImage(mActivity,
                                 renderInImageWallpaperSurface ? homeImageWallpaper : mHomePreview,
                                 ResourceUtils.getColorAttr(
-                                        mActivity, android.R.attr.colorSecondary));
+                                        mActivity, android.R.attr.colorSecondary),
+                                /* offsetToStart= */ true);
                 if (mWallpaper instanceof LiveWallpaperInfo) {
                     mWallpaper.getThumbAsset(mActivity.getApplicationContext())
                             .loadPreviewImage(
                                     mActivity,
                                     homeImageWallpaper,
                                     ResourceUtils.getColorAttr(
-                                            mActivity, android.R.attr.colorSecondary));
+                                            mActivity, android.R.attr.colorSecondary),
+                                    /* offsetToStart= */ true);
                     setUpLiveWallpaperPreview(mWallpaper);
                 } else {
                     // Ensure live wallpaper connection is disconnected.
diff --git a/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePreviewBinder.kt b/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePreviewBinder.kt
index c8fea0f..9248d66 100644
--- a/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePreviewBinder.kt
+++ b/src/com/android/customization/picker/quickaffordance/ui/binder/KeyguardQuickAffordancePreviewBinder.kt
@@ -39,6 +39,7 @@
         previewView: CardView,
         viewModel: KeyguardQuickAffordancePickerViewModel,
         lifecycleOwner: LifecycleOwner,
+        offsetToStart: Boolean,
     ) {
         val binding =
             ScreenPreviewBinder.bind(
@@ -46,6 +47,7 @@
                 previewView = previewView,
                 viewModel = viewModel.preview,
                 lifecycleOwner = lifecycleOwner,
+                offsetToStart = offsetToStart,
             )
 
         previewView.contentDescription =
diff --git a/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt b/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt
index d2245db..51b98ef 100644
--- a/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt
+++ b/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt
@@ -74,6 +74,8 @@
             previewView = view.requireViewById(R.id.preview),
             viewModel = viewModel,
             lifecycleOwner = this,
+            offsetToStart =
+                injector.getDisplayUtils(requireActivity()).isOnWallpaperDisplay(requireActivity())
         )
         KeyguardQuickAffordancePickerBinder.bind(
             view = view,