Updated the color of the reply button to be more neutral
The primaryTextColor wasn't a good fit, because it was
drawing too much attention being pure black. We're now
taking the default color instead. It's also used for
active permissions now.
Test: add notification, look at reply button.
Change-Id: If390c66e927a92a1115250abb7254fafe81b054c
Fixes: 72750728
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index a69bd8d..6262bac 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -3142,10 +3142,14 @@
private int mCachedContrastColor = COLOR_INVALID;
private int mCachedContrastColorIsFor = COLOR_INVALID;
/**
- * Caches a ambient version of {@link #mCachedContrastColorIsFor}.
+ * Caches a ambient version of {@link #mCachedAmbientColorIsFor}.
*/
private int mCachedAmbientColor = COLOR_INVALID;
private int mCachedAmbientColorIsFor = COLOR_INVALID;
+ /**
+ * A neutral color color that can be used for icons.
+ */
+ private int mNeutralColor = COLOR_INVALID;
/**
* Caches an instance of StandardTemplateParams. Note that this may have been used before,
@@ -4581,7 +4585,7 @@
contentView.setViewVisibility(R.id.reply_icon_action, View.VISIBLE);
contentView.setDrawableTint(R.id.reply_icon_action,
false /* targetBackground */,
- getPrimaryTextColor(),
+ getNeutralColor(),
PorterDuff.Mode.SRC_ATOP);
contentView.setOnClickPendingIntent(R.id.reply_icon_action, action.actionIntent);
contentView.setRemoteInputs(R.id.reply_icon_action, action.mRemoteInputs);
@@ -4625,8 +4629,7 @@
}
private void bindActivePermissions(RemoteViews contentView, boolean ambient) {
- int color = ambient ? resolveAmbientColor()
- : isColorized() ? getPrimaryTextColor() : resolveContrastColor();
+ int color = ambient ? resolveAmbientColor() : getNeutralColor();
contentView.setDrawableTint(R.id.camera, false, color, PorterDuff.Mode.SRC_ATOP);
contentView.setDrawableTint(R.id.mic, false, color, PorterDuff.Mode.SRC_ATOP);
contentView.setDrawableTint(R.id.overlay, false, color, PorterDuff.Mode.SRC_ATOP);
@@ -5339,6 +5342,20 @@
return mCachedContrastColor = color;
}
+ int resolveNeutralColor() {
+ if (mNeutralColor != COLOR_INVALID) {
+ return mNeutralColor;
+ }
+ int background = mContext.getColor(
+ com.android.internal.R.color.notification_material_background_color);
+ mNeutralColor = NotificationColorUtil.resolveDefaultColor(mContext, background);
+ if (Color.alpha(mNeutralColor) < 255) {
+ // alpha doesn't go well for color filters, so let's blend it manually
+ mNeutralColor = NotificationColorUtil.compositeColors(mNeutralColor, background);
+ }
+ return mNeutralColor;
+ }
+
int resolveAmbientColor() {
if (mCachedAmbientColorIsFor == mN.color && mCachedAmbientColorIsFor != COLOR_INVALID) {
return mCachedAmbientColor;
@@ -5571,6 +5588,17 @@
}
/**
+ * Gets a neutral color that can be used for icons or similar that should not stand out.
+ */
+ private int getNeutralColor() {
+ if (isColorized()) {
+ return getSecondaryTextColor();
+ } else {
+ return resolveNeutralColor();
+ }
+ }
+
+ /**
* Same as getBackgroundColor but also resolved the default color to the background.
*/
private int resolveBackgroundColor() {