Fix wallpaper preview crashes
- Launch from picker home page.
- Launch from Photos.
Fixes: 188147553
Test: Manually
Change-Id: I64ccb33b574ccd0b5d48c0eef672bcbb4308d20e
diff --git a/src/com/android/wallpaper/picker/ImagePreviewFragment.java b/src/com/android/wallpaper/picker/ImagePreviewFragment.java
index 5088608..0795811 100755
--- a/src/com/android/wallpaper/picker/ImagePreviewFragment.java
+++ b/src/com/android/wallpaper/picker/ImagePreviewFragment.java
@@ -305,6 +305,10 @@
* initializing a zoom-scroll observer and click listener.
*/
private void initFullResView() {
+ if (mRawWallpaperSize == null || mFullResImageView == null) {
+ return;
+ }
+
// Minimum scale will only be respected under this scale type.
mFullResImageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM);
// When we set a minimum scale bigger than the scale with which the full image is shown,
@@ -539,6 +543,7 @@
R.layout.fullscreen_wallpaper_preview, null);
mFullResImageView = wallpaperPreviewContainer.findViewById(R.id.full_res_image);
mLowResImageView = wallpaperPreviewContainer.findViewById(R.id.low_res_image);
+ initFullResView();
// Scale the mWallpaperSurface based on system zoom's scale so that the wallpaper is
// rendered in a larger surface than what preview shows, simulating the behavior of
// the actual wallpaper surface.