From b904a2e608e28f1d6d81b17af56639326521f077 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Mon, 22 Mar 2021 19:00:54 -0700 Subject: [PATCH] Change color of expand button on notif groups They should use the tertiary accent color. Fixes: 183454454 Test: visual Change-Id: Ieb1fdfb15a9b74c77880ae7bfad19549e23f9396 --- core/java/android/app/Notification.java | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 5dd10f10930bf..f81003e7e67a5 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -5354,8 +5354,7 @@ public class Notification implements Parcelable contentView.setInt(R.id.expand_button, "setDefaultPillColor", pillColor); // Use different highlighted colors except when low-priority mode prevents that if (!p.mReduceHighlights) { - textColor = getBackgroundColor(p); - pillColor = getAccentColor(p); + pillColor = getAccentTertiaryColor(p); } contentView.setInt(R.id.expand_button, "setHighlightTextColor", textColor); contentView.setInt(R.id.expand_button, "setHighlightPillColor", pillColor); @@ -6299,6 +6298,25 @@ public class Notification implements Parcelable return ColorUtils.blendARGB(getPrimaryTextColor(p), getBackgroundColor(p), 0.8f); } + /** + * Gets the tertiary accent color for colored UI elements. If we're tinting with the theme + * accent, this comes from the tertiary system accent palette, otherwise this would be + * identical to {@link #getSmallIconColor(StandardTemplateParams)}. + */ + private @ColorInt int getAccentTertiaryColor(StandardTemplateParams p) { + if (isColorized(p)) { + return getPrimaryTextColor(p); + } + if (mTintWithThemeAccent) { + int color = obtainThemeColor(com.android.internal.R.attr.colorAccentTertiary, + COLOR_INVALID); + if (color != COLOR_INVALID) { + return color; + } + } + return getContrastColor(p); + } + /** * Gets the theme's error color, or the primary text color for colorized notifications. */