[Android] Remove delaying to prevent race conditions

Geoffrey Métais git at videolan.org
Thu Jan 12 17:15:45 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 12 17:06:35 2017 +0100| [c5618bf8254c4b00ebd5b2c4682f45e46951c1e8] | committer: Geoffrey Métais

Remove delaying to prevent race conditions

This is not needed anymore

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

 .../org/videolan/vlc/gui/audio/AudioPlayer.java    | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index 3be6d0e..1030809 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -28,7 +28,6 @@ import android.content.SharedPreferences;
 import android.media.AudioManager;
 import android.os.Bundle;
 import android.os.Handler;
-import android.os.Message;
 import android.preference.PreferenceManager;
 import android.support.annotation.Nullable;
 import android.support.annotation.RequiresPermission;
@@ -93,6 +92,8 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
     private static final String PREF_PLAYLIST_TIPS_SHOWN = "playlist_tips_shown";
     private static final String PREF_AUDIOPLAYER_TIPS_SHOWN = "audioplayer_tips_shown";
 
+    private Handler mHandler = new Handler();
+
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         mBinding = AudioPlayerBinding.inflate(inflater);
@@ -172,11 +173,6 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
     }
 
     public void update() {
-        mHandler.removeMessages(UPDATE);
-        mHandler.sendEmptyMessageDelayed(UPDATE, 50);
-    }
-
-    public void doUpdate() {
         if (mService == null || getActivity() == null)
             return;
 
@@ -679,18 +675,4 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
         if (getFragmentManager() != null)
             super.setUserVisibleHint(isVisibleToUser);
     }
-
-    private static final int UPDATE = 0;
-    private Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case UPDATE:
-                    doUpdate();
-                    break;
-                default:
-                    super.handleMessage(msg);
-            }
-        }
-    };
 }



More information about the Android mailing list