Commit 657192dc authored by solk2's avatar solk2
Browse files

Eleven: Add missing metadata keys for Avrcp.

Change-Id: I7201838cf65b6b1edcf2aee0284e31bdafaf42ca
parent 5223eb74
......@@ -1492,6 +1492,9 @@ public class MusicPlaybackService extends Service {
.putString(MediaMetadata.METADATA_KEY_ALBUM, getAlbumName())
.putString(MediaMetadata.METADATA_KEY_TITLE, getTrackName())
.putLong(MediaMetadata.METADATA_KEY_DURATION, duration())
.putLong(MediaMetadata.METADATA_KEY_TRACK_NUMBER, getQueuePosition() + 1)
.putLong(MediaMetadata.METADATA_KEY_NUM_TRACKS, getQueue().length)
.putString(MediaMetadata.METADATA_KEY_GENRE, getGenreName())
.putBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART, albumArt)
.build());
......@@ -1998,6 +2001,35 @@ public class MusicPlaybackService extends Service {
}
}
/**
* Returns the genre name of song
*
* @return The current song genre name
*/
public String getGenreName() {
synchronized (this) {
if (mCursor == null) {
return null;
}
String[] genreProjection = { MediaStore.Audio.Genres.NAME };
Uri genreUri = MediaStore.Audio.Genres.getContentUriForAudioId("external",
(int) mPlaylist.get(mPlayPos).mId);
Cursor genreCursor = getContentResolver().query(genreUri, genreProjection,
null, null, null);
if (genreCursor != null) {
try {
if (genreCursor.moveToFirst()) {
return genreCursor.getString(
genreCursor.getColumnIndexOrThrow(MediaStore.Audio.Genres.NAME));
}
} finally {
genreCursor.close();
}
}
return null;
}
}
/**
* Returns the artist name
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment