Fix thumbnail not being displayed in media notification

This commit is contained in:
Isira Seneviratne 2024-07-03 14:41:32 +05:30
parent c4ada7ff6e
commit 348a79f91d

View File

@ -67,16 +67,13 @@ object CoilHelper {
var newHeight = input.height / (input.width / notificationThumbnailWidth) var newHeight = input.height / (input.width / notificationThumbnailWidth)
val result = input.scale(notificationThumbnailWidth, newHeight) val result = input.scale(notificationThumbnailWidth, newHeight)
if (result == input || !result.isMutable) { return if (result == input || !result.isMutable) {
// create a new mutable bitmap to prevent strange crashes on some // create a new mutable bitmap to prevent strange crashes on some
// devices (see #4638) // devices (see #4638)
newHeight = input.height / (input.width / (notificationThumbnailWidth - 1)) newHeight = input.height / (input.width / (notificationThumbnailWidth - 1))
val copied = input.scale(notificationThumbnailWidth, newHeight) input.scale(notificationThumbnailWidth, newHeight)
input.recycle()
return copied
} else { } else {
input.recycle() result
return result
} }
} }
}) })