From f9abe7bcbdca75ea5978e7489e39b8d7b88623a4 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Mon, 17 Aug 2020 22:14:28 -0700 Subject: [PATCH] Update rect in LiveTileOverlay via copying Probably a recent change updates the rect when reaching overview, which wasn't happening before. Regardless, we shouldn't have copied the rect by reference since the referenced copy can be changed. Fixes: 165143463 Test: manual Change-Id: I9315a20226f0a4b3440ce5ee6cc1f4ed1ddca487 --- .../android/quickstep/views/LiveTileOverlay.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/LiveTileOverlay.java b/quickstep/src/com/android/quickstep/views/LiveTileOverlay.java index 30c9f77aa8..c6c2d7e4f0 100644 --- a/quickstep/src/com/android/quickstep/views/LiveTileOverlay.java +++ b/quickstep/src/com/android/quickstep/views/LiveTileOverlay.java @@ -40,14 +40,13 @@ public class LiveTileOverlay extends Drawable { public static final LiveTileOverlay INSTANCE = new LiveTileOverlay(); private final Paint mPaint = new Paint(); + private final RectF mCurrentRect = new RectF(); private final Rect mBoundsRect = new Rect(); - private RectF mCurrentRect; private float mCornerRadius; private Drawable mIcon; private Animator mIconAnimator; - private boolean mDrawEnabled = true; private float mIconAnimationProgress = 0f; private boolean mIsAttached; @@ -58,7 +57,7 @@ public class LiveTileOverlay extends Drawable { public void update(RectF currentRect, float cornerRadius) { invalidateSelf(); - mCurrentRect = currentRect; + mCurrentRect.set(currentRect); mCornerRadius = cornerRadius; mCurrentRect.roundOut(mBoundsRect); @@ -93,16 +92,9 @@ public class LiveTileOverlay extends Drawable { return mIconAnimationProgress; } - public void setDrawEnabled(boolean drawEnabled) { - if (mDrawEnabled != drawEnabled) { - mDrawEnabled = drawEnabled; - invalidateSelf(); - } - } - @Override public void draw(Canvas canvas) { - if (mCurrentRect != null && mDrawEnabled) { + if (mCurrentRect != null) { canvas.drawRoundRect(mCurrentRect, mCornerRadius, mCornerRadius, mPaint); if (mIcon != null && mIconAnimationProgress > 0f) { canvas.save();