From 214e485373ed88d8fd74351023c49c2c922f91de Mon Sep 17 00:00:00 2001 From: Nader Jawad Date: Thu, 31 Oct 2019 11:09:18 -0700 Subject: [PATCH] Fixed issue where tint would be applied to solid region of GradientDrawable even if none was defined Fixed issue where solid black would be applied through modulated default alpha value if both solid and gradient colors were not applied to the gradient. Test: Added CTS test Bug: 142733137 Change-Id: Iecb7010f6d318cc962113528aac694b0de47d9dd --- graphics/java/android/graphics/drawable/GradientDrawable.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java index 96ac0f9b38b55..3f887f720e232 100644 --- a/graphics/java/android/graphics/drawable/GradientDrawable.java +++ b/graphics/java/android/graphics/drawable/GradientDrawable.java @@ -773,7 +773,9 @@ public class GradientDrawable extends Drawable { mFillPaint.setDither(st.mDither); mFillPaint.setColorFilter(colorFilter); if (colorFilter != null && st.mSolidColors == null) { - mFillPaint.setColor(mAlpha << 24); + // If we don't have a solid color and we don't have a gradient, + // the app is stroking the shape, set the color to transparent + mFillPaint.setColor(st.mGradientColors != null ? mAlpha << 24 : 0); } if (haveStroke) { mStrokePaint.setAlpha(currStrokeAlpha);