OSDN Git Service

Avoid crashing on corrupted notifications.
authorDan Sandler <dsandler@android.com>
Wed, 25 Feb 2015 18:20:39 +0000 (13:20 -0500)
committerThe Android Automerger <android-build@google.com>
Thu, 26 Mar 2015 01:49:42 +0000 (18:49 -0700)
If a notification content view has an @id/icon or
@id/right_icon, we need to make sure those ImageViews
actually have a drawable inside.

Bug: 19487078
Change-Id: I4ef6c4a10926823aa8680628097ed150d9e717d4

packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java

index 59b62e5..57d162b 100644 (file)
@@ -79,7 +79,8 @@ public class NotificationTemplateViewWrapper extends NotificationViewWrapper {
 
         // If the icon already has a color filter, we assume that we already forced the icon to be
         // white when we created the notification.
-        mIconForceGraysaleWhenDark = mIcon != null && mIcon.getDrawable().getColorFilter() != null;
+        final Drawable iconDrawable = mIcon != null ? mIcon.getDrawable() : null;
+        mIconForceGraysaleWhenDark = iconDrawable != null && iconDrawable.getColorFilter() != null;
     }
 
     private ImageView resolveIcon(ImageView largeIcon, ImageView rightIcon) {