From 5a3e02dd38f07c8e7e3c7136ed0b4f17b87f7fd9 Mon Sep 17 00:00:00 2001 From: Phil Weaver Date: Thu, 8 Mar 2018 17:38:46 -0800 Subject: [PATCH] Don't pre-scale vector drawables in settings The idea of scaling down icons to prevent the system from dealing with large images seems to be catching some VectorDrawables and rescaling them. I don't think VectorDrawables are likely to create a memory issue, and the protection code seemed to be added to protect against large pngs, not vector graphics. Bug: 70562945 Test: Visually verified that all icons in the Accessibility Shortcut list are now the same size with maximum display and font sizes. Change-Id: I9f177d11a614c122d333d4625bf6fa756d1bf4af --- src/com/android/settings/Utils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java index 2a5582971c1..1091aea755f 100644 --- a/src/com/android/settings/Utils.java +++ b/src/com/android/settings/Utils.java @@ -48,6 +48,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.graphics.drawable.VectorDrawable; import android.hardware.fingerprint.FingerprintManager; import android.net.ConnectivityManager; import android.net.LinkProperties; @@ -929,7 +930,7 @@ public final class Utils extends com.android.settingslib.Utils { */ public static void setSafeIcon(Preference pref, Drawable icon) { Drawable safeIcon = icon; - if (icon != null) { + if ((icon != null) && !(icon instanceof VectorDrawable)) { safeIcon = getSafeDrawable(icon, 500, 500); } pref.setIcon(safeIcon);