Catch out of memory exception

This commit is contained in:
Martin Fietz 2016-12-04 13:29:36 +01:00
parent 3aac3f1fc2
commit ea6cfad6c8
1 changed files with 7 additions and 1 deletions

View File

@ -1101,7 +1101,13 @@ public class PlaybackService extends MediaBrowserServiceCompat {
mediaSession.setSessionActivity(PendingIntent.getActivity(this, 0, mediaSession.setSessionActivity(PendingIntent.getActivity(this, 0,
PlaybackService.getPlayerActivityIntent(this), PlaybackService.getPlayerActivityIntent(this),
PendingIntent.FLAG_UPDATE_CURRENT)); PendingIntent.FLAG_UPDATE_CURRENT));
try {
mediaSession.setMetadata(builder.build()); mediaSession.setMetadata(builder.build());
} catch (OutOfMemoryError e) {
Log.e(TAG, "Setting media session metadata", e);
builder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, null);
mediaSession.setMetadata(builder.build());
}
} }
}; };