Mask bitmap creation errors while dragging shortcuts.
If we're unable to create a bitmap for the drag, e.g. due to
memory pressure, give up.
Bug: 2650809
Change-Id: I5d7360dbb1bd736a629451467e93cccdfc255b67
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java
index daabbcc..b4f972b 100644
--- a/src/com/android/launcher2/DragController.java
+++ b/src/com/android/launcher2/DragController.java
@@ -163,6 +163,11 @@
Bitmap b = getViewBitmap(v);
+ if (b == null) {
+ // out of memory?
+ return;
+ }
+
int[] loc = mCoordinatesTemp;
v.getLocationOnScreen(loc);
int screenX = loc[0];
@@ -249,6 +254,10 @@
}
v.buildDrawingCache();
Bitmap cacheBitmap = v.getDrawingCache();
+ if (cacheBitmap == null) {
+ Log.e(TAG, "failed getViewBitmap(" + v + ")", new RuntimeException());
+ return null;
+ }
Bitmap bitmap = Bitmap.createBitmap(cacheBitmap);