summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff DeCew <jeffdq@google.com> 2021-08-17 18:59:51 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-08-17 18:59:51 +0000
commit0c43fe4e92b69aaa9a42b404e00bbb9e473300fa (patch)
tree944adb1f84d88b366e934ecb0c4e7547519953da
parentb8769ea47e54f9f22d6cf070da3669ae51d18e22 (diff)
parent2bd5f502fd3a94ca40572edc21f8d752b90d6f57 (diff)
Merge "Make foreground color selection in SmartReplyView and RemoteInputView match Notification." into sc-qpr1-dev
-rw-r--r--core/java/android/app/Notification.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java2
3 files changed, 4 insertions, 4 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 8ac8e5e2224e..e39636dc45fb 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -6247,8 +6247,9 @@ public class Notification implements Parcelable
*
* @param color the color to check
* @return true if the color has higher contrast with white than black
+ * @hide
*/
- private static boolean isColorDark(int color) {
+ public static boolean isColorDark(int color) {
// as per ContrastColorUtil.shouldUseDark, this uses the color contrast midpoint.
return ContrastColorUtil.calculateLuminance(color) <= 0.17912878474;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
index 84d7c05ddc14..5d7d4809dd57 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
@@ -77,7 +77,6 @@ import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.nano.MetricsProto;
-import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
@@ -204,7 +203,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
final int stroke = colorized ? mContext.getResources().getDimensionPixelSize(
R.dimen.remote_input_view_text_stroke) : 0;
if (colorized) {
- final boolean dark = !ContrastColorUtil.isColorLight(backgroundColor);
+ final boolean dark = Notification.Builder.isColorDark(backgroundColor);
final int foregroundColor = dark ? Color.WHITE : Color.BLACK;
final int inverseColor = dark ? Color.BLACK : Color.WHITE;
editBgColor = backgroundColor;
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 41b1dd12639a..4e33529f3c36 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
@@ -628,7 +628,7 @@ public class SmartReplyView extends ViewGroup {
mCurrentBackgroundColor = backgroundColor;
mCurrentColorized = colorized;
- final boolean dark = !ContrastColorUtil.isColorLight(backgroundColor);
+ final boolean dark = Notification.Builder.isColorDark(backgroundColor);
mCurrentTextColor = ContrastColorUtil.ensureTextContrast(
dark ? mDefaultTextColorDarkBg : mDefaultTextColor,