diff options
| author | Jeff DeCew <jeffdq@google.com> | 2020-10-21 09:44:49 -0400 |
|---|---|---|
| committer | Jeff DeCew <jeffdq@google.com> | 2020-10-21 10:32:19 -0400 |
| commit | 858ad2ac335d6d971efcaba9ec692a12377778f7 (patch) | |
| tree | 304931612482227906ac0737a5b8785c5168a874 /core/java/android | |
| parent | 73e65d429144732c45cf1d48299960d6eec7e4a4 (diff) | |
Minimize use of header in adjusting notification colors.
Also adds support for 'inverted' icons.
Test: atest SystemUITests
Test: manual testing of numerous notification configurations
Change-Id: I6fd9aeec9f5971495d514add2bbb30b50db7d3c1
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/Notification.java | 23 | ||||
| -rw-r--r-- | core/java/android/view/NotificationHeaderView.java | 10 |
2 files changed, 7 insertions, 26 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index a54c65e873ec..5e50b96a23d5 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -82,7 +82,6 @@ import android.util.Pair; import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import android.view.Gravity; -import android.view.NotificationHeaderView; import android.view.View; import android.view.ViewGroup; import android.view.contentcapture.ContentCaptureContext; @@ -5862,24 +5861,16 @@ public class Notification implements Parcelable } /** - * Apply any necessariy colors to the small icon + * Apply any necessary colors to the small icon */ private void processSmallIconColor(Icon smallIcon, RemoteViews contentView, StandardTemplateParams p) { boolean colorable = !isLegacy() || getColorUtil().isGrayscaleIcon(mContext, smallIcon); - int color; - if (isColorized(p)) { - color = getPrimaryTextColor(p); - } else { - color = resolveContrastColor(p); - } - if (colorable) { - contentView.setDrawableTint(R.id.icon, false, color, - PorterDuff.Mode.SRC_ATOP); - - } + int color = isColorized(p) ? getPrimaryTextColor(p) : resolveContrastColor(p); + contentView.setInt(R.id.icon, "setBackgroundColor", + resolveBackgroundColor(p)); contentView.setInt(R.id.icon, "setOriginalIconColor", - colorable ? color : NotificationHeaderView.NO_COLOR); + colorable ? color : COLOR_INVALID); } /** @@ -5892,8 +5883,8 @@ public class Notification implements Parcelable if (largeIcon != null && isLegacy() && getColorUtil().isGrayscaleIcon(mContext, largeIcon)) { // resolve color will fall back to the default when legacy - contentView.setDrawableTint(R.id.icon, false, resolveContrastColor(p), - PorterDuff.Mode.SRC_ATOP); + int color = resolveContrastColor(p); + contentView.setInt(R.id.icon, "setOriginalIconColor", color); } } diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java index e28b6726611e..355b314a0b8f 100644 --- a/core/java/android/view/NotificationHeaderView.java +++ b/core/java/android/view/NotificationHeaderView.java @@ -17,7 +17,6 @@ package android.view; import android.annotation.Nullable; -import android.app.Notification; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.res.Resources; @@ -42,7 +41,6 @@ import java.util.ArrayList; */ @RemoteViews.RemoteView public class NotificationHeaderView extends ViewGroup { - public static final int NO_COLOR = Notification.COLOR_INVALID; private final int mChildMinWidth; private final int mContentEndMargin; private final int mGravity; @@ -294,14 +292,6 @@ public class NotificationHeaderView extends ViewGroup { updateTouchListener(); } - public int getOriginalIconColor() { - return mIcon.getOriginalIconColor(); - } - - public int getOriginalNotificationColor() { - return mExpandButton.getOriginalNotificationColor(); - } - public void setShowWorkBadgeAtEnd(boolean showWorkBadgeAtEnd) { if (showWorkBadgeAtEnd != mShowWorkBadgeAtEnd) { setClipToPadding(!showWorkBadgeAtEnd); |
