Commit d533f129 authored by Geoffrey Métais's avatar Geoffrey Métais

Do not filter DOWN remote input events

Close #526
parent 4471bcc9
...@@ -115,8 +115,8 @@ public class PlaybackService extends MediaBrowserServiceCompat{ ...@@ -115,8 +115,8 @@ public class PlaybackService extends MediaBrowserServiceCompat{
private static final int SHOW_TOAST = 1; private static final int SHOW_TOAST = 1;
private static final int END_MEDIASESSION = 2; private static final int END_MEDIASESSION = 2;
private static final int DELAY_DOUBLE_CLICK = 800; private static final long DELAY_DOUBLE_CLICK = 800L;
private static final int DELAY_LONG_CLICK = 1000; private static final long DELAY_LONG_CLICK = 1000L;
public interface Callback { public interface Callback {
void update(); void update();
...@@ -803,8 +803,8 @@ public class PlaybackService extends MediaBrowserServiceCompat{ ...@@ -803,8 +803,8 @@ public class PlaybackService extends MediaBrowserServiceCompat{
} }
private final class MediaSessionCallback extends MediaSessionCompat.Callback { private final class MediaSessionCallback extends MediaSessionCompat.Callback {
private long mHeadsetDownTime = 0; private long mHeadsetDownTime = 0L;
private long mHeadsetUpTime = 0; private long mHeadsetUpTime = 0L;
@Override @Override
public boolean onMediaButtonEvent(Intent mediaButtonEvent) { public boolean onMediaButtonEvent(Intent mediaButtonEvent) {
...@@ -817,8 +817,7 @@ public class PlaybackService extends MediaBrowserServiceCompat{ ...@@ -817,8 +817,7 @@ public class PlaybackService extends MediaBrowserServiceCompat{
final long time = SystemClock.uptimeMillis(); final long time = SystemClock.uptimeMillis();
switch (event.getAction()) { switch (event.getAction()) {
case KeyEvent.ACTION_DOWN: case KeyEvent.ACTION_DOWN:
if (event.getRepeatCount() <= 0) if (event.getRepeatCount() <= 0) mHeadsetDownTime = time;
mHeadsetDownTime = time;
if (!hasMedia()) { if (!hasMedia()) {
loadLastAudioPlaylist(); loadLastAudioPlaylist();
return true; return true;
......
...@@ -49,8 +49,7 @@ public class RemoteControlClientReceiver extends MediaButtonReceiver { ...@@ -49,8 +49,7 @@ public class RemoteControlClientReceiver extends MediaButtonReceiver {
if (event != null && action.equalsIgnoreCase(Intent.ACTION_MEDIA_BUTTON)) { if (event != null && action.equalsIgnoreCase(Intent.ACTION_MEDIA_BUTTON)) {
if (event.getKeyCode() != KeyEvent.KEYCODE_HEADSETHOOK && if (event.getKeyCode() != KeyEvent.KEYCODE_HEADSETHOOK &&
event.getKeyCode() != KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE && event.getKeyCode() != KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
event.getAction() != KeyEvent.ACTION_DOWN) {
super.onReceive(context, intent); super.onReceive(context, intent);
return; return;
} }
...@@ -103,8 +102,7 @@ public class RemoteControlClientReceiver extends MediaButtonReceiver { ...@@ -103,8 +102,7 @@ public class RemoteControlClientReceiver extends MediaButtonReceiver {
break; break;
} }
if (isOrderedBroadcast()) if (isOrderedBroadcast()) abortBroadcast();
abortBroadcast();
if (i != null) { if (i != null) {
Util.startService(context, i); Util.startService(context, i);
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment