Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e52f418d authored by Matthijs Tijink's avatar Matthijs Tijink Committed by Nicolas Fella

Properly close the media session when closing the media notification

BUG: 407812
parent 6a7fbecc
......@@ -383,7 +383,7 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
iCloseNotification.setAction(MprisMediaNotificationReceiver.ACTION_CLOSE_NOTIFICATION);
iCloseNotification.putExtra(MprisMediaNotificationReceiver.EXTRA_DEVICE_ID, notificationDevice);
iCloseNotification.putExtra(MprisMediaNotificationReceiver.EXTRA_MPRIS_PLAYER, notificationPlayer.getPlayer());
PendingIntent piCloseNotification = PendingIntent.getActivity(service, 0, iCloseNotification, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent piCloseNotification = PendingIntent.getBroadcast(service, 0, iCloseNotification, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setDeleteIntent(piCloseNotification);
}
......@@ -448,6 +448,9 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
//Clear the current player and media session
notificationPlayer = null;
if (mediaSession != null) {
mediaSession.setPlaybackState(new PlaybackStateCompat.Builder().build());
mediaSession.setMetadata(new MediaMetadataCompat.Builder().build());
mediaSession.setActive(false);
mediaSession.release();
mediaSession = null;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment