From 74cad9cfb49daa26e76dc00fe8ab8ac28cd199fe Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Sat, 9 Jan 2021 23:47:19 -0800 Subject: [PATCH] Fix missing background where multiple KeyButtonViews are rendered in the same window getLeft(), getRight(), getTop(), getBottom() return coords in the entire window, while drawOval asks for coords in the current view. This is not an issue where only one KeyButtonView is in the layout, but it is when there are more than one. Fixes: 177153730 Test: Manual test with ag/q/topic:"game-dashboard-entry-point" Change-Id: If781eb3cb98a3dfb6e51c431fec7f6ae909ef3a3 --- .../systemui/navigationbar/buttons/KeyButtonView.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/KeyButtonView.java index 4efe4d85156bc..f0e4cce299eef 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/KeyButtonView.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/buttons/KeyButtonView.java @@ -461,14 +461,8 @@ public class KeyButtonView extends ImageView implements ButtonInterface { @Override public void draw(Canvas canvas) { if (mHasOvalBg) { - canvas.save(); - int cx = (getLeft() + getRight()) / 2; - int cy = (getTop() + getBottom()) / 2; - canvas.translate(cx, cy); int d = Math.min(getWidth(), getHeight()); - int r = d / 2; - canvas.drawOval(-r, -r, r, r, mOvalBgPaint); - canvas.restore(); + canvas.drawOval(0, 0, d, d, mOvalBgPaint); } super.draw(canvas); }