mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 13:47:41 +00:00
Properly close the media session when closing the media notification
BUG: 407812
This commit is contained in:
committed by
Nicolas Fella
parent
6a7fbecc97
commit
e52f418dad
@@ -383,7 +383,7 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
|
|||||||
iCloseNotification.setAction(MprisMediaNotificationReceiver.ACTION_CLOSE_NOTIFICATION);
|
iCloseNotification.setAction(MprisMediaNotificationReceiver.ACTION_CLOSE_NOTIFICATION);
|
||||||
iCloseNotification.putExtra(MprisMediaNotificationReceiver.EXTRA_DEVICE_ID, notificationDevice);
|
iCloseNotification.putExtra(MprisMediaNotificationReceiver.EXTRA_DEVICE_ID, notificationDevice);
|
||||||
iCloseNotification.putExtra(MprisMediaNotificationReceiver.EXTRA_MPRIS_PLAYER, notificationPlayer.getPlayer());
|
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);
|
notification.setDeleteIntent(piCloseNotification);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,6 +448,9 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
|
|||||||
//Clear the current player and media session
|
//Clear the current player and media session
|
||||||
notificationPlayer = null;
|
notificationPlayer = null;
|
||||||
if (mediaSession != null) {
|
if (mediaSession != null) {
|
||||||
|
mediaSession.setPlaybackState(new PlaybackStateCompat.Builder().build());
|
||||||
|
mediaSession.setMetadata(new MediaMetadataCompat.Builder().build());
|
||||||
|
mediaSession.setActive(false);
|
||||||
mediaSession.release();
|
mediaSession.release();
|
||||||
mediaSession = null;
|
mediaSession = null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user