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

Commit de2d5f71 authored by Julia Tuttle's avatar Julia Tuttle Committed by Android (Google) Code Review
Browse files

Merge "BigPictureStyle: log when Icon.loadDrawable returns empty BitmapDrawable" into main

parents 89a40f08 8d018fce
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.Nullable;
import android.annotation.StyleRes;
import android.app.ActivityManager;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.net.Uri;
@@ -119,6 +120,17 @@ public class BigPictureNotificationImageView extends ImageView implements
        return () -> setImageDrawable(drawable);
    }

    @Override
    public void setImageDrawable(@Nullable Drawable drawable) {
        if (drawable instanceof BitmapDrawable bitmapDrawable) {
            if (bitmapDrawable.getBitmap() == null) {
                Log.e(TAG, "setting BitmapDrawable with null Bitmap (invalid image file?)");
            }
        }

        super.setImageDrawable(drawable);
    }

    private Drawable loadImage(Uri uri) {
        if (uri == null) return null;
        return LocalImageResolver.resolveImage(uri, mContext, mMaximumDrawableWidth,