Loading android/app/jni/com_android_bluetooth_avrcp.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -806,10 +806,15 @@ static jboolean registerNotificationRspTrackChangeNative(JNIEnv* env, } btrc_register_notification_t param; uint64_t uid = 0; for (int uid_idx = 0; uid_idx < BTRC_UID_SIZE; ++uid_idx) { param.track[uid_idx] = trk[uid_idx]; uid = uid + (trk[uid_idx] << (BTRC_UID_SIZE - 1 - uid_idx)); } ALOGV("%s: Sending track change notification: %d -> %llu", __func__, type, uid); bt_status_t status = sBluetoothAvrcpInterface->register_notification_rsp( BTRC_EVT_TRACK_CHANGE, (btrc_notification_type_t)type, ¶m); if (status != BT_STATUS_SUCCESS) { Loading android/app/src/com/android/bluetooth/avrcp/AddressedMediaPlayer.java +13 −8 Original line number Diff line number Diff line Loading @@ -175,18 +175,18 @@ public class AddressedMediaPlayer { return currentExtras; } String[] stringKeys = {MediaMetadata.METADATA_KEY_ARTIST, MediaMetadata.METADATA_KEY_ALBUM, MediaMetadata.METADATA_KEY_GENRE}; String[] longKeys = {MediaMetadata.METADATA_KEY_TRACK_NUMBER, MediaMetadata.METADATA_KEY_NUM_TRACKS, MediaMetadata.METADATA_KEY_DURATION}; Bundle bundle = currentExtras; if (bundle == null) bundle = new Bundle(); String[] stringKeys = {MediaMetadata.METADATA_KEY_TITLE, MediaMetadata.METADATA_KEY_ARTIST, MediaMetadata.METADATA_KEY_ALBUM, MediaMetadata.METADATA_KEY_GENRE}; for (String key : stringKeys) { String current = bundle.getString(key); if (current == null) bundle.putString(key, metadata.getString(key)); } String[] longKeys = {MediaMetadata.METADATA_KEY_TRACK_NUMBER, MediaMetadata.METADATA_KEY_NUM_TRACKS, MediaMetadata.METADATA_KEY_DURATION}; for (String key : longKeys) { if (!bundle.containsKey(key)) bundle.putLong(key, metadata.getLong(key)); } Loading Loading @@ -408,15 +408,20 @@ public class AddressedMediaPlayer { try { MediaDescription desc = item.getDescription(); Bundle extras = desc.getExtras(); if (item.getQueueId() == getActiveQueueItemId(mediaController)) { if (DEBUG) Log.d(TAG, "getAttrValue: item is active, filling extra data"); boolean isCurrentTrack = item.getQueueId() == getActiveQueueItemId(mediaController); if (isCurrentTrack) { if (DEBUG) Log.d(TAG, "getAttrValue: item is active, using current data"); extras = fillBundle(mediaController.getMetadata(), extras); } if (DEBUG) Log.d(TAG, "getAttrValue: item " + item + " : " + desc); switch (attr) { case AvrcpConstants.ATTRID_TITLE: /* Title is mandatory attribute */ if (isCurrentTrack) { attrValue = extras.getString(MediaMetadata.METADATA_KEY_TITLE); } else { attrValue = desc.getTitle().toString(); } break; case AvrcpConstants.ATTRID_ARTIST: Loading android/app/src/com/android/bluetooth/avrcp/Avrcp.java +7 −5 Original line number Diff line number Diff line Loading @@ -974,12 +974,10 @@ public final class Avrcp { long oldQueueId = mCurrentPlayState.getActiveQueueItemId(); long newQueueId = MediaSession.QueueItem.UNKNOWN_ID; if (newState != null) newQueueId = newState.getActiveQueueItemId(); if ((oldQueueId != newQueueId) || (!currentAttributes.equals(mMediaAttributes))) { Log.v(TAG, "Media change: id " + oldQueueId + "➡" + newQueueId + ":" Log.v(TAG, "Media update: id " + oldQueueId + "➡" + newQueueId + ":" + mMediaAttributes.toString()); if (oldQueueId != newQueueId || !currentAttributes.equals(mMediaAttributes)) { sendTrackChangedRsp(false); } else { Log.v(TAG, "Media didn't change: id " + oldQueueId); } updatePlaybackState(newState); Loading Loading @@ -1071,6 +1069,10 @@ public final class Avrcp { private void sendTrackChangedRsp(boolean requested) { MediaPlayerInfo info = getAddressedPlayerInfo(); if (!requested && mTrackChangedNT != AvrcpConstants.NOTIFICATION_TYPE_INTERIM) { if (DEBUG) Log.d(TAG, "sendTrackChangedRsp: Not registered or requesting."); return; } if (info != null && !info.isBrowseSupported()) { // for players which does not support Browse or when no track is currently selected trackChangeRspForBrowseUnsupported(requested); Loading Loading
android/app/jni/com_android_bluetooth_avrcp.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -806,10 +806,15 @@ static jboolean registerNotificationRspTrackChangeNative(JNIEnv* env, } btrc_register_notification_t param; uint64_t uid = 0; for (int uid_idx = 0; uid_idx < BTRC_UID_SIZE; ++uid_idx) { param.track[uid_idx] = trk[uid_idx]; uid = uid + (trk[uid_idx] << (BTRC_UID_SIZE - 1 - uid_idx)); } ALOGV("%s: Sending track change notification: %d -> %llu", __func__, type, uid); bt_status_t status = sBluetoothAvrcpInterface->register_notification_rsp( BTRC_EVT_TRACK_CHANGE, (btrc_notification_type_t)type, ¶m); if (status != BT_STATUS_SUCCESS) { Loading
android/app/src/com/android/bluetooth/avrcp/AddressedMediaPlayer.java +13 −8 Original line number Diff line number Diff line Loading @@ -175,18 +175,18 @@ public class AddressedMediaPlayer { return currentExtras; } String[] stringKeys = {MediaMetadata.METADATA_KEY_ARTIST, MediaMetadata.METADATA_KEY_ALBUM, MediaMetadata.METADATA_KEY_GENRE}; String[] longKeys = {MediaMetadata.METADATA_KEY_TRACK_NUMBER, MediaMetadata.METADATA_KEY_NUM_TRACKS, MediaMetadata.METADATA_KEY_DURATION}; Bundle bundle = currentExtras; if (bundle == null) bundle = new Bundle(); String[] stringKeys = {MediaMetadata.METADATA_KEY_TITLE, MediaMetadata.METADATA_KEY_ARTIST, MediaMetadata.METADATA_KEY_ALBUM, MediaMetadata.METADATA_KEY_GENRE}; for (String key : stringKeys) { String current = bundle.getString(key); if (current == null) bundle.putString(key, metadata.getString(key)); } String[] longKeys = {MediaMetadata.METADATA_KEY_TRACK_NUMBER, MediaMetadata.METADATA_KEY_NUM_TRACKS, MediaMetadata.METADATA_KEY_DURATION}; for (String key : longKeys) { if (!bundle.containsKey(key)) bundle.putLong(key, metadata.getLong(key)); } Loading Loading @@ -408,15 +408,20 @@ public class AddressedMediaPlayer { try { MediaDescription desc = item.getDescription(); Bundle extras = desc.getExtras(); if (item.getQueueId() == getActiveQueueItemId(mediaController)) { if (DEBUG) Log.d(TAG, "getAttrValue: item is active, filling extra data"); boolean isCurrentTrack = item.getQueueId() == getActiveQueueItemId(mediaController); if (isCurrentTrack) { if (DEBUG) Log.d(TAG, "getAttrValue: item is active, using current data"); extras = fillBundle(mediaController.getMetadata(), extras); } if (DEBUG) Log.d(TAG, "getAttrValue: item " + item + " : " + desc); switch (attr) { case AvrcpConstants.ATTRID_TITLE: /* Title is mandatory attribute */ if (isCurrentTrack) { attrValue = extras.getString(MediaMetadata.METADATA_KEY_TITLE); } else { attrValue = desc.getTitle().toString(); } break; case AvrcpConstants.ATTRID_ARTIST: Loading
android/app/src/com/android/bluetooth/avrcp/Avrcp.java +7 −5 Original line number Diff line number Diff line Loading @@ -974,12 +974,10 @@ public final class Avrcp { long oldQueueId = mCurrentPlayState.getActiveQueueItemId(); long newQueueId = MediaSession.QueueItem.UNKNOWN_ID; if (newState != null) newQueueId = newState.getActiveQueueItemId(); if ((oldQueueId != newQueueId) || (!currentAttributes.equals(mMediaAttributes))) { Log.v(TAG, "Media change: id " + oldQueueId + "➡" + newQueueId + ":" Log.v(TAG, "Media update: id " + oldQueueId + "➡" + newQueueId + ":" + mMediaAttributes.toString()); if (oldQueueId != newQueueId || !currentAttributes.equals(mMediaAttributes)) { sendTrackChangedRsp(false); } else { Log.v(TAG, "Media didn't change: id " + oldQueueId); } updatePlaybackState(newState); Loading Loading @@ -1071,6 +1069,10 @@ public final class Avrcp { private void sendTrackChangedRsp(boolean requested) { MediaPlayerInfo info = getAddressedPlayerInfo(); if (!requested && mTrackChangedNT != AvrcpConstants.NOTIFICATION_TYPE_INTERIM) { if (DEBUG) Log.d(TAG, "sendTrackChangedRsp: Not registered or requesting."); return; } if (info != null && !info.isBrowseSupported()) { // for players which does not support Browse or when no track is currently selected trackChangeRspForBrowseUnsupported(requested); Loading