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

Commit 6da8f91a authored by Beth Thibodeau's avatar Beth Thibodeau Committed by syphyr
Browse files

Limit maximum allowed size for a status bar icon

Bug: 169255797
Test: atest StatusBarIconViewTest
Test: verified that app crashes instead of SysUI following repro steps
Change-Id: I66e3bb873841b5babfd522c82cea7bed361fc14c
(cherry picked from commit 4394595d)
(cherry picked from commit 5791303c)
parent 07580f82
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -49,6 +49,9 @@ import java.util.ArrayList;
import cyanogenmod.providers.CMSettings;

public class StatusBarIconView extends AnimatedImageView {
    /** Maximum allowed width or height for an icon drawable */
    private static final int MAX_IMAGE_SIZE = 500;

    private static final String TAG = "StatusBarIconView";
    private boolean mAlwaysScaleIcon;

@@ -223,6 +226,13 @@ public class StatusBarIconView extends AnimatedImageView {
            Log.w(TAG, "No icon for slot " + mSlot + "; " + mIcon.icon);
            return false;
        }

        if (drawable.getIntrinsicWidth() > MAX_IMAGE_SIZE
                || drawable.getIntrinsicHeight() > MAX_IMAGE_SIZE) {
            Log.w(TAG, "Drawable is too large " + mIcon);
            return false;
        }

        if (withClear) {
            setImageDrawable(null);
        }