[Android] PlaybackService: remove duplicate code from onDestroy()

Thomas Guillem git at videolan.org
Fri Oct 20 17:32:14 CEST 2017


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Oct 20 17:15:32 2017 +0200| [b6a4c13bb0c6c3e7862fad87bc39e8b22b6e7900] | committer: Thomas Guillem

PlaybackService: remove duplicate code from onDestroy()

The Wakelock and the MediaPlayer views are already released from stop() called
from onDestroy() too.

No need to release the MediaPlayer from background since it's not started at
this point.

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 49af43b3e..a57b2d994 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -362,21 +362,13 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         if (!AndroidDevices.hasTsp && !AndroidDevices.hasPlayServices)
             AndroidDevices.setRemoteControlReceiverEnabled(false);
 
-        if (mWakeLock.isHeld())
-            mWakeLock.release();
         unregisterReceiver(mReceiver);
         if (mRemoteControlClientReceiver != null) {
             unregisterReceiver(mRemoteControlClientReceiver);
             mRemoteControlClientReceiver = null;
         }
-        if (isVideoPlaying())
-            mMediaPlayer.getVLCVout().detachViews();
-        VLCApplication.runBackground(new Runnable() {
-            @Override
-            public void run() {
-                mMediaPlayer.release();
-            }
-        });
+
+        mMediaPlayer.release();
     }
 
     @Override



More information about the Android mailing list