diff options
author | Ayan Ghosh <abghosh@codeaurora.org> | 2014-05-31 16:08:35 +0530 |
---|---|---|
committer | Andrew Bartholomew <andrewb03@gmail.com> | 2014-09-19 08:45:05 -0400 |
commit | 7605d967abc70c70a43388cfc7e3459798f3adaa (patch) | |
tree | 4266d27288f06299e53e5343fa4bd7e73ad24f88 | |
parent | 86ca77636df1ba56d7b126b8ff541835b3e35ee8 (diff) | |
download | android_packages_apps_Bluetooth-7605d967abc70c70a43388cfc7e3459798f3adaa.tar.gz android_packages_apps_Bluetooth-7605d967abc70c70a43388cfc7e3459798f3adaa.tar.bz2 android_packages_apps_Bluetooth-7605d967abc70c70a43388cfc7e3459798f3adaa.zip |
Update song start time and current Position
Update song start time and current position only when change in
metadata detected or Audio manager updates the time when playstatus
changes or seek is performed on media player.
CRs-Fixed: 674410
Change-Id: Ib0f1f9a551008084584ccfdcdff302c424d6214a
-rw-r--r-- | src/com/android/bluetooth/a2dp/Avrcp.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/com/android/bluetooth/a2dp/Avrcp.java b/src/com/android/bluetooth/a2dp/Avrcp.java index 52c442b0d..86edf737a 100644 --- a/src/com/android/bluetooth/a2dp/Avrcp.java +++ b/src/com/android/bluetooth/a2dp/Avrcp.java @@ -828,6 +828,11 @@ final class Avrcp { mCurrentPosMs = getPlayPosition(); } + if ((state == RemoteControlClient.PLAYSTATE_PLAYING) && (mCurrentPlayState != state)) { + mPlayStartTimeMs = SystemClock.elapsedRealtime(); + Log.d(TAG, "Update mPlayStartTimeMs to " + mPlayStartTimeMs); + } + mCurrentPlayState = state; if (mMediaPlayers.size() > 0) { @@ -852,11 +857,14 @@ final class Avrcp { } } - if (currentPosMs != RemoteControlClient.PLAYBACK_POSITION_INVALID) { - mCurrentPosMs = currentPosMs; - } - if (state == RemoteControlClient.PLAYSTATE_PLAYING) { - mPlayStartTimeMs = SystemClock.elapsedRealtime(); + if (!(RemoteControlClient.PLAYSTATE_PLAYING == mCurrentPlayState && + mCurrentPlayState == state && mCurrentPosMs == currentPosMs)) { + if (currentPosMs != RemoteControlClient.PLAYBACK_POSITION_INVALID) { + mCurrentPosMs = currentPosMs; + mPlayStartTimeMs = SystemClock.elapsedRealtime(); + Log.d(TAG, "Update mPlayStartTimeMs: " + mPlayStartTimeMs + " mCurrentPosMs: " + + mCurrentPosMs); + } } boolean newPosValid = (mCurrentPosMs != |