[Android] Preserve notification on lock screen

Geoffrey Métais git at videolan.org
Tue Jun 28 11:38:18 CEST 2016


vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jun 28 11:16:20 2016 +0200| [ccd36a0c387511a9398ec3c57bd20cd258a85ad6] | committer: Geoffrey Métais

Preserve notification on lock screen

(cherry picked from commit 737b7314844391b781dd60076683d1d3926cc838)

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 1d77773..5993a90 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -21,6 +21,7 @@
 package org.videolan.vlc;
 
 import android.annotation.TargetApi;
+import android.app.KeyguardManager;
 import android.app.Notification;
 import android.app.PendingIntent;
 import android.app.Service;
@@ -590,6 +591,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
     }
 
     private final MediaPlayer.EventListener mMediaPlayerListener = new MediaPlayer.EventListener() {
+        KeyguardManager keyguardManager = (KeyguardManager) VLCApplication.getAppContext().getSystemService(Context.KEYGUARD_SERVICE);
 
         @Override
         public void onEvent(MediaPlayer.Event event) {
@@ -625,7 +627,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
                     changeAudioFocus(true);
                     if (!mWakeLock.isHeld())
                         mWakeLock.acquire();
-                    if (!mVideoBackground && switchToVideo())
+                    if (!keyguardManager.inKeyguardRestrictedInputMode() && !mVideoBackground && switchToVideo())
                         hideNotification(false);
                     else
                         showNotification();



More information about the Android mailing list