File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
app/src/main/java/org/schabi/newpipe/player Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -1212,10 +1212,21 @@ public Bitmap transform(final Bitmap source) {
12121212 / (source .getWidth () / notificationThumbnailWidth )),
12131213 true );
12141214
1215- if (result != source ) {
1215+ if (result == source ) {
1216+ // create a new mutable bitmap to prevent strange crashes on some
1217+ // devices (see #4638)
1218+ final Bitmap copied = Bitmap .createScaledBitmap (
1219+ source ,
1220+ (int ) notificationThumbnailWidth - 1 ,
1221+ (int ) (source .getHeight () / (source .getWidth ()
1222+ / (notificationThumbnailWidth - 1 ))),
1223+ true );
12161224 source .recycle ();
1225+ return copied ;
1226+ } else {
1227+ source .recycle ();
1228+ return result ;
12171229 }
1218- return result ;
12191230 }
12201231
12211232 @ Override
You can’t perform that action at this time.
0 commit comments