[Android] Preserve notification on lock screen

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


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

Preserve notification on lock screen

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

 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 1cc888a..c3c7bed 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;
@@ -581,6 +582,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) {
@@ -616,7 +618,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