call stop(true) when media action stop is received

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205377624
This commit is contained in:
bachinger 2018-07-20 03:50:33 -07:00 committed by Oliver Woodman
parent 0721d372a7
commit 1699876aab
2 changed files with 7 additions and 4 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Android Open Source Project
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -127,7 +127,7 @@ public class DefaultPlaybackController implements MediaSessionConnector.Playback
@Override
public void onStop(Player player) {
player.stop();
player.stop(true);
}
@Override

View file

@ -689,13 +689,16 @@ public final class MediaSessionConnector {
@Override
public MediaMetadataCompat getMetadata(Player player) {
if (player.getCurrentTimeline().isEmpty()) {
return null;
}
MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder();
if (player != null && player.isPlayingAd()) {
if (player.isPlayingAd()) {
builder.putLong(MediaMetadataCompat.METADATA_KEY_ADVERTISEMENT, 1);
}
builder.putLong(
MediaMetadataCompat.METADATA_KEY_DURATION,
player == null ? 0 : player.getDuration() == C.TIME_UNSET ? -1 : player.getDuration());
player.getDuration() == C.TIME_UNSET ? -1 : player.getDuration());
long activeQueueItemId = mediaController.getPlaybackState().getActiveQueueItemId();
if (activeQueueItemId != MediaSessionCompat.QueueItem.UNKNOWN_ID) {
List<MediaSessionCompat.QueueItem> queue = mediaController.getQueue();