diff options
| -rw-r--r-- | core/java/android/app/Notification.java | 21 | ||||
| -rw-r--r-- | core/res/res/values/colors.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 2 |
3 files changed, 12 insertions, 13 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index f7300aa1561b..e1dc8bf7e499 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -32,6 +32,7 @@ import android.media.AudioManager; import android.media.session.MediaSession; import android.net.Uri; import android.os.BadParcelableException; +import android.os.Build; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; @@ -1904,7 +1905,8 @@ public class Notification implements Parcelable mPriority = PRIORITY_DEFAULT; mPeople = new ArrayList<String>(); - mColorUtil = NotificationColorUtil.getInstance(); + mColorUtil = context.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.L ? + NotificationColorUtil.getInstance() : null; } /** @@ -2610,7 +2612,7 @@ public class Notification implements Parcelable if (mLargeIcon != null) { contentView.setImageViewBitmap(R.id.icon, mLargeIcon); - processLargeIcon(mLargeIcon, contentView); + processLargeLegacyIcon(mLargeIcon, contentView); contentView.setImageViewResource(R.id.right_icon, mSmallIcon); contentView.setViewVisibility(R.id.right_icon, View.VISIBLE); processSmallRightIcon(mSmallIcon, contentView); @@ -2813,13 +2815,10 @@ public class Notification implements Parcelable } private void processLegacyAction(Action action, RemoteViews button) { - if (isLegacy()) { - if (mColorUtil.isGrayscale(mContext, action.icon)) { - button.setTextViewCompoundDrawablesRelativeColorFilter(R.id.action0, 0, - mContext.getResources().getColor( - R.color.notification_action_legacy_color_filter), - PorterDuff.Mode.MULTIPLY); - } + if (!isLegacy() || mColorUtil.isGrayscale(mContext, action.icon)) { + button.setTextViewCompoundDrawablesRelativeColorFilter(R.id.action0, 0, + mContext.getResources().getColor(R.color.notification_action_color_filter), + PorterDuff.Mode.MULTIPLY); } } @@ -2845,8 +2844,8 @@ public class Notification implements Parcelable * if it's grayscale). */ // TODO: also check bounds, transparency, that sort of thing. - private void processLargeIcon(Bitmap largeIcon, RemoteViews contentView) { - if (!isLegacy() || mColorUtil.isGrayscale(largeIcon)) { + private void processLargeLegacyIcon(Bitmap largeIcon, RemoteViews contentView) { + if (isLegacy() && mColorUtil.isGrayscale(largeIcon)) { applyLargeIconBackground(contentView); } else { removeLargeIconBackground(contentView); diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index 036046041aa6..4470fc3beb08 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -130,7 +130,7 @@ <drawable name="notification_template_divider">#29000000</drawable> <color name="notification_icon_bg_color">#ff9e9e9e</color> - <color name="notification_action_legacy_color_filter">#ff555555</color> + <color name="notification_action_color_filter">@color/secondary_text_material_light</color> <color name="notification_media_action_bg">#00000000</color> <color name="notification_media_progress">#FFFFFFFF</color> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 11d712ef906a..1d58223f2488 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1718,7 +1718,7 @@ <java-symbol type="layout" name="notification_template_material_big_text" /> <java-symbol type="layout" name="notification_template_icon_group" /> <java-symbol type="layout" name="notification_material_media_action" /> - <java-symbol type="color" name="notification_action_legacy_color_filter" /> + <java-symbol type="color" name="notification_action_color_filter" /> <java-symbol type="color" name="notification_icon_bg_color" /> <java-symbol type="drawable" name="notification_icon_legacy_bg" /> <java-symbol type="drawable" name="notification_material_media_progress" /> |