OSDN Git Service

AVRCP: update metadata and state more consistently
authorMarie Janssen <jamuraa@google.com>
Tue, 25 Apr 2017 01:36:19 +0000 (18:36 -0700)
committerMarie Janssen <jamuraa@google.com>
Thu, 27 Apr 2017 20:12:12 +0000 (13:12 -0700)
commit93f177151f5b96ce3e06888884da3cd7f7858ecf
treef62841d712cca62cc5639d0620c9a40dba3f8281
parent0f9c79e8afa3e575dfd8c80c2c58b9321e18898d
AVRCP: update metadata and state more consistently

When we get onMetadata it's not updated quite right, and the
PlaybackState gives the wrong answer for getActiveQueueItemId, which
means that we don't send the correct updated data.  Update the metadata
when we get a onPlaybackStateChanged as well, so we refresh the
metadata and notify correctly for EVENT_TRACK_CHANGED.

Keep track of the last queue item we sent and don't send an update if
the queue item has not changed.

Use A2DP streaming state only when we don't have strong signals from
Media framework.

Use PlaybackState.getLastPositionUpdateTime() instead of trying to
figure it out on our own.

Trust MediaAttributes with the track length instead of duplicating it.

Test: connect to BMW kit and skip some tracks, new data will show up
correctly
Bug: 37209435
Bug: 36016671
Bug: 36357185
Bug: 36055995
Change-Id: I332aaadeabcfe8284084a34c964e5f0d07bfeef4

(cherry picked from commit 0a429916782c20980e7f0893c503c633b8341f88)
src/com/android/bluetooth/avrcp/AddressedMediaPlayer.java
src/com/android/bluetooth/avrcp/Avrcp.java