Fix notification contrast with transparent bg

Test: runtest -x packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconViewTest.java
Change-Id: I2f0595408be61acb8267bb7449486ee46f7aad19
Fixes: 62937149
This commit is contained in:
Lucas Dupin
2017-06-23 09:30:49 -07:00
parent 9f3967fee1
commit ddbaf84ac6
2 changed files with 7 additions and 1 deletions

View File

@@ -601,7 +601,8 @@ public class StatusBarIconView extends AnimatedImageView {
}
private void updateContrastedStaticColor() {
if (mCachedContrastBackgroundColor == NO_COLOR) {
if (Color.alpha(mCachedContrastBackgroundColor) != 255) {
mContrastedDrawableColor = mDrawableColor;
return;
}
// We'll modify the color if it doesn't pass GAR

View File

@@ -116,5 +116,10 @@ public class StatusBarIconViewTest extends SysuiTestCase {
color = mIconView.getContrastedStaticDrawableColor(Color.WHITE);
assertTrue("Similar colors should be shifted to satisfy contrast",
NotificationColorUtil.satisfiesTextContrast(Color.WHITE, color));
mIconView.setStaticDrawableColor(Color.GREEN);
color = mIconView.getContrastedStaticDrawableColor(0xcc000000);
assertEquals("Transparent backgrounds should fallback to drawable color",
color, mIconView.getStaticDrawableColor());
}
}