Merge pull request #2639 from ByteHamster/fix-play-button

Don't pause directly after starting
This commit is contained in:
Martin Fietz 2018-04-22 09:14:09 +02:00 committed by GitHub
commit 4edaa2e6fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -1436,6 +1436,12 @@ public class PlaybackService extends MediaBrowserServiceCompat {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (isInitialStickyBroadcast ()) {
// Don't pause playback after we just started, just because the receiver
// delivers the current headset state (instead of a change)
return;
}
if (TextUtils.equals(intent.getAction(), Intent.ACTION_HEADSET_PLUG)) { if (TextUtils.equals(intent.getAction(), Intent.ACTION_HEADSET_PLUG)) {
int state = intent.getIntExtra("state", -1); int state = intent.getIntExtra("state", -1);
if (state != -1) { if (state != -1) {