[Android] Do not constantly publish mediasession progress
Geoffrey Métais
git at videolan.org
Fri May 4 09:55:20 CEST 2018
vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri May 4 09:54:38 2018 +0200| [dbac0c6c56e3c7ef9579cb0af0127933abf0b14b] | committer: Geoffrey Métais
Do not constantly publish mediasession progress
This was spamming the whole framework for unnecessary updates.
Especially Android Auto via Bluetooth.
Auto and Now Playing card fake this progress, it was not needed at all.
> https://code.videolan.org/videolan/vlc-android/commit/dbac0c6c56e3c7ef9579cb0af0127933abf0b14b
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 864afb210..070df4c57 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -113,7 +113,7 @@ public class PlaybackService extends MediaBrowserServiceCompat{
private static final int SHOW_PROGRESS = 0;
private static final int SHOW_TOAST = 1;
private static final int END_MEDIASESSION = 2;
- private static final int PUBLISH_STATE = 3;
+ private static final int PUBLISH_PROGRESS = 3;
private static final long DELAY_DOUBLE_CLICK = 800L;
private static final long DELAY_LONG_CLICK = 1000L;
@@ -548,7 +548,7 @@ public class PlaybackService extends MediaBrowserServiceCompat{
break;
case MediaPlayer.Event.PositionChanged:
updateWidgetPosition(event.getPositionChanged());
- mHandler.sendEmptyMessage(PUBLISH_STATE);
+ mHandler.sendEmptyMessage(PUBLISH_PROGRESS);
break;
case MediaPlayer.Event.Vout:
break;
@@ -642,10 +642,9 @@ public class PlaybackService extends MediaBrowserServiceCompat{
case END_MEDIASESSION:
if (service.mMediaSession != null) service.mMediaSession.setActive(false);
break;
- case PUBLISH_STATE:
+ case PUBLISH_PROGRESS:
final long time = System.currentTimeMillis();
if (time - lastPublicationDate > 1000L) {
- service.publishState();
lastPublicationDate = time;
}
break;
More information about the Android
mailing list