summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2011-01-04 13:52:22 -0800
committerJim Miller <jaggies@google.com>2011-01-04 13:52:22 -0800
commit25eef89082787c39a472349c693e821a05b6e83e (patch)
treee16115fba0fcbbcbdccd956b9392bd5b296f96f8 /packages
parent1451862b0af3a2d7df5f0eb2878863a583922177 (diff)
downloadframeworks_base-25eef89082787c39a472349c693e821a05b6e83e.zip
frameworks_base-25eef89082787c39a472349c693e821a05b6e83e.tar.gz
frameworks_base-25eef89082787c39a472349c693e821a05b6e83e.tar.bz2
Fix 3309250: Don't crash when thumbnail is null
This fixes a bug where Recents would crash when the thumbnail for the given app isn't available. The defined behavior for this situation should be just the app icon on top of the default glow background. Change-Id: Ie5a3a7878381a6b8fc640319fccfc16387e3d4cc
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java31
1 files changed, 17 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
index bd9bdb2..612427b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
@@ -257,20 +257,23 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC
private Bitmap compositeBitmap(Bitmap background, Bitmap thumbnail) {
Bitmap outBitmap = background.copy(background.getConfig(), true);
- Canvas canvas = new Canvas(outBitmap);
- Paint paint = new Paint();
- paint.setAntiAlias(true);
- paint.setFilterBitmap(true);
- paint.setAlpha(255);
- final int srcWidth = thumbnail.getWidth();
- final int height = thumbnail.getHeight();
- final int srcHeight = srcWidth > height ? height : (height - height * srcWidth / height);
- canvas.drawBitmap(thumbnail,
- new Rect(0, 0, srcWidth-1, srcHeight-1),
- new RectF(GLOW_PADDING,
- GLOW_PADDING - 4.0f,
- outBitmap.getWidth() - GLOW_PADDING + 2.0f,
- outBitmap.getHeight() - GLOW_PADDING + 3.0f), paint);
+ if (thumbnail != null) {
+ Canvas canvas = new Canvas(outBitmap);
+ Paint paint = new Paint();
+ paint.setAntiAlias(true);
+ paint.setFilterBitmap(true);
+ paint.setAlpha(255);
+ final int srcWidth = thumbnail.getWidth();
+ final int height = thumbnail.getHeight();
+ final int srcHeight = srcWidth > height ? height
+ : (height - height * srcWidth / height);
+ canvas.drawBitmap(thumbnail,
+ new Rect(0, 0, srcWidth-1, srcHeight-1),
+ new RectF(GLOW_PADDING,
+ GLOW_PADDING - 4.0f,
+ outBitmap.getWidth() - GLOW_PADDING + 2.0f,
+ outBitmap.getHeight() - GLOW_PADDING + 3.0f), paint);
+ }
return outBitmap;
}