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
Loading