Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c554e14 authored by Adnan's avatar Adnan Committed by Gerrit Code Review
Browse files

IconPackHelper: Don't respect an icons original size if too large.

  - Otherwise, if an application isn't following app icon guidelines,
  it can create an OOM situation when creating the new icon based
  on the original resource's height and width.

Change-Id: I9430445da5e393cdbf76ed9ebd9698bf30df6a95
parent 8b48314c
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -497,9 +497,19 @@ public class IconPackHelper {
                }
                canvas.setDensity(bitmap.getDensity());

                // Respect the original size of an icon
                // If the original size of the icon isn't greater
                // than twice the size of recommended large icons
                // respect the original size of the icon
                // otherwise enormous icons can easily create
                // OOM situations.
                if ((bitmap.getWidth() < (iconSize * 2))
                        && (bitmap.getHeight() < (iconSize * 2))) {
                    width = bitmap.getWidth();
                    height = bitmap.getHeight();
                } else {
                    width = iconSize;
                    height = iconSize;
                }
            }

            if (width <= 0 || height <= 0) return null;