Fixing getSafeZone() method in AdaptiveIcon

Bug: 240335326
Test: atest FrameworksCoreTests:android.graphics.drawable.IconTest#testWithAdaptiveBitmap -- --abi x86_64
Change-Id: I1204bd759a347a9635dfb48e71ff65cef1f75f9d
This commit is contained in:
Sunny Goyal
2022-08-03 23:17:06 +00:00
parent a745ebf39c
commit 63985967cb

View File

@@ -359,10 +359,10 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback
/** @hide */
@TestApi
public Region getSafeZone() {
mMaskMatrix.reset();
Path mask = getIconMask();
mMaskMatrix.setScale(SAFEZONE_SCALE, SAFEZONE_SCALE, getBounds().centerX(), getBounds().centerY());
Path p = new Path();
mMask.transform(mMaskMatrix, p);
mask.transform(mMaskMatrix, p);
Region safezoneRegion = new Region(getBounds());
safezoneRegion.setPath(p, safezoneRegion);
return safezoneRegion;