diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 5d21be50d4a90..d3c1e99f1523c 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -3118,7 +3118,6 @@ public class Notification implements Parcelable
private int mActionBarColor = COLOR_INVALID;
private int mBackgroundColor = COLOR_INVALID;
private int mForegroundColor = COLOR_INVALID;
- private int mBackgroundColorHint = COLOR_INVALID;
/**
* A temporary location where actions are stored. If != null the view originally has action
* but doesn't have any for this inflation.
@@ -4387,8 +4386,7 @@ public class Notification implements Parcelable
backgroundColor);
mSecondaryTextColor = NotificationColorUtil.resolveSecondaryColor(mContext,
backgroundColor);
- if (backgroundColor != COLOR_DEFAULT
- && (mBackgroundColorHint != COLOR_INVALID || isColorized())) {
+ if (backgroundColor != COLOR_DEFAULT && isColorized()) {
mPrimaryTextColor = NotificationColorUtil.findAlphaToMeetContrast(
mPrimaryTextColor, backgroundColor, 4.5);
mSecondaryTextColor = NotificationColorUtil.findAlphaToMeetContrast(
@@ -4595,21 +4593,13 @@ public class Notification implements Parcelable
}
private void bindExpandButton(RemoteViews contentView) {
- int color = getPrimaryHighlightColor();
+ int color = isColorized() ? getPrimaryTextColor() : getSecondaryTextColor();
contentView.setDrawableTint(R.id.expand_button, false, color,
PorterDuff.Mode.SRC_ATOP);
contentView.setInt(R.id.notification_header, "setOriginalNotificationColor",
color);
}
- /**
- * @return the color that is used as the first primary highlight color. This is applied
- * in several places like the action buttons or the app name in the header.
- */
- private int getPrimaryHighlightColor() {
- return isColorized() ? getPrimaryTextColor() : resolveContrastColor();
- }
-
private void bindHeaderChronometerAndTime(RemoteViews contentView) {
if (showsTimeOrChronometer()) {
contentView.setViewVisibility(R.id.time_divider, View.VISIBLE);
@@ -4706,7 +4696,7 @@ public class Notification implements Parcelable
setTextViewColorPrimary(contentView, R.id.app_name_text);
} else {
contentView.setTextColor(R.id.app_name_text,
- ambient ? resolveAmbientColor() : resolveContrastColor());
+ ambient ? resolveAmbientColor() : getSecondaryTextColor());
}
}
@@ -5234,7 +5224,14 @@ public class Notification implements Parcelable
private void processSmallIconColor(Icon smallIcon, RemoteViews contentView,
boolean ambient) {
boolean colorable = !isLegacy() || getColorUtil().isGrayscaleIcon(mContext, smallIcon);
- int color = ambient ? resolveAmbientColor() : getPrimaryHighlightColor();
+ int color;
+ if (ambient) {
+ color = resolveAmbientColor();
+ } else if (isColorized()) {
+ color = getPrimaryTextColor();
+ } else {
+ color = resolveContrastColor();
+ }
if (colorable) {
contentView.setDrawableTint(R.id.icon, false, color,
PorterDuff.Mode.SRC_ATOP);
@@ -5270,14 +5267,11 @@ public class Notification implements Parcelable
}
int color;
- int background = mBackgroundColorHint;
- if (mBackgroundColorHint == COLOR_INVALID) {
- background = mContext.getColor(
- com.android.internal.R.color.notification_material_background_color);
- }
+ int background = mContext.getColor(
+ com.android.internal.R.color.notification_material_background_color);
if (mN.color == COLOR_DEFAULT) {
ensureColors();
- color = mSecondaryTextColor;
+ color = NotificationColorUtil.resolveDefaultColor(mContext, background);
} else {
color = NotificationColorUtil.resolveContrastColor(mContext, mN.color,
background, mInNightMode);
@@ -5517,8 +5511,7 @@ public class Notification implements Parcelable
if (isColorized()) {
return mBackgroundColor != COLOR_INVALID ? mBackgroundColor : mN.color;
} else {
- return mBackgroundColorHint != COLOR_INVALID ? mBackgroundColorHint
- : COLOR_DEFAULT;
+ return COLOR_DEFAULT;
}
}
@@ -5554,18 +5547,6 @@ public class Notification implements Parcelable
ensureColors();
}
- /**
- * Sets the background color for this notification to be a different one then the default.
- * This is mainly used to calculate contrast and won't necessarily be applied to the
- * background.
- *
- * @hide
- */
- public void setBackgroundColorHint(int backgroundColor) {
- mBackgroundColorHint = backgroundColor;
- }
-
-
/**
* Forces all styled remoteViews to be built from scratch and not use any cached
* RemoteViews.
@@ -5972,7 +5953,7 @@ public class Notification implements Parcelable
* @hide
*/
public abstract boolean areNotificationsVisiblyDifferent(Style other);
-
+
/**
* @return the the text that should be displayed in the statusBar when heads-upped.
* If {@code null} is returned, the default implementation will be used.
@@ -7498,8 +7479,7 @@ public class Notification implements Parcelable
}
final Action action = mBuilder.mActions.get(mActionsToShowInCompact[i]);
- final RemoteViews button = generateMediaActionButton(action,
- getPrimaryHighlightColor());
+ final RemoteViews button = generateMediaActionButton(action, getActionColor());
view.addView(com.android.internal.R.id.media_actions, button);
}
}
@@ -7513,8 +7493,9 @@ public class Notification implements Parcelable
return view;
}
- private int getPrimaryHighlightColor() {
- return mBuilder.getPrimaryHighlightColor();
+ private int getActionColor() {
+ return mBuilder.isColorized() ? mBuilder.getPrimaryTextColor()
+ : mBuilder.resolveContrastColor();
}
private RemoteViews makeMediaBigContentView() {
@@ -7534,7 +7515,7 @@ public class Notification implements Parcelable
big.removeAllViews(com.android.internal.R.id.media_actions);
for (int i = 0; i < actionCount; i++) {
final RemoteViews button = generateMediaActionButton(mBuilder.mActions.get(i),
- getPrimaryHighlightColor());
+ getActionColor());
big.addView(com.android.internal.R.id.media_actions, button);
}
}
diff --git a/core/java/com/android/internal/util/NotificationColorUtil.java b/core/java/com/android/internal/util/NotificationColorUtil.java
index 933cc7af975a6..577fa1758f5e9 100644
--- a/core/java/com/android/internal/util/NotificationColorUtil.java
+++ b/core/java/com/android/internal/util/NotificationColorUtil.java
@@ -443,7 +443,7 @@ public class NotificationColorUtil {
*/
public static int resolveColor(Context context, int color) {
if (color == Notification.COLOR_DEFAULT) {
- return context.getColor(com.android.internal.R.color.notification_icon_default_color);
+ return context.getColor(com.android.internal.R.color.notification_default_color_light);
}
return color;
}
@@ -475,20 +475,15 @@ public class NotificationColorUtil {
int backgroundColor, boolean isDark) {
final int resolvedColor = resolveColor(context, notificationColor);
- final int actionBg = context.getColor(
- com.android.internal.R.color.notification_action_list);
-
int color = resolvedColor;
- color = NotificationColorUtil.ensureLargeTextContrast(color, actionBg, isDark);
color = NotificationColorUtil.ensureTextContrast(color, backgroundColor, isDark);
if (color != resolvedColor) {
if (DEBUG){
Log.w(TAG, String.format(
- "Enhanced contrast of notification for %s %s (over action)"
+ "Enhanced contrast of notification for %s"
+ " and %s (over background) by changing #%s to %s",
context.getPackageName(),
- NotificationColorUtil.contrastChange(resolvedColor, color, actionBg),
NotificationColorUtil.contrastChange(resolvedColor, color, backgroundColor),
Integer.toHexString(resolvedColor), Integer.toHexString(color)));
}
@@ -552,6 +547,17 @@ public class NotificationColorUtil {
}
}
+ public static int resolveDefaultColor(Context context, int backgroundColor) {
+ boolean useDark = shouldUseDark(backgroundColor);
+ if (useDark) {
+ return context.getColor(
+ com.android.internal.R.color.notification_default_color_light);
+ } else {
+ return context.getColor(
+ com.android.internal.R.color.notification_default_color_dark);
+ }
+ }
+
public static int resolveActionBarColor(Context context, int backgroundColor) {
if (backgroundColor == Notification.COLOR_DEFAULT) {
return context.getColor(com.android.internal.R.color.notification_action_list);
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 722102e99aa26..449d3e7beca1d 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -130,13 +130,14 @@
#29ffffff
@color/primary_text_default_material_light
@color/primary_text_default_material_dark
- @color/secondary_text_material_light
- @color/secondary_text_material_dark
+ @color/primary_text_default_material_light
+ @color/primary_text_default_material_dark
+ @color/primary_text_default_material_light
+ #a3202124
#ffffffff
#757575
- @color/notification_default_color
@color/secondary_text_material_light
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index fa3cf2f48dae0..b8a046f79371c 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -473,7 +473,7 @@ please see styles_device_defaults.xml.
@@ -482,7 +482,6 @@ please see styles_device_defaults.xml.
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 9d65a60b76d33..a7e97cb53042c 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2117,7 +2117,6 @@
-
@@ -2967,6 +2966,8 @@
+
+
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 5b038b1b42ff0..906ca4a536caa 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -79,9 +79,6 @@
#ff333333
-
- #fff5f5f5
-
#FF616161
@@ -91,9 +88,6 @@
#28000000
-
- #30000000
-
#30ffffff
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
index 8c28af511496b..8b6b5fe5d5424 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
@@ -99,7 +99,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
private static final Interpolator ACTIVATE_INVERSE_ALPHA_INTERPOLATOR
= new PathInterpolator(0, 0, 0.5f, 1);
private final int mTintedRippleColor;
- private final int mLowPriorityRippleColor;
protected final int mNormalRippleColor;
private final AccessibilityManager mAccessibilityManager;
private final DoubleTapHelper mDoubleTapHelper;
@@ -134,7 +133,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
private float mAppearAnimationFraction = -1.0f;
private float mAppearAnimationTranslation;
private final int mNormalColor;
- private final int mLowPriorityColor;
private boolean mIsBelowSpeedBump;
private FalsingManager mFalsingManager;
@@ -191,12 +189,8 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
setClipChildren(false);
setClipToPadding(false);
mNormalColor = context.getColor(R.color.notification_material_background_color);
- mLowPriorityColor = context.getColor(
- R.color.notification_material_background_low_priority_color);
mTintedRippleColor = context.getColor(
R.color.notification_ripple_tinted_color);
- mLowPriorityRippleColor = context.getColor(
- R.color.notification_ripple_color_low_priority);
mNormalRippleColor = context.getColor(
R.color.notification_ripple_untinted_color);
mFalsingManager = FalsingManager.getInstance(context);
@@ -997,8 +991,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
}
if (withTint && mBgTint != NO_COLOR) {
return mBgTint;
- } else if (mIsBelowSpeedBump) {
- return mLowPriorityColor;
} else {
return mNormalColor;
}
@@ -1007,8 +999,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
protected int getRippleColor() {
if (mBgTint != 0) {
return mTintedRippleColor;
- } else if (mIsBelowSpeedBump) {
- return mLowPriorityRippleColor;
} else {
return mNormalRippleColor;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java
index 112707552e6e1..886d6f17fedb9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationHeaderUtil.java
@@ -75,7 +75,7 @@ public class NotificationHeaderUtil {
if (shouldApply) {
// lets gray it out
int grey = view.getContext().getColor(
- com.android.internal.R.color.notification_icon_default_color);
+ com.android.internal.R.color.notification_default_color_light);
imageView.getDrawable().setColorFilter(grey, PorterDuff.Mode.SRC_ATOP);
} else {
// lets reset it
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index 5bb85e231f26d..603902a4507d3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -165,7 +165,7 @@ public class StatusBarIconView extends AnimatedImageView {
mDensity = context.getResources().getDisplayMetrics().densityDpi;
if (mNotification != null) {
setDecorColor(getContext().getColor(
- com.android.internal.R.color.notification_icon_default_color));
+ com.android.internal.R.color.notification_default_color_light));
}
reloadDimens();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/MediaNotificationProcessor.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/MediaNotificationProcessor.java
index 80854ec42c438..2b7949b1de544 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/MediaNotificationProcessor.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/MediaNotificationProcessor.java
@@ -76,7 +76,6 @@ public class MediaNotificationProcessor {
* notification.
*/
private final Context mPackageContext;
- private boolean mIsLowPriority;
public MediaNotificationProcessor(Context context, Context packageContext) {
this(context, packageContext, new ImageGradientColorizer());
@@ -146,10 +145,7 @@ public class MediaNotificationProcessor {
int foregroundColor = selectForegroundColor(backgroundColor, palette);
builder.setColorPalette(backgroundColor, foregroundColor);
} else {
- int id = mIsLowPriority
- ? R.color.notification_material_background_low_priority_color
- : R.color.notification_material_background_color;
- backgroundColor = mContext.getColor(id);
+ backgroundColor = mContext.getColor(R.color.notification_material_background_color);
}
Bitmap colorized = mColorizer.colorize(drawable, backgroundColor,
mContext.getResources().getConfiguration().getLayoutDirection() ==
@@ -307,8 +303,4 @@ public class MediaNotificationProcessor {
private boolean isWhite(float[] hslColor) {
return hslColor[2] >= WHITE_MIN_LIGHTNESS;
}
-
- public void setIsLowPriority(boolean isLowPriority) {
- mIsLowPriority = isLowPriority;
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java
index 251e04b01afec..78df77fe6499a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java
@@ -122,9 +122,9 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
mHeaderText = mView.findViewById(com.android.internal.R.id.header_text);
mExpandButton = mView.findViewById(com.android.internal.R.id.expand_button);
mWorkProfileImage = mView.findViewById(com.android.internal.R.id.profile_badge);
- mColor = resolveColor(mExpandButton);
mNotificationHeader = mView.findViewById(com.android.internal.R.id.notification_header);
mNotificationHeader.setShowExpandButtonAtEnd(mShowExpandButtonAtEnd);
+ mColor = mNotificationHeader.getOriginalIconColor();
getDozer().setColor(mColor);
}
@@ -132,16 +132,6 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
mNotificationHeader.setAppOpsOnClickListener(row.getAppOpsOnClickListener());
}
- private int resolveColor(ImageView icon) {
- if (icon != null && icon.getDrawable() != null) {
- ColorFilter filter = icon.getDrawable().getColorFilter();
- if (filter instanceof PorterDuffColorFilter) {
- return ((PorterDuffColorFilter) filter).getColor();
- }
- }
- return 0;
- }
-
@Override
public void onContentUpdated(ExpandableNotificationRow row) {
super.onContentUpdated(row);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInflater.java
index f5110a2dbc2d5..0143d0105979f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInflater.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationInflater.java
@@ -584,15 +584,9 @@ public class NotificationInflater {
mSbn.getNotification());
Context packageContext = mSbn.getPackageContext(mContext);
Notification notification = mSbn.getNotification();
- if (mIsLowPriority) {
- int backgroundColor = mContext.getColor(
- R.color.notification_material_background_low_priority_color);
- recoveredBuilder.setBackgroundColorHint(backgroundColor);
- }
if (notification.isMediaNotification()) {
MediaNotificationProcessor processor = new MediaNotificationProcessor(mContext,
packageContext);
- processor.setIsLowPriority(mIsLowPriority);
processor.processNotification(notification, recoveredBuilder);
}
return createRemoteViews(mReInflateFlags,