Inform users when "Set wallpaper" fails.

Bug: 23716897
Change-Id: I06cd63d9ee869235c6a4c3140e574bf4c710454e
diff --git a/WallpaperPicker/res/values/strings.xml b/WallpaperPicker/res/values/strings.xml
index 72b1e15..2bfd476 100644
--- a/WallpaperPicker/res/values/strings.xml
+++ b/WallpaperPicker/res/values/strings.xml
@@ -28,6 +28,9 @@
          usually see this when using another app and trying to set
          an image as the wallpaper -->
     <string name="wallpaper_load_fail">Couldn\'t load image as wallpaper</string>
+    <!-- Error message when an image is selected as a wallpaper,
+         but something goes wrong when the user clicks "Set wallpaper" -->
+    <string name="wallpaper_set_fail">Couldn\'t set image as wallpaper</string>
     <!-- Shown when wallpapers are selected in Wallpaper picker -->
     <!-- String indicating how many media item(s) is(are) selected
             eg. 1 selected [CHAR LIMIT=30] -->
diff --git a/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java b/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java
index a79fb65..8b51447 100644
--- a/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java
+++ b/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java
@@ -31,6 +31,9 @@
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.util.Log;
+import android.widget.Toast;
+
+import com.android.launcher3.R;
 
 import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
@@ -395,9 +398,12 @@
     }
 
     @Override
-    protected void onPostExecute(Boolean result) {
+    protected void onPostExecute(Boolean cropSucceeded) {
+        if (!cropSucceeded) {
+            Toast.makeText(mContext, R.string.wallpaper_set_fail, Toast.LENGTH_SHORT).show();
+        }
         if (mOnEndCropHandler != null) {
-            mOnEndCropHandler.run(result);
+            mOnEndCropHandler.run(cropSucceeded);
         }
     }
 }
\ No newline at end of file