Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51d1c495 authored by Andre Eisenbach's avatar Andre Eisenbach Committed by android-build-merger
Browse files

Merge "AVRCP: send track changed if queue id is the same" am: cba622c8 am: dd7912ba

am: f798424a

Change-Id: I668941829ad3e83b5c3d6ade68c29718980b6886
parents 4bc5678e f798424a
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -267,13 +267,8 @@ public class AddressedMediaPlayer {
            /* for any item associated with NowPlaying, uid is queueId */
            /* for any item associated with NowPlaying, uid is queueId */
            if (state != null) qid = state.getActiveQueueItemId();
            if (state != null) qid = state.getActiveQueueItemId();
        }
        }
        if (!requesting && qid == mLastTrackIdSent) {
            if (DEBUG) Log.d(TAG, "not sending duplicate track changed id " + qid);
            return false;
        }
        track = ByteBuffer.allocate(AvrcpConstants.UID_SIZE).putLong(qid).array();
        track = ByteBuffer.allocate(AvrcpConstants.UID_SIZE).putLong(qid).array();
        if (DEBUG) Log.d(TAG, "trackChangedRsp: 0x" + Utils.byteArrayToString(track));
        if (DEBUG) Log.d(TAG, "trackChangedRsp: 0x" + Utils.byteArrayToString(track));

        int trackChangedNT = AvrcpConstants.NOTIFICATION_TYPE_CHANGED;
        int trackChangedNT = AvrcpConstants.NOTIFICATION_TYPE_CHANGED;
        if (requesting) trackChangedNT = AvrcpConstants.NOTIFICATION_TYPE_INTERIM;
        if (requesting) trackChangedNT = AvrcpConstants.NOTIFICATION_TYPE_INTERIM;
        mMediaInterface.trackChangedRsp(trackChangedNT, track);
        mMediaInterface.trackChangedRsp(trackChangedNT, track);
@@ -488,7 +483,6 @@ public class AddressedMediaPlayer {
        /* variables to temperorily add attrs */
        /* variables to temperorily add attrs */
        ArrayList<String> attrArray = new ArrayList<String>();
        ArrayList<String> attrArray = new ArrayList<String>();
        ArrayList<Integer> attrId = new ArrayList<Integer>();
        ArrayList<Integer> attrId = new ArrayList<Integer>();

        ArrayList<Integer> attrTempId = new ArrayList<Integer>();
        ArrayList<Integer> attrTempId = new ArrayList<Integer>();


        /* check if remote device has requested for attributes */
        /* check if remote device has requested for attributes */
+13 −9
Original line number Original line Diff line number Diff line
@@ -1583,6 +1583,9 @@ public final class Avrcp {
                            getMediaControllers();
                            getMediaControllers();
                    for (android.media.session.MediaController controller : currentControllers) {
                    for (android.media.session.MediaController controller : currentControllers) {
                        if (!newControllers.contains(controller)) {
                        if (!newControllers.contains(controller)) {
                            if (DEBUG)
                                Log.v(TAG, "Removing gone controller for "
                                                + controller.getPackageName());
                            removeMediaController(controller);
                            removeMediaController(controller);
                        }
                        }
                    }
                    }
@@ -2215,17 +2218,18 @@ public final class Avrcp {
            if (mCurrAddrPlayerID == NO_PLAYER_ID) {
            if (mCurrAddrPlayerID == NO_PLAYER_ID) {
                getItemAttrRspNative(
                getItemAttrRspNative(
                        itemAttr.mAddress, AvrcpConstants.RSP_NO_AVBL_PLAY, (byte) 0, null, null);
                        itemAttr.mAddress, AvrcpConstants.RSP_NO_AVBL_PLAY, (byte) 0, null, null);
            } else {
                return;
            }
            mAddressedMediaPlayer.getItemAttr(itemAttr.mAddress, itemAttr, mMediaController);
            mAddressedMediaPlayer.getItemAttr(itemAttr.mAddress, itemAttr, mMediaController);
            return;
        }
        }
        } else {
        // All other scopes use browsed player
        if (mAvrcpBrowseManager.getBrowsedMediaPlayer(itemAttr.mAddress) != null) {
        if (mAvrcpBrowseManager.getBrowsedMediaPlayer(itemAttr.mAddress) != null) {
            mAvrcpBrowseManager.getBrowsedMediaPlayer(itemAttr.mAddress).getItemAttr(itemAttr);
            mAvrcpBrowseManager.getBrowsedMediaPlayer(itemAttr.mAddress).getItemAttr(itemAttr);
        } else {
        } else {
            Log.e(TAG, "Could not get attributes. mBrowsedMediaPlayer is null");
            Log.e(TAG, "Could not get attributes. mBrowsedMediaPlayer is null");
                getItemAttrRspNative(itemAttr.mAddress, AvrcpConstants.RSP_INTERNAL_ERR,
            getItemAttrRspNative(
                        (byte) 0, null, null);
                    itemAttr.mAddress, AvrcpConstants.RSP_INTERNAL_ERR, (byte) 0, null, null);
            }
        }
        }
    }
    }