diff options
author | Daniel Sandler <dsandler@android.com> | 2010-05-25 11:48:32 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2010-05-25 11:49:48 -0400 |
commit | 3f8175a86e24b3568d1f5b12e1d3d5efcc57d691 (patch) | |
tree | 37e39233e405d9b236d4622a671569421080b61b /src/com | |
parent | d0b7a8cf2b26afe598799d4a451a985f0da45c2d (diff) | |
download | android_packages_apps_Trebuchet-3f8175a86e24b3568d1f5b12e1d3d5efcc57d691.tar.gz android_packages_apps_Trebuchet-3f8175a86e24b3568d1f5b12e1d3d5efcc57d691.tar.bz2 android_packages_apps_Trebuchet-3f8175a86e24b3568d1f5b12e1d3d5efcc57d691.zip |
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
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/DragController.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/com/android/launcher2/DragController.java b/src/com/android/launcher2/DragController.java index daabbcc4c..b4f972bb2 100644 --- a/src/com/android/launcher2/DragController.java +++ b/src/com/android/launcher2/DragController.java @@ -163,6 +163,11 @@ public class DragController { 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 @@ public class DragController { } v.buildDrawingCache(); Bitmap cacheBitmap = v.getDrawingCache(); + if (cacheBitmap == null) { + Log.e(TAG, "failed getViewBitmap(" + v + ")", new RuntimeException()); + return null; + } Bitmap bitmap = Bitmap.createBitmap(cacheBitmap); |