[automerger skipped] Merge Coral/Flame into AOSP master am: 65c1ecb961 -s ours am: f9f860d88e -s ours
am: 074c480e6f -s ours
am skip reason: change_id Idff1f3caff103926cd2cb267dab1d96bbb4daf33 with SHA1 ab8b1013a9 is in history

Change-Id: I15c1461a106e27781edc604844e7c1fec538ea89
diff --git a/src/com/android/customization/module/StatsLogUserEventLogger.java b/src/com/android/customization/module/StatsLogUserEventLogger.java
index 37c64ac..e604f99 100644
--- a/src/com/android/customization/module/StatsLogUserEventLogger.java
+++ b/src/com/android/customization/module/StatsLogUserEventLogger.java
@@ -53,8 +53,8 @@
 
     @Override
     public void logActionClicked(String collectionId, int actionLabelResId) {
-        WallpaperStatsLog.write(CODE, StyleEnums.WALLPAPER_EXPLORE, 0, 0, 0, 0, 0, collectionId.hashCode(),
-                0, 0, 0);
+        WallpaperStatsLog.write(CODE, StyleEnums.WALLPAPER_EXPLORE, 0, 0, 0, 0, 0,
+                collectionId.hashCode(), 0, 0, 0);
     }
 
     @Override
@@ -65,7 +65,7 @@
 
     @Override
     public void logCategorySelected(String collectionId) {
-        WallpaperStatsLog.write(CODE, StyleEnums.WALLPAPER_SELECT,
+        WallpaperStatsLog.write(CODE, StyleEnums.WALLPAPER_OPEN_CATEGORY,
                 0, 0, 0, 0, 0,
                 collectionId.hashCode(),
                 0, 0, 0);
@@ -73,10 +73,11 @@
 
     @Override
     public void logWallpaperSet(String collectionId, @Nullable String wallpaperId) {
-        WallpaperStatsLog.write(CODE, StyleEnums.WALLPAPER_SELECT,
+        WallpaperStatsLog.write(CODE, StyleEnums.WALLPAPER_APPLIED,
                 0, 0, 0, 0, 0,
                 collectionId.hashCode(),
-                0, 0, 0);
+                wallpaperId != null ? wallpaperId.hashCode() : 0,
+                0, 0);
     }
 
     @Nullable
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);
                 }