|
|
|
@@ -724,31 +724,18 @@ class MinstrelAudioHandler extends BaseAudioHandler with QueueHandler, SeekHandl
|
|
|
|
|
// with up-to-date shuffleMode/repeatMode fields.
|
|
|
|
|
void _broadcastState(PlaybackEvent? event) {
|
|
|
|
|
final playing = _player.playing;
|
|
|
|
|
// Favorite control: only when a track is playing and the LikeBridge
|
|
|
|
|
// is wired. Icon/label toggle by current like state; tapping it
|
|
|
|
|
// routes to customAction('minstrel.favorite'). Implemented as a
|
|
|
|
|
// MediaControl.custom (NOT setRating — that path is broken upstream,
|
|
|
|
|
// audio_service #376, and regressed the Pixel Watch). Kept out of
|
|
|
|
|
// androidCompactActionIndices so the compact/lock view is unchanged.
|
|
|
|
|
final favTrackId = mediaItem.value?.id;
|
|
|
|
|
final favBridge = _likeBridge;
|
|
|
|
|
final showFav = favTrackId != null && favBridge != null;
|
|
|
|
|
final favLiked = favTrackId != null &&
|
|
|
|
|
favBridge != null &&
|
|
|
|
|
favBridge.isTrackLiked(favTrackId);
|
|
|
|
|
// No custom favorite MediaControl here. audio_service builds a
|
|
|
|
|
// PlaybackStateCompat.CustomAction for it and throws
|
|
|
|
|
// "You must specify an icon resource id to build a CustomAction"
|
|
|
|
|
// on real builds (the androidIcon doesn't resolve to a usable id),
|
|
|
|
|
// and that exception aborts the ENTIRE media notification — no
|
|
|
|
|
// tray or Wear controls at all. Removed; like/favorite remains
|
|
|
|
|
// available in-app and via the standard lock-screen surface.
|
|
|
|
|
playbackState.add(PlaybackState(
|
|
|
|
|
controls: [
|
|
|
|
|
MediaControl.skipToPrevious,
|
|
|
|
|
if (playing) MediaControl.pause else MediaControl.play,
|
|
|
|
|
MediaControl.skipToNext,
|
|
|
|
|
if (showFav)
|
|
|
|
|
MediaControl.custom(
|
|
|
|
|
androidIcon: favLiked
|
|
|
|
|
? 'drawable/ic_stat_favorite'
|
|
|
|
|
: 'drawable/ic_stat_favorite_border',
|
|
|
|
|
label: favLiked ? 'Unfavorite' : 'Favorite',
|
|
|
|
|
name: 'minstrel.favorite',
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
// androidCompactActionIndices tells the system which controls
|
|
|
|
|
// appear in the collapsed/lock-screen view. Without this, some
|
|
|
|
|