Update MediaButtonIntentReceiver.java

This commit is contained in:
Víctor 2017-12-23 18:41:21 +01:00 committed by GitHub
commit bbfdfae430
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -133,11 +133,7 @@ public class MediaButtonIntentReceiver extends BroadcastReceiver {
// The service may or may not be running, but we need to send it
// a command.
int keycodeToCompare = KeyEvent.KEYCODE_HEADSETHOOK;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
keycodeToCompare = KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE;
}
if (keycode == keycodeToCompare) {
if (keycode == KeyEvent.KEYCODE_HEADSETHOOK || keycode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
if (eventTime - mLastClickTime >= DOUBLE_CLICK) {
mClickCounter = 0;
}
@ -203,4 +199,4 @@ public class MediaButtonIntentReceiver extends BroadcastReceiver {
mWakeLock = null;
}
}
}
}