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

Commit 034eafa8 authored by Sunny Goyal's avatar Sunny Goyal Committed by android-build-merger
Browse files

Merge "Avoid crash when widget previews have no intrinsic size" am: f51b7064

am: d1689bfc

Change-Id: I7ed4604a24774f802a764e787122c3339befda5b
parents d377343d d1689bfc
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -338,7 +338,8 @@ public class WidgetPreviewLoader {
        int previewWidth;
        int previewHeight;

        if (widgetPreviewExists) {
        if (widgetPreviewExists && drawable.getIntrinsicWidth() > 0
                && drawable.getIntrinsicHeight() > 0) {
            previewWidth = drawable.getIntrinsicWidth();
            previewHeight = drawable.getIntrinsicHeight();
        } else {
@@ -358,8 +359,8 @@ public class WidgetPreviewLoader {
            scale = maxPreviewWidth / (float) (previewWidth);
        }
        if (scale != 1f) {
            previewWidth = (int) (scale * previewWidth);
            previewHeight = (int) (scale * previewHeight);
            previewWidth = Math.max((int)(scale * previewWidth), 1);
            previewHeight = Math.max((int)(scale * previewHeight), 1);
        }

        // If a bitmap is passed in, we use it; otherwise, we create a bitmap of the right size