summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2010-05-24 18:36:53 -0400
committerJoe Onorato <joeo@android.com>2010-06-02 14:48:44 -0700
commit871bdb9867f6630d8bb28e5607263e8bf4eac3ba (patch)
tree6b3579f5b72d78d3333ba5c2b1d2566775d932b3 /packages
parent20da8f8ac9cfc8b845231c6b93f5b64a764ab39a (diff)
downloadframeworks_base-871bdb9867f6630d8bb28e5607263e8bf4eac3ba.zip
frameworks_base-871bdb9867f6630d8bb28e5607263e8bf4eac3ba.tar.gz
frameworks_base-871bdb9867f6630d8bb28e5607263e8bf4eac3ba.tar.bz2
Handle bad icon resources.
Change-Id: I87c5fe68ad8016596068ba7889f3b6d36da3386b
Diffstat (limited to 'packages')
-rw-r--r--packages/StatusBarPhone/src/com/android/policy/statusbar/phone/StatusBarIconView.java46
1 files changed, 30 insertions, 16 deletions
diff --git a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/StatusBarIconView.java b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/StatusBarIconView.java
index 58b9822..6b0b6d5 100644
--- a/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/StatusBarIconView.java
+++ b/packages/StatusBarPhone/src/com/android/policy/statusbar/phone/StatusBarIconView.java
@@ -32,6 +32,7 @@ public class StatusBarIconView extends AnimatedImageView {
private StatusBarIcon mIcon;
@ViewDebug.ExportedProperty private String mSlot;
+ @ViewDebug.ExportedProperty private boolean mError;
public StatusBarIconView(Context context, String slot) {
super(context);
@@ -52,24 +53,37 @@ public class StatusBarIconView extends AnimatedImageView {
}
public void set(StatusBarIcon icon) {
- final boolean iconEquals = mIcon != null
- && streq(mIcon.iconPackage, icon.iconPackage)
- && mIcon.iconId == icon.iconId;
- final boolean levelEquals = iconEquals
- && mIcon.iconLevel == icon.iconLevel;
- final boolean visibilityEquals = mIcon != null
- && mIcon.visible == icon.visible;
- if (!iconEquals) {
- setImageDrawable(getIcon(icon));
- // TODO: What if getIcon returns null?
- }
- if (!levelEquals) {
- setImageLevel(icon.iconLevel);
+ error: {
+ final boolean iconEquals = !mError
+ && mIcon != null
+ && streq(mIcon.iconPackage, icon.iconPackage)
+ && mIcon.iconId == icon.iconId;
+ final boolean levelEquals = !mError
+ && iconEquals
+ && mIcon.iconLevel == icon.iconLevel;
+ final boolean visibilityEquals = !mError
+ && mIcon != null
+ && mIcon.visible == icon.visible;
+ mError = false;
+ if (!iconEquals) {
+ Drawable drawable = getIcon(icon);
+ if (drawable == null) {
+ mError = true;
+ break error;
+ }
+ setImageDrawable(drawable);
+ }
+ if (!levelEquals) {
+ setImageLevel(icon.iconLevel);
+ }
+ if (!visibilityEquals) {
+ setVisibility(icon.visible ? VISIBLE : GONE);
+ }
+ mIcon = icon.clone();
}
- if (!visibilityEquals) {
- setVisibility(icon.visible ? VISIBLE : GONE);
+ if (mError) {
+ setVisibility(GONE);
}
- mIcon = icon.clone();
}
/**