Hide remote-control artwork if notification is not forced
This fixes stuck artwork on some motorola (only?) devices
This commit is contained in:
parent
7699dd49e8
commit
d92f01d01f
@ -1045,7 +1045,7 @@ public final class PlaybackService extends Service
|
|||||||
if (mReadaheadEnabled)
|
if (mReadaheadEnabled)
|
||||||
triggerReadAhead();
|
triggerReadAhead();
|
||||||
|
|
||||||
RemoteControl.updateRemote(this, mCurrentSong, mState);
|
RemoteControl.updateRemote(this, mCurrentSong, mState, mForceNotificationVisible);
|
||||||
|
|
||||||
if (mStockBroadcast)
|
if (mStockBroadcast)
|
||||||
stockMusicBroadcast();
|
stockMusicBroadcast();
|
||||||
|
@ -75,14 +75,17 @@ public class RemoteControl {
|
|||||||
* @param context A context to use.
|
* @param context A context to use.
|
||||||
* @param song The song containing the new metadata.
|
* @param song The song containing the new metadata.
|
||||||
* @param state PlaybackService state, used to determine playback state.
|
* @param state PlaybackService state, used to determine playback state.
|
||||||
|
* @param keepPaused whether or not to keep the remote updated in paused mode
|
||||||
*/
|
*/
|
||||||
public static void updateRemote(Context context, Song song, int state)
|
public static void updateRemote(Context context, Song song, int state, boolean keepPaused)
|
||||||
{
|
{
|
||||||
RemoteControlClient remote = sRemote;
|
RemoteControlClient remote = sRemote;
|
||||||
if (remote == null)
|
if (remote == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
remote.setPlaybackState((state & PlaybackService.FLAG_PLAYING) != 0 ? RemoteControlClient.PLAYSTATE_PLAYING : RemoteControlClient.PLAYSTATE_PAUSED);
|
boolean isPlaying = ((state & PlaybackService.FLAG_PLAYING) != 0);
|
||||||
|
|
||||||
|
remote.setPlaybackState(isPlaying ? RemoteControlClient.PLAYSTATE_PLAYING : RemoteControlClient.PLAYSTATE_PAUSED);
|
||||||
RemoteControlClient.MetadataEditor editor = remote.editMetadata(true);
|
RemoteControlClient.MetadataEditor editor = remote.editMetadata(true);
|
||||||
if (song != null && song.id != -1) {
|
if (song != null && song.id != -1) {
|
||||||
String artist_album = song.artist + " - " + song.album;
|
String artist_album = song.artist + " - " + song.album;
|
||||||
@ -92,7 +95,7 @@ public class RemoteControl {
|
|||||||
editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, artist_album);
|
editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, artist_album);
|
||||||
editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, song.title);
|
editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, song.title);
|
||||||
Bitmap bitmap = song.getCover(context);
|
Bitmap bitmap = song.getCover(context);
|
||||||
if (bitmap != null) {
|
if (bitmap != null && (isPlaying || keepPaused)) {
|
||||||
// Create a copy of the cover art, since RemoteControlClient likes
|
// Create a copy of the cover art, since RemoteControlClient likes
|
||||||
// to recycle what we give it.
|
// to recycle what we give it.
|
||||||
bitmap = bitmap.copy(Bitmap.Config.RGB_565, false);
|
bitmap = bitmap.copy(Bitmap.Config.RGB_565, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user