diff options
author | Daniel Sandler <dsandler@android.com> | 2015-05-14 15:32:28 +0000 |
---|---|---|
committer | Dan Sandler <dsandler@android.com> | 2015-05-14 12:23:24 -0400 |
commit | 09e51a739f3e408567f0eefafcc5fedb01bc3401 (patch) | |
tree | d20689934b33b290a52cd74214db79b0c168fd6f /packages/SystemUI | |
parent | 1b2e5c11b6a89d56d5058907c3b0c88bf0170857 (diff) | |
download | frameworks_base-09e51a739f3e408567f0eefafcc5fedb01bc3401.zip frameworks_base-09e51a739f3e408567f0eefafcc5fedb01bc3401.tar.gz frameworks_base-09e51a739f3e408567f0eefafcc5fedb01bc3401.tar.bz2 |
Revert "Icon support comes to Notification."
This reverts commit 08a04c15245c970856022d0779aa27d4d63cdee3.
This also reverts commit 5bcbf857d129f4513e562801a4e88077b2655ade.
Change-Id: Ia0b0a5339d523581c877822a3a1feec97ae4b73d
Diffstat (limited to 'packages/SystemUI')
4 files changed, 48 insertions, 32 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index be33085..715f4e4 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -194,7 +194,7 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi // we compose the final post-save notification below. mNotificationBuilder.setLargeIcon(croppedIcon); // But we still don't set it for the expanded view, allowing the smallIcon to show here. - mNotificationStyle.bigLargeIcon((Bitmap) null); + mNotificationStyle.bigLargeIcon(null); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 1e488f3..2913c7d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1390,9 +1390,9 @@ public abstract class BaseStatusBar extends SystemUI implements final ImageView profileBadge = (ImageView) publicViewLocal.findViewById( R.id.profile_badge_line3); - final StatusBarIcon ic = new StatusBarIcon( + final StatusBarIcon ic = new StatusBarIcon(entry.notification.getPackageName(), entry.notification.getUser(), - entry.notification.getNotification().getSmallIcon(), + entry.notification.getNotification().icon, entry.notification.getNotification().iconLevel, entry.notification.getNotification().number, entry.notification.getNotification().tickerText); @@ -1770,9 +1770,9 @@ public abstract class BaseStatusBar extends SystemUI implements sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId()), n); iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); - final StatusBarIcon ic = new StatusBarIcon( + final StatusBarIcon ic = new StatusBarIcon(sbn.getPackageName(), sbn.getUser(), - n.getSmallIcon(), + n.icon, n.iconLevel, n.number, n.tickerText); @@ -1916,9 +1916,9 @@ public abstract class BaseStatusBar extends SystemUI implements try { if (entry.icon != null) { // Update the icon - final StatusBarIcon ic = new StatusBarIcon( + final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(), notification.getUser(), - n.getSmallIcon(), + n.icon, n.iconLevel, n.number, n.tickerText); @@ -1938,9 +1938,9 @@ public abstract class BaseStatusBar extends SystemUI implements } if (!updateSuccessful) { if (DEBUG) Log.d(TAG, "not reusing notification for key: " + key); - final StatusBarIcon ic = new StatusBarIcon( + final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(), notification.getUser(), - n.getSmallIcon(), + n.icon, n.iconLevel, n.number, n.tickerText); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java index 3294e15..e6847d8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java @@ -24,7 +24,6 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.graphics.drawable.Icon; import android.os.UserHandle; import android.text.TextUtils; import android.util.AttributeSet; @@ -101,23 +100,13 @@ public class StatusBarIconView extends AnimatedImageView { return a.equals(b); } - public boolean equalIcons(Icon a, Icon b) { - if (a == b) return true; - if (a.getType() != b.getType()) return false; - switch (a.getType()) { - case Icon.TYPE_RESOURCE: - return a.getResPackage().equals(b.getResPackage()) && a.getResId() == b.getResId(); - case Icon.TYPE_URI: - return a.getUriString().equals(b.getUriString()); - default: - return false; - } - } /** * Returns whether the set succeeded. */ public boolean set(StatusBarIcon icon) { - final boolean iconEquals = mIcon != null && equalIcons(mIcon.icon, icon.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 @@ -178,18 +167,45 @@ public class StatusBarIconView extends AnimatedImageView { } /** - * Returns the right icon to use for this item + * Returns the right icon to use for this item, respecting the iconId and + * iconPackage (if set) * - * @param context Context to use to get resources + * @param context Context to use to get resources if iconPackage is not set * @return Drawable for this item, or null if the package or item could not * be found */ public static Drawable getIcon(Context context, StatusBarIcon icon) { - int userId = icon.user.getIdentifier(); - if (userId == UserHandle.USER_ALL) { - userId = UserHandle.USER_OWNER; + Resources r = null; + + if (icon.iconPackage != null) { + try { + int userId = icon.user.getIdentifier(); + if (userId == UserHandle.USER_ALL) { + userId = UserHandle.USER_OWNER; + } + r = context.getPackageManager() + .getResourcesForApplicationAsUser(icon.iconPackage, userId); + } catch (PackageManager.NameNotFoundException ex) { + Log.e(TAG, "Icon package not found: " + icon.iconPackage); + return null; + } + } else { + r = context.getResources(); } - return icon.icon.loadDrawableAsUser(context, userId); + + if (icon.iconId == 0) { + return null; + } + + try { + return r.getDrawable(icon.iconId); + } catch (RuntimeException e) { + Log.w(TAG, "Icon not found in " + + (icon.iconPackage != null ? icon.iconId : "<system>") + + ": " + Integer.toHexString(icon.iconId)); + } + + return null; } public StatusBarIcon getStatusBarIcon() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java index 26d1c86..44168bc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DemoStatusIcons.java @@ -16,7 +16,6 @@ package com.android.systemui.statusbar.phone; -import android.graphics.drawable.Icon; import android.os.Bundle; import android.os.UserHandle; import android.view.Gravity; @@ -133,7 +132,8 @@ public class DemoStatusIcons extends LinearLayout implements DemoMode { break; } else { StatusBarIcon icon = v.getStatusBarIcon(); - icon.icon = Icon.createWithResource(icon.icon.getResPackage(), iconId); + icon.iconPackage = iconPkg; + icon.iconId = iconId; v.set(icon); v.updateDrawable(); return; @@ -152,4 +152,4 @@ public class DemoStatusIcons extends LinearLayout implements DemoMode { v.set(icon); addView(v, 0, new LinearLayout.LayoutParams(mIconSize, mIconSize)); } -} +}
\ No newline at end of file |