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
This commit is contained in:
Phil Weaver
2018-03-08 17:38:46 -08:00
parent 5218829f68
commit 5a3e02dd38

View File

@@ -48,6 +48,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.graphics.drawable.VectorDrawable;
import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.FingerprintManager;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.LinkProperties; 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) { public static void setSafeIcon(Preference pref, Drawable icon) {
Drawable safeIcon = icon; Drawable safeIcon = icon;
if (icon != null) { if ((icon != null) && !(icon instanceof VectorDrawable)) {
safeIcon = getSafeDrawable(icon, 500, 500); safeIcon = getSafeDrawable(icon, 500, 500);
} }
pref.setIcon(safeIcon); pref.setIcon(safeIcon);