mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 19:18:37 +00:00
Fix crash when rendering shortcut avatars on buggy old versions of Android.
This commit is contained in:
@@ -737,7 +737,11 @@ class ConversationRepository(
|
|||||||
class DrawableResult(private val drawable: Drawable) : ContactPhotoResult {
|
class DrawableResult(private val drawable: Drawable) : ContactPhotoResult {
|
||||||
override fun transformToFinalBitmap(): Single<Bitmap> {
|
override fun transformToFinalBitmap(): Single<Bitmap> {
|
||||||
return Single.create {
|
return Single.create {
|
||||||
val bitmap = DrawableUtil.wrapBitmapForShortcutInfo(drawable.toBitmap(SHORTCUT_ICON_SIZE, SHORTCUT_ICON_SIZE))
|
val bitmap = if (Build.VERSION.SDK_INT <= 25) {
|
||||||
|
DrawableUtil.wrapBitmapForShortcutInfo(DrawableUtil.toBitmap(drawable, SHORTCUT_ICON_SIZE, SHORTCUT_ICON_SIZE))
|
||||||
|
} else {
|
||||||
|
DrawableUtil.wrapBitmapForShortcutInfo(drawable.toBitmap(SHORTCUT_ICON_SIZE, SHORTCUT_ICON_SIZE))
|
||||||
|
}
|
||||||
it.setCancellable {
|
it.setCancellable {
|
||||||
bitmap.recycle()
|
bitmap.recycle()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user