From 311420ffb28609f2cd437f0ff77efea2f56d38ed Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 17 Apr 2017 16:43:05 -0700 Subject: [PATCH] Fixing adaptive icon bounds caching Change-Id: Ifa0ed4d600fcd2c50558ea9ae6e95f3364d4949a --- src/com/android/launcher3/graphics/IconNormalizer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/graphics/IconNormalizer.java b/src/com/android/launcher3/graphics/IconNormalizer.java index 13f322e8bc..34d0b727c1 100644 --- a/src/com/android/launcher3/graphics/IconNormalizer.java +++ b/src/com/android/launcher3/graphics/IconNormalizer.java @@ -74,6 +74,8 @@ public class IconNormalizer { private final Paint mPaintMaskShapeOutline; private final byte[] mPixels; private final int[] mPixelsARGB; + + private final Rect mAdaptiveIconBounds; private float mAdaptiveIconScale; // for each y, stores the position of the leftmost x and the rightmost x @@ -99,6 +101,7 @@ public class IconNormalizer { mLeftBorder = new float[mMaxSize]; mRightBorder = new float[mMaxSize]; mBounds = new Rect(); + mAdaptiveIconBounds = new Rect(); // Needed for isShape() method mBitmapARGB = Bitmap.createBitmap(mMaxSize, mMaxSize, Bitmap.Config.ARGB_8888); @@ -231,7 +234,7 @@ public class IconNormalizer { if (Utilities.isAtLeastO() && d instanceof AdaptiveIconDrawable && mAdaptiveIconScale != SCALE_NOT_INITIALIZED) { if (outBounds != null) { - outBounds.set(mBounds); + outBounds.set(mAdaptiveIconBounds); } return mAdaptiveIconScale; } @@ -347,6 +350,7 @@ public class IconNormalizer { if (Utilities.isAtLeastO() && d instanceof AdaptiveIconDrawable && mAdaptiveIconScale == SCALE_NOT_INITIALIZED) { mAdaptiveIconScale = scale; + mAdaptiveIconBounds.set(mBounds); } return scale; }