Always create new bitmap when resizing thumbnail

This prevents strange crashes on some devices, fixes #4638
This commit is contained in:
Stypox 2021-03-28 23:05:31 +02:00
parent 52189fc5df
commit e229e5355d
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 13 additions and 2 deletions

View File

@ -1243,10 +1243,21 @@ public final class Player implements
/ (source.getWidth() / notificationThumbnailWidth)),
true);
if (result != source) {
if (result == source) {
// create a new mutable bitmap to prevent strange crashes on some
// devices (see #4638)
final Bitmap copied = Bitmap.createScaledBitmap(
source,
(int) notificationThumbnailWidth - 1,
(int) (source.getHeight() / (source.getWidth()
/ (notificationThumbnailWidth - 1))),
true);
source.recycle();
return copied;
} else {
source.recycle();
return result;
}
return result;
}
@Override