[automerger skipped] Merge qt-r1-dev-plus-aosp-without-vendor (5817612) into stage-aosp-master am: 639116d20f -s ours
am: 74c2c255b4 -s ours
am skip reason: change_id I0f9ac646b953d8831f47f28b2f20df90d9b028d9 with SHA1 209f1362de is in history

Change-Id: I7867200273d3e18f37ee7c2ea8b8e83c5a3a24b6
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index f584dec..e4682bb 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -23,6 +23,7 @@
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.Bitmap.Config;
+import android.graphics.Matrix;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.LayerDrawable;
@@ -61,6 +62,7 @@
 import com.android.customization.widget.PreviewPager;
 import com.android.wallpaper.R;
 import com.android.wallpaper.asset.Asset;
+import com.android.wallpaper.asset.Asset.CenterCropBitmapTask;
 import com.android.wallpaper.model.WallpaperInfo;
 import com.android.wallpaper.module.CurrentWallpaperInfoFactory;
 import com.android.wallpaper.module.InjectorProvider;
@@ -552,7 +554,9 @@
                     if (wallpaperPreviewAsset != null) {
                         wallpaperPreviewAsset.decodeBitmap(
                                 targetWidth, targetHeight,
-                                bitmap -> setWallpaperBitmap(view, bitmap));
+                                bitmap -> new CenterCropBitmapTask(bitmap, view,
+                                        croppedBitmap -> setWallpaperBitmap(view, croppedBitmap))
+                                .execute());
                     }
                     view.removeOnLayoutChangeListener(this);
                 }