[Android] Set mediasession token even in fallback state

Geoffrey Métais git at videolan.org
Fri Dec 23 16:38:30 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Dec 23 13:43:55 2016 +0100| [29c9b72f163d09bf000f0994a11616551f131703] | committer: Geoffrey Métais

Set mediasession token even in fallback state

> https://code.videolan.org/videolan/vlc-android/commit/29c9b72f163d09bf000f0994a11616551f131703
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 72cd04a..f9ccef3 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -1029,7 +1029,6 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         mMediaSession.setMediaButtonReceiver(mbrIntent);
         try {
             mMediaSession.setActive(true);
-            setSessionToken(mMediaSession.getSessionToken());
         } catch (NullPointerException e) {
             // Some versions of KitKat do not support AudioManager.registerMediaButtonIntent
             // with a PendingIntent. They will throw a NullPointerException, in which case
@@ -1039,6 +1038,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
             mMediaSession.setFlags(MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
             mMediaSession.setActive(true);
         }
+        setSessionToken(mMediaSession.getSessionToken());
     }
 
     private final class MediaSessionCallback extends MediaSessionCompat.Callback {



More information about the Android mailing list