From 7441931462c5dd00edc6f4598e1e60b4f5e67fc4 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Tue, 10 Jun 2014 20:57:21 +0200 Subject: [PATCH] Do not override mColor with default color if none set Bug: 15163105 Change-Id: Ibb9507b24aeaae7a571d42eb411aff25449d48fe --- core/java/android/app/Notification.java | 19 +++++++++++-------- .../NotificationOverflowIconsView.java | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index a1cdf59ec2fbe..276f936605a61 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -23,7 +23,6 @@ import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; @@ -31,7 +30,6 @@ import android.media.AudioManager; import android.media.session.MediaSessionToken; import android.net.Uri; import android.os.BadParcelableException; -import android.os.Build; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; @@ -2568,7 +2566,7 @@ public class Notification implements Parcelable R.id.icon, true, -1, - mColor, + resolveColor(), PorterDuff.Mode.SRC_ATOP, -1); } @@ -2595,17 +2593,22 @@ public class Notification implements Parcelable R.id.right_icon, true, -1, - mColor, + resolveColor(), PorterDuff.Mode.SRC_ATOP, -1); } } + private int sanitizeColor() { + if (mColor != COLOR_DEFAULT) { + mColor |= 0xFF000000; // no alpha for custom colors + } + return mColor; + } + private int resolveColor() { if (mColor == COLOR_DEFAULT) { - mColor = mContext.getResources().getColor(R.color.notification_icon_bg_color); - } else { - mColor |= 0xFF000000; // no alpha for custom colors + return mContext.getResources().getColor(R.color.notification_icon_bg_color); } return mColor; } @@ -2621,7 +2624,7 @@ public class Notification implements Parcelable n.iconLevel = mSmallIconLevel; n.number = mNumber; - n.color = resolveColor(); + n.color = sanitizeColor(); n.contentView = makeContentView(); n.contentIntent = mContentIntent; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java index 6819d9b418d6e..ce5ab5af7f0e5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java @@ -65,7 +65,7 @@ public class NotificationOverflowIconsView extends IconMerger { } private void applyColor(Notification notification, StatusBarIconView view) { - if (notification.color != Notification.COLOR_DEFAULT) { + if (notification.color == Notification.COLOR_DEFAULT) { if (mNotificationColorUtil.isGrayscale(view.getDrawable())) { view.setColorFilter(mTintColor, PorterDuff.Mode.MULTIPLY); }