summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Julia Tuttle <juliatuttle@google.com> 2024-04-24 15:15:45 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-04-24 15:15:45 +0000
commit758ab35bda7d721f16ea90733a4fb859980a9b54 (patch)
tree0e4bdd10060abc71df9570d15d19785f789fa2d3
parent5b2c4984beed85cad932767f812bf1737f208433 (diff)
parent9c7d70efef2232fe7f6f984b60d9ed56e1a8f149 (diff)
Merge "ImageLoader: log when Icon.loadDrawable fails" into main
-rw-r--r--packages/SystemUI/src/com/android/systemui/graphics/ImageLoader.kt12
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/graphics/ImageLoader.kt b/packages/SystemUI/src/com/android/systemui/graphics/ImageLoader.kt
index 285601116d0b..567bf70be3e1 100644
--- a/packages/SystemUI/src/com/android/systemui/graphics/ImageLoader.kt
+++ b/packages/SystemUI/src/com/android/systemui/graphics/ImageLoader.kt
@@ -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.
*