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

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

Merge "ImageLoader: log when Icon.loadDrawable fails" into main

parents 5b2c4984 9c7d70ef
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ constructor(
                }
                // Fallback to non-ImageDecoder load if the attempt failed (e.g. the resource
                // is a Vector drawable which ImageDecoder doesn't support.)
                ?: icon.loadDrawable(context)
                ?: loadIconDrawable(icon, context)
            }
            Icon.TYPE_BITMAP -> {
                BitmapDrawable(context.resources, icon.bitmap)
@@ -357,7 +357,7 @@ constructor(
            }
            else -> {
                // We don't recognize this icon, just fallback.
                icon.loadDrawable(context)
                loadIconDrawable(icon, context)
            }
        }?.let { drawable ->
            // Icons carry tint which we need to propagate down to a Drawable.
@@ -366,6 +366,14 @@ constructor(
        }
    }

    @WorkerThread
    fun loadIconDrawable(icon: Icon, context: Context): Drawable? {
        icon.loadDrawable(context)?.let { return it }

        Log.w(TAG, "Failed to load drawable for $icon")
        return null
    }

    /**
     * Obtains the image size from the image header, without decoding the full image.
     *