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

View file

@ -1243,11 +1243,22 @@ 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;
}
}
@Override
public String key() {