More conservative dark text calculation
Refactored WallpaperColors to use constrast ratio instead of luminance
for detecting dark pixels. Also using a contrast more conservative than
what GAR requires while decreasing the dark area threshold.
Change-Id: I67b799be4b7ccd50bb3e63c6179d513b9b76446b
Fixes: 76435920
Test: manually set various wallpapers
Test: use new debug flag to verify which pixel is actually dark
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
index 924aa01..cda9d04 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
@@ -27,7 +27,7 @@
import android.widget.Button;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.keyguard.KeyguardHostView.OnDismissAction;
import com.android.systemui.Dependency;
import com.android.systemui.R;
@@ -114,7 +114,7 @@
mRippleColor = mContext.getColor(R.color.notification_ripple_untinted_color);
mRippleColorDarkBg = Color.argb(Color.alpha(mRippleColor),
255 /* red */, 255 /* green */, 255 /* blue */);
- mMinStrokeContrast = NotificationColorUtil.calculateContrast(mDefaultStrokeColor,
+ mMinStrokeContrast = ContrastColorUtil.calculateContrast(mDefaultStrokeColor,
mDefaultBackgroundColor);
int spacing = 0;
@@ -574,12 +574,12 @@
}
mCurrentBackgroundColor = backgroundColor;
- final boolean dark = !NotificationColorUtil.isColorLight(backgroundColor);
+ final boolean dark = !ContrastColorUtil.isColorLight(backgroundColor);
- int textColor = NotificationColorUtil.ensureTextContrast(
+ int textColor = ContrastColorUtil.ensureTextContrast(
dark ? mDefaultTextColorDarkBg : mDefaultTextColor,
backgroundColor | 0xff000000, dark);
- int strokeColor = NotificationColorUtil.ensureContrast(
+ int strokeColor = ContrastColorUtil.ensureContrast(
mDefaultStrokeColor, backgroundColor | 0xff000000, dark, mMinStrokeContrast);
int rippleColor = dark ? mRippleColorDarkBg : mRippleColor;