Loading src/com/android/bluetooth/avrcp/Avrcp.java +32 −25 Original line number Diff line number Diff line Loading @@ -334,7 +334,9 @@ public final class Avrcp { public void doQuit() { if (DEBUG) Log.d(TAG, "doQuit"); synchronized (this) { if (mMediaController != null) mMediaController.unregisterCallback(mMediaControllerCb); } if (mMediaSessionManager != null) { mMediaSessionManager.setCallback(null, null); mMediaSessionManager.removeOnActiveSessionsChangedListener(mActiveSessionListener); Loading Loading @@ -377,7 +379,8 @@ public final class Avrcp { @Override public void onSessionDestroyed() { Log.v(TAG, "MediaController session destroyed"); if (mMediaController != null) { synchronized (Avrcp.this) { if (mMediaController != null) removeMediaController(mMediaController.getWrappedInstance()); } } Loading Loading @@ -947,17 +950,18 @@ public final class Avrcp { private void updateCurrentMediaState() { MediaAttributes currentAttributes = mMediaAttributes; PlaybackState newState = null; synchronized (this) { if (mMediaController == null) { // Use A2DP state if we don't have a MediaControlller boolean isPlaying = (mA2dpState == BluetoothA2dp.STATE_PLAYING) && mAudioManager.isMusicActive(); boolean isPlaying = (mA2dpState == BluetoothA2dp.STATE_PLAYING) && mAudioManager.isMusicActive(); PlaybackState.Builder builder = new PlaybackState.Builder(); if (isPlaying) { builder.setState( PlaybackState.STATE_PLAYING, PlaybackState.PLAYBACK_POSITION_UNKNOWN, 1.0f); builder.setState(PlaybackState.STATE_PLAYING, PlaybackState.PLAYBACK_POSITION_UNKNOWN, 1.0f); } else { builder.setState( PlaybackState.STATE_PAUSED, PlaybackState.PLAYBACK_POSITION_UNKNOWN, 0.0f); builder.setState(PlaybackState.STATE_PAUSED, PlaybackState.PLAYBACK_POSITION_UNKNOWN, 0.0f); } newState = builder.build(); mMediaAttributes = new MediaAttributes(null); Loading @@ -965,6 +969,7 @@ public final class Avrcp { newState = mMediaController.getPlaybackState(); mMediaAttributes = new MediaAttributes(mMediaController.getMetadata()); } } long oldQueueId = mCurrentPlayState.getActiveQueueItemId(); long newQueueId = MediaSession.QueueItem.UNKNOWN_ID; Loading Loading @@ -2101,8 +2106,8 @@ public final class Avrcp { if (DEBUG) Log.d(TAG, "updateCurrentController: " + mMediaController + " to " + newController); if (mMediaController == null || (!mMediaController.equals(newController))) { synchronized (this) { if (mMediaController == null || (!mMediaController.equals(newController))) { if (mMediaController != null) { mMediaController.unregisterCallback(mMediaControllerCb); } Loading @@ -2115,8 +2120,8 @@ public final class Avrcp { registerRsp = false; } } updateCurrentMediaState(); } updateCurrentMediaState(); return registerRsp; } Loading Loading @@ -2288,10 +2293,12 @@ public final class Avrcp { ProfileService.println(sb, "mVolCmdSetInProgress: " + mVolCmdSetInProgress); ProfileService.println(sb, "mAbsVolRetryTimes: " + mAbsVolRetryTimes); ProfileService.println(sb, "mVolumeMapping: " + mVolumeMapping.toString()); synchronized (this) { if (mMediaController != null) ProfileService.println(sb, "mMediaController: " + mMediaController.getWrappedInstance() + " pkg " + mMediaController.getPackageName()); ProfileService.println(sb, "mMediaController: " + mMediaController.getWrappedInstance() + " pkg " + mMediaController.getPackageName()); } ProfileService.println(sb, ""); ProfileService.println(sb, "Media Players:"); synchronized (mMediaPlayerInfoList) { Loading Loading
src/com/android/bluetooth/avrcp/Avrcp.java +32 −25 Original line number Diff line number Diff line Loading @@ -334,7 +334,9 @@ public final class Avrcp { public void doQuit() { if (DEBUG) Log.d(TAG, "doQuit"); synchronized (this) { if (mMediaController != null) mMediaController.unregisterCallback(mMediaControllerCb); } if (mMediaSessionManager != null) { mMediaSessionManager.setCallback(null, null); mMediaSessionManager.removeOnActiveSessionsChangedListener(mActiveSessionListener); Loading Loading @@ -377,7 +379,8 @@ public final class Avrcp { @Override public void onSessionDestroyed() { Log.v(TAG, "MediaController session destroyed"); if (mMediaController != null) { synchronized (Avrcp.this) { if (mMediaController != null) removeMediaController(mMediaController.getWrappedInstance()); } } Loading Loading @@ -947,17 +950,18 @@ public final class Avrcp { private void updateCurrentMediaState() { MediaAttributes currentAttributes = mMediaAttributes; PlaybackState newState = null; synchronized (this) { if (mMediaController == null) { // Use A2DP state if we don't have a MediaControlller boolean isPlaying = (mA2dpState == BluetoothA2dp.STATE_PLAYING) && mAudioManager.isMusicActive(); boolean isPlaying = (mA2dpState == BluetoothA2dp.STATE_PLAYING) && mAudioManager.isMusicActive(); PlaybackState.Builder builder = new PlaybackState.Builder(); if (isPlaying) { builder.setState( PlaybackState.STATE_PLAYING, PlaybackState.PLAYBACK_POSITION_UNKNOWN, 1.0f); builder.setState(PlaybackState.STATE_PLAYING, PlaybackState.PLAYBACK_POSITION_UNKNOWN, 1.0f); } else { builder.setState( PlaybackState.STATE_PAUSED, PlaybackState.PLAYBACK_POSITION_UNKNOWN, 0.0f); builder.setState(PlaybackState.STATE_PAUSED, PlaybackState.PLAYBACK_POSITION_UNKNOWN, 0.0f); } newState = builder.build(); mMediaAttributes = new MediaAttributes(null); Loading @@ -965,6 +969,7 @@ public final class Avrcp { newState = mMediaController.getPlaybackState(); mMediaAttributes = new MediaAttributes(mMediaController.getMetadata()); } } long oldQueueId = mCurrentPlayState.getActiveQueueItemId(); long newQueueId = MediaSession.QueueItem.UNKNOWN_ID; Loading Loading @@ -2101,8 +2106,8 @@ public final class Avrcp { if (DEBUG) Log.d(TAG, "updateCurrentController: " + mMediaController + " to " + newController); if (mMediaController == null || (!mMediaController.equals(newController))) { synchronized (this) { if (mMediaController == null || (!mMediaController.equals(newController))) { if (mMediaController != null) { mMediaController.unregisterCallback(mMediaControllerCb); } Loading @@ -2115,8 +2120,8 @@ public final class Avrcp { registerRsp = false; } } updateCurrentMediaState(); } updateCurrentMediaState(); return registerRsp; } Loading Loading @@ -2288,10 +2293,12 @@ public final class Avrcp { ProfileService.println(sb, "mVolCmdSetInProgress: " + mVolCmdSetInProgress); ProfileService.println(sb, "mAbsVolRetryTimes: " + mAbsVolRetryTimes); ProfileService.println(sb, "mVolumeMapping: " + mVolumeMapping.toString()); synchronized (this) { if (mMediaController != null) ProfileService.println(sb, "mMediaController: " + mMediaController.getWrappedInstance() + " pkg " + mMediaController.getPackageName()); ProfileService.println(sb, "mMediaController: " + mMediaController.getWrappedInstance() + " pkg " + mMediaController.getPackageName()); } ProfileService.println(sb, ""); ProfileService.println(sb, "Media Players:"); synchronized (mMediaPlayerInfoList) { Loading