From b325ce8203a751b0223e737be1469c42907e6cd5 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Thu, 19 Jun 2014 23:51:12 -0700 Subject: [PATCH] Add a null check to UserAvatarView.setBitmap Adds a null check for the bitmap to set. Resets the paint's shader in case of a null bitmap to release any previous image. Change-Id: I1adf3c8ef44522a593fe3f25726b6c83120d7556 --- .../android/systemui/statusbar/phone/UserAvatarView.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java index 6c9dc85e45d45..6f2642a674258 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UserAvatarView.java @@ -90,8 +90,12 @@ public class UserAvatarView extends View { public void setBitmap(Bitmap bitmap) { setDrawable(null); mBitmap = bitmap; - mBitmapPaint.setShader(new BitmapShader( - bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP)); + if (mBitmap != null) { + mBitmapPaint.setShader(new BitmapShader( + bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP)); + } else { + mBitmapPaint.setShader(null); + } configureBounds(); invalidate(); }