mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 05:37:43 +00:00
Properly close the media session when closing the media notification
BUG: 407812
This commit is contained in:
parent
6a7fbecc97
commit
e52f418dad
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user