From: Zhihai Xu Date: Fri, 12 Apr 2013 01:14:53 +0000 (-0700) Subject: Resolve AVRCP IOP issues X-Git-Tag: android-7.1.2_r17~984^2~8 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=79d176b0f3d6cb33c7e52be6641fd4808ba87e93;p=android-x86%2Fpackages-apps-Bluetooth.git Resolve AVRCP IOP issues This patch has the following fixes 1. Track number should be 0xFFFFFFFF when no track is currently selected 2. When no track is currently selected set play state as stopped 3. Track number sent in the correct byte order issue 8586495 Change-Id: I2be583d1e87a39015dff605c7442ca658a10b2e2 --- diff --git a/src/com/android/bluetooth/a2dp/Avrcp.java b/src/com/android/bluetooth/a2dp/Avrcp.java index 3e3ded1a..0a5a69e4 100755 --- a/src/com/android/bluetooth/a2dp/Avrcp.java +++ b/src/com/android/bluetooth/a2dp/Avrcp.java @@ -93,7 +93,7 @@ final class Avrcp { mCurrentPlayState = RemoteControlClient.PLAYSTATE_NONE; // until we get a callback mPlayStatusChangedNT = NOTIFICATION_TYPE_CHANGED; mTrackChangedNT = NOTIFICATION_TYPE_CHANGED; - mTrackNumber = 0L; + mTrackNumber = -1L; mCurrentPosMs = RemoteControlClient.PLAYBACK_POSITION_INVALID; mPlayStartTimeMs = -1L; mSongLengthMs = 0L; @@ -411,8 +411,9 @@ final class Avrcp { private void sendTrackChangedRsp() { byte[] track = new byte[TRACK_ID_SIZE]; + /* track is stored in big endian format */ for (int i = 0; i < TRACK_ID_SIZE; ++i) { - track[i] = (byte) (mTrackNumber >> (8 * i)); + track[i] = (byte) (mTrackNumber >> (56 - 8 * i)); } registerNotificationRspTrackChangeNative(mTrackChangedNT, track); } @@ -469,6 +470,7 @@ final class Avrcp { break; case RemoteControlClient.PLAYSTATE_STOPPED: + case RemoteControlClient.PLAYSTATE_NONE: playStatus = PLAYSTATUS_STOPPED; break; @@ -487,7 +489,6 @@ final class Avrcp { break; case RemoteControlClient.PLAYSTATE_ERROR: - case RemoteControlClient.PLAYSTATE_NONE: playStatus = PLAYSTATUS_ERROR; break;