From 8d6f3cc158e75a104304c62532c708c7efaeabc7 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Fri, 9 Jul 2021 13:21:20 -0400 Subject: [PATCH] Use SRC_ATOP instead of SRC_IN for blending the NotificationExpandButton Bug: 191969252 Bug: 193157438 Test: check for number of layers in the scene Change-Id: I65bd80c71b55582347da1559cf707e9d023b7f13 --- core/java/android/app/Notification.java | 9 +++++---- .../internal/widget/NotificationExpandButton.java | 7 ++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 6454d2027f58f..9d149cf340e29 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -5380,14 +5380,15 @@ public class Notification implements Parcelable private void bindExpandButton(RemoteViews contentView, StandardTemplateParams p) { // set default colors - int textColor = getPrimaryTextColor(p); - int pillColor = getColors(p).getProtectionColor(); + int bgColor = getBackgroundColor(p); + int pillColor = Colors.flattenAlpha(getColors(p).getProtectionColor(), bgColor); + int textColor = Colors.flattenAlpha(getPrimaryTextColor(p), pillColor); contentView.setInt(R.id.expand_button, "setDefaultTextColor", textColor); contentView.setInt(R.id.expand_button, "setDefaultPillColor", pillColor); // Use different highlighted colors for conversations' unread count if (p.mHighlightExpander) { - textColor = getBackgroundColor(p); - pillColor = getPrimaryAccentColor(p); + pillColor = Colors.flattenAlpha(getPrimaryAccentColor(p), bgColor); + textColor = Colors.flattenAlpha(bgColor, pillColor); } contentView.setInt(R.id.expand_button, "setHighlightTextColor", textColor); contentView.setInt(R.id.expand_button, "setHighlightPillColor", pillColor); diff --git a/core/java/com/android/internal/widget/NotificationExpandButton.java b/core/java/com/android/internal/widget/NotificationExpandButton.java index 1974b0c2e5fcb..07ee9b5d2ff16 100644 --- a/core/java/com/android/internal/widget/NotificationExpandButton.java +++ b/core/java/com/android/internal/widget/NotificationExpandButton.java @@ -20,7 +20,6 @@ import android.annotation.ColorInt; import android.annotation.Nullable; import android.content.Context; import android.content.res.ColorStateList; -import android.graphics.PorterDuff; import android.graphics.Rect; import android.util.AttributeSet; import android.view.RemotableViewMethod; @@ -159,8 +158,7 @@ public class NotificationExpandButton extends FrameLayout { if (mHighlightPillColor != 0) { mPillView.setBackgroundTintList(ColorStateList.valueOf(mHighlightPillColor)); } - mPillView.setBackgroundTintMode(PorterDuff.Mode.SRC_IN); - mIconView.setColorFilter(mHighlightTextColor, PorterDuff.Mode.SRC_IN); + mIconView.setColorFilter(mHighlightTextColor); if (mHighlightTextColor != 0) { mNumberView.setTextColor(mHighlightTextColor); } @@ -168,8 +166,7 @@ public class NotificationExpandButton extends FrameLayout { if (mDefaultPillColor != 0) { mPillView.setBackgroundTintList(ColorStateList.valueOf(mDefaultPillColor)); } - mPillView.setBackgroundTintMode(PorterDuff.Mode.SRC_IN); - mIconView.setColorFilter(mDefaultTextColor, PorterDuff.Mode.SRC_IN); + mIconView.setColorFilter(mDefaultTextColor); if (mDefaultTextColor != 0) { mNumberView.setTextColor(mDefaultTextColor); }