Prevent OOME exception

If we fail to copy the screenshot for a feedback, we shoudln't
crash the app.  The caller already handles no screenshot being
returned

Bug: 10857957
Change-Id: I71626cbbf3e899d7140ed1bab502c6453f24148b
diff --git a/src/com/android/mail/utils/Utils.java b/src/com/android/mail/utils/Utils.java
index c4927cd..8286bef 100644
--- a/src/com/android/mail/utils/Utils.java
+++ b/src/com/android/mail/utils/Utils.java
@@ -979,18 +979,22 @@
             final Bitmap drawingCache = rootView.getDrawingCache();
             // Null check to avoid NPE discovered from monkey crash:
             if (drawingCache != null) {
-                final Bitmap originalBitmap = drawingCache.copy(Bitmap.Config.RGB_565, false);
-                double originalHeight = originalBitmap.getHeight();
-                double originalWidth = originalBitmap.getWidth();
-                int newHeight = SCALED_SCREENSHOT_MAX_HEIGHT_WIDTH;
-                int newWidth = SCALED_SCREENSHOT_MAX_HEIGHT_WIDTH;
-                double scaleX, scaleY;
-                scaleX = newWidth  / originalWidth;
-                scaleY = newHeight / originalHeight;
-                final double scale = Math.min(scaleX, scaleY);
-                newWidth = (int)Math.round(originalWidth * scale);
-                newHeight = (int)Math.round(originalHeight * scale);
-                return Bitmap.createScaledBitmap(originalBitmap, newWidth, newHeight, true);
+                try {
+                    final Bitmap originalBitmap = drawingCache.copy(Bitmap.Config.RGB_565, false);
+                    double originalHeight = originalBitmap.getHeight();
+                    double originalWidth = originalBitmap.getWidth();
+                    int newHeight = SCALED_SCREENSHOT_MAX_HEIGHT_WIDTH;
+                    int newWidth = SCALED_SCREENSHOT_MAX_HEIGHT_WIDTH;
+                    double scaleX, scaleY;
+                    scaleX = newWidth  / originalWidth;
+                    scaleY = newHeight / originalHeight;
+                    final double scale = Math.min(scaleX, scaleY);
+                    newWidth = (int)Math.round(originalWidth * scale);
+                    newHeight = (int)Math.round(originalHeight * scale);
+                    return Bitmap.createScaledBitmap(originalBitmap, newWidth, newHeight, true);
+                } catch (OutOfMemoryError e) {
+                    LogUtils.e(LOG_TAG, e, "OOME when attempting to scale screenshot");
+                }
             }
         }
         return null;