2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 05:37:43 +00:00

Fix IllegalArgumentException crashes

This commit is contained in:
Albert Vaca 2019-11-21 21:36:41 +01:00
parent 733dd604ba
commit c3d02adaa4

View File

@ -430,9 +430,12 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
playbackActions |= PlaybackStateCompat.ACTION_SKIP_TO_NEXT; playbackActions |= PlaybackStateCompat.ACTION_SKIP_TO_NEXT;
++numActions; ++numActions;
} }
if (notificationPlayer.isSeekAllowed()) { // Documentation says that this was added in Lollipop (21) but we had crashes on Marshmallow (23)
playbackActions |= PlaybackStateCompat.ACTION_SEEK_TO; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
++numActions; if (notificationPlayer.isSeekAllowed()) {
playbackActions |= PlaybackStateCompat.ACTION_SEEK_TO;
++numActions;
}
} }
playbackState.setActions(playbackActions); playbackState.setActions(playbackActions);
mediaSession.setPlaybackState(playbackState.build()); mediaSession.setPlaybackState(playbackState.build());