[Android] PlaybackService: Do not hide notification too soon

Geoffrey Métais git at videolan.org
Wed Mar 11 11:30:52 CET 2020


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 11 11:30:08 2020 +0100| [4655fa57a24eff4b2f9b1c4304e5af94ca6f9a0b] | committer: Geoffrey Métais

PlaybackService: Do not hide notification too soon

> https://code.videolan.org/videolan/vlc-android/commit/4655fa57a24eff4b2f9b1c4304e5af94ca6f9a0b
---

 vlc-android/src/org/videolan/vlc/PlaybackService.kt | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index d8102bc46..58ce9b0cb 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -161,14 +161,7 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
                 publishState()
                 audioFocusHelper.changeAudioFocus(true)
                 if (!wakeLock.isHeld) wakeLock.acquire()
-                if (!keyguardManager.isKeyguardLocked
-                        && !playlistManager.videoBackground
-                        && !hasRenderer()
-                        && playlistManager.switchToVideo()) {
-                    hideNotification(true)
-                } else {
-                    showNotification()
-                }
+                showNotification()
             }
             MediaPlayer.Event.Paused -> {
                 if (BuildConfig.DEBUG) Log.i(TAG, "MediaPlayer.Event.Paused")
@@ -568,14 +561,12 @@ class PlaybackService : MediaBrowserServiceCompat(), CoroutineScope, LifecycleOw
     private fun forceForeground() {
         val ctx = this at PlaybackService
         NotificationHelper.createNotificationChannels(ctx.applicationContext)
-        val stopped = playlistManager.player.playbackState == PlaybackStateCompat.STATE_STOPPED
-        val notification = if (this::notification.isInitialized && !stopped) notification
+        val notification = if (this::notification.isInitialized) notification
         else NotificationHelper.createPlaybackNotification(ctx, false,
                 ctx.resources.getString(R.string.loading), "", "", null,
                 false, true, mediaSession.sessionToken, sessionPendingIntent)
         startForeground(3, notification)
         isForeground = true
-        if (isVideoPlaying || Settings.showTvUi || stopped) hideNotification(true)
     }
 
     private fun sendStartSessionIdIntent() {



More information about the Android mailing list