summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Sandler <dsandler@android.com>2015-08-10 15:49:56 -0400
committerDan Sandler <dsandler@android.com>2015-08-10 16:04:12 -0400
commit334398105f1119472988a1d5abc003051678752d (patch)
tree6f2327a4213c8cf4a2a6997a943f357f4ea53bd7
parenta2e39c6a1197f87cab2712a7776ff9022433b90a (diff)
downloadframeworks_base-334398105f1119472988a1d5abc003051678752d.zip
frameworks_base-334398105f1119472988a1d5abc003051678752d.tar.gz
frameworks_base-334398105f1119472988a1d5abc003051678752d.tar.bz2
Crash apps with bad notification icons.
This shouldn't happen, since there are many places where invalid icons should already have been either fixed (in the case where there's an .icon but no .mSmallIcon) or rejected (if they're both null or invalid). But if a notification makes it all the way to SystemUI without a valid icon, let's crash the sender. Bug: 23011305 Change-Id: Ifaebec57d59baa1defb4520178b5815d47ed5712
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 00fa653..7065343 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -41,6 +41,7 @@ import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.Icon;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
@@ -1713,10 +1714,16 @@ public abstract class BaseStatusBar extends SystemUI implements
sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId()), n);
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
+ final Icon smallIcon = n.getSmallIcon();
+ if (smallIcon == null) {
+ handleNotificationError(sbn,
+ "No small icon in notification from " + sbn.getPackageName());
+ return null;
+ }
final StatusBarIcon ic = new StatusBarIcon(
sbn.getUser(),
sbn.getPackageName(),
- n.getSmallIcon(),
+ smallIcon,
n.iconLevel,
n.number,
n.tickerText);