From 4c80791919cd0da976ae5329dd7da9a0c4b3087c Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 23 Jun 2017 17:22:38 -0700 Subject: [PATCH] Fixed an issue in the contrast calculation The parameters were passed the wrong way around. Test: manual inspection Fixes: 62937149 Change-Id: I7ae2bb2a4136da37d6b59b2b1406c68ce7fe7b6b --- .../java/com/android/internal/util/NotificationColorUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/com/android/internal/util/NotificationColorUtil.java b/core/java/com/android/internal/util/NotificationColorUtil.java index 1ba92bfb6a773..0c046a92020bd 100644 --- a/core/java/com/android/internal/util/NotificationColorUtil.java +++ b/core/java/com/android/internal/util/NotificationColorUtil.java @@ -534,7 +534,7 @@ public class NotificationColorUtil { } public static boolean satisfiesTextContrast(int backgroundColor, int foregroundColor) { - return NotificationColorUtil.calculateContrast(backgroundColor, foregroundColor) >= 4.5; + return NotificationColorUtil.calculateContrast(foregroundColor, backgroundColor) >= 4.5; } /** @@ -613,7 +613,7 @@ public class NotificationColorUtil { */ public static double calculateContrast(@ColorInt int foreground, @ColorInt int background) { if (Color.alpha(background) != 255) { - throw new IllegalArgumentException("background can not be translucent: #" + Log.wtf(TAG, "background can not be translucent: #" + Integer.toHexString(background)); } if (Color.alpha(foreground) < 255) {