Loading src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandler.java +0 −40 Original line number Diff line number Diff line Loading @@ -121,15 +121,12 @@ public class A2dpSinkStreamHandler extends Handler { // Audio stream has started, stop it if we don't have focus. if (mAudioFocus == AudioManager.AUDIOFOCUS_NONE) { sendAvrcpPause(); } else { startAvrcpUpdates(); } break; case SRC_STR_STOP: // Audio stream has stopped, maintain focus but stop avrcp updates. mStreamAvailable = false; stopAvrcpUpdates(); break; case SNK_PLAY: Loading @@ -137,12 +134,10 @@ public class A2dpSinkStreamHandler extends Handler { if (mAudioFocus == AudioManager.AUDIOFOCUS_NONE) { requestAudioFocus(); } startAvrcpUpdates(); break; case SNK_PAUSE: // Local pause command, maintain focus but stop avrcp updates. stopAvrcpUpdates(); break; case SRC_PLAY: Loading @@ -152,20 +147,16 @@ public class A2dpSinkStreamHandler extends Handler { if (mAudioFocus == AudioManager.AUDIOFOCUS_NONE) { requestAudioFocus(); } startAvrcpUpdates(); break; } // Otherwise, pause if we don't have focus if (mAudioFocus == AudioManager.AUDIOFOCUS_NONE) { sendAvrcpPause(); } else { startAvrcpUpdates(); } break; case SRC_PAUSE: // Remote pause command, stop avrcp updates. stopAvrcpUpdates(); break; case REQUEST_FOCUS: Loading @@ -176,7 +167,6 @@ public class A2dpSinkStreamHandler extends Handler { case DISCONNECT: // Remote device has disconnected, restore everything to default state. stopAvrcpUpdates(); mSentPause = false; break; Loading @@ -185,7 +175,6 @@ public class A2dpSinkStreamHandler extends Handler { switch ((int) message.obj) { case AudioManager.AUDIOFOCUS_GAIN: // Begin playing audio, if we paused the remote, send a play now. startAvrcpUpdates(); startFluorideStreaming(); if (mSentPause) { sendMessageDelayed(obtainMessage(DELAYED_RESUME), SETTLE_TIMEOUT); Loading Loading @@ -259,7 +248,6 @@ public class A2dpSinkStreamHandler extends Handler { int focusRequestStatus = mAudioManager.requestAudioFocus(focusRequest); // If the request is granted begin streaming immediately and schedule an upgrade. if (focusRequestStatus == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { startAvrcpUpdates(); startFluorideStreaming(); mAudioFocus = AudioManager.AUDIOFOCUS_GAIN; } Loading @@ -286,34 +274,6 @@ public class A2dpSinkStreamHandler extends Handler { mA2dpSinkSm.informAudioTrackGainNative(gain); } private void startAvrcpUpdates() { // Since AVRCP gets started after A2DP we may need to request it later in cycle. AvrcpControllerService avrcpService = AvrcpControllerService.getAvrcpControllerService(); if (DBG) { Log.d(TAG, "startAvrcpUpdates"); } if (avrcpService != null && avrcpService.getConnectedDevices().size() == 1) { avrcpService.startAvrcpUpdates(); } else { Log.e(TAG, "startAvrcpUpdates failed because of connection."); } } private void stopAvrcpUpdates() { // Since AVRCP gets started after A2DP we may need to request it later in cycle. AvrcpControllerService avrcpService = AvrcpControllerService.getAvrcpControllerService(); if (DBG) { Log.d(TAG, "stopAvrcpUpdates"); } if (avrcpService != null && avrcpService.getConnectedDevices().size() == 1) { avrcpService.stopAvrcpUpdates(); } else { Log.e(TAG, "stopAvrcpUpdates failed because of connection."); } } private void sendAvrcpPause() { // Since AVRCP gets started after A2DP we may need to request it later in cycle. AvrcpControllerService avrcpService = AvrcpControllerService.getAvrcpControllerService(); Loading src/com/android/bluetooth/avrcpcontroller/AvrcpControllerService.java +0 −10 Original line number Diff line number Diff line Loading @@ -316,16 +316,6 @@ public class AvrcpControllerService extends ProfileService { mAvrcpCtSm.sendMessage(msg); } public void startAvrcpUpdates() { mAvrcpCtSm.obtainMessage(AvrcpControllerStateMachine.MESSAGE_START_METADATA_BROADCASTS) .sendToTarget(); } public void stopAvrcpUpdates() { mAvrcpCtSm.obtainMessage(AvrcpControllerStateMachine.MESSAGE_STOP_METADATA_BROADCASTS) .sendToTarget(); } public synchronized MediaMetadata getMetaData(BluetoothDevice device) { if (DBG) { Log.d(TAG, "getMetaData"); Loading src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java +0 −9 Original line number Diff line number Diff line Loading @@ -69,10 +69,6 @@ class AvrcpControllerStateMachine extends StateMachine { static final int MESSAGE_PROCESS_SET_ADDRESSED_PLAYER = 114; static final int MESSAGE_PROCESS_ADDRESSED_PLAYER_CHANGED = 115; // commands from A2DP sink static final int MESSAGE_STOP_METADATA_BROADCASTS = 201; static final int MESSAGE_START_METADATA_BROADCASTS = 202; // commands for connection static final int MESSAGE_PROCESS_RC_FEATURES = 301; static final int MESSAGE_PROCESS_CONNECTION_CHANGE = 302; Loading Loading @@ -381,7 +377,6 @@ class AvrcpControllerStateMachine extends StateMachine { case MESSAGE_PROCESS_PLAY_STATUS_CHANGED: int status = msg.arg1; mAddressedPlayer.setPlayStatus(status); broadcastPlayBackStateChanged(getCurrentPlayBackState()); if (status == PlaybackState.STATE_PLAYING) { a2dpSinkService.informTGStatePlaying(mRemoteDevice.mBTDevice, true); } else if (status == PlaybackState.STATE_PAUSED Loading Loading @@ -550,8 +545,6 @@ class AvrcpControllerStateMachine extends StateMachine { case MESSAGE_PROCESS_PLAY_POS_CHANGED: case MESSAGE_PROCESS_PLAY_STATUS_CHANGED: case MESSAGE_PROCESS_VOLUME_CHANGED_NOTIFICATION: case MESSAGE_STOP_METADATA_BROADCASTS: case MESSAGE_START_METADATA_BROADCASTS: case MESSAGE_PROCESS_CONNECTION_CHANGE: case MESSAGE_PROCESS_BROWSE_CONNECTION_CHANGE: // All of these messages should be handled by parent state immediately. Loading Loading @@ -687,8 +680,6 @@ class AvrcpControllerStateMachine extends StateMachine { case MESSAGE_PROCESS_PLAY_POS_CHANGED: case MESSAGE_PROCESS_PLAY_STATUS_CHANGED: case MESSAGE_PROCESS_VOLUME_CHANGED_NOTIFICATION: case MESSAGE_STOP_METADATA_BROADCASTS: case MESSAGE_START_METADATA_BROADCASTS: case MESSAGE_PROCESS_CONNECTION_CHANGE: case MESSAGE_PROCESS_BROWSE_CONNECTION_CHANGE: // All of these messages should be handled by parent state immediately. Loading src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java +0 −3 Original line number Diff line number Diff line Loading @@ -319,9 +319,6 @@ public class BluetoothMediaBrowserService extends MediaBrowserService { synchronized (BluetoothMediaBrowserService.this) { // Play the item if possible. mAvrcpCtrlSrvc.fetchAttrAndPlayItem(mA2dpDevice, mediaId); // Since we request explicit playback here we should start the updates to UI. mAvrcpCtrlSrvc.startAvrcpUpdates(); } // TRACK_EVENT should be fired eventually and the UI should be hence updated. Loading Loading
src/com/android/bluetooth/a2dpsink/A2dpSinkStreamHandler.java +0 −40 Original line number Diff line number Diff line Loading @@ -121,15 +121,12 @@ public class A2dpSinkStreamHandler extends Handler { // Audio stream has started, stop it if we don't have focus. if (mAudioFocus == AudioManager.AUDIOFOCUS_NONE) { sendAvrcpPause(); } else { startAvrcpUpdates(); } break; case SRC_STR_STOP: // Audio stream has stopped, maintain focus but stop avrcp updates. mStreamAvailable = false; stopAvrcpUpdates(); break; case SNK_PLAY: Loading @@ -137,12 +134,10 @@ public class A2dpSinkStreamHandler extends Handler { if (mAudioFocus == AudioManager.AUDIOFOCUS_NONE) { requestAudioFocus(); } startAvrcpUpdates(); break; case SNK_PAUSE: // Local pause command, maintain focus but stop avrcp updates. stopAvrcpUpdates(); break; case SRC_PLAY: Loading @@ -152,20 +147,16 @@ public class A2dpSinkStreamHandler extends Handler { if (mAudioFocus == AudioManager.AUDIOFOCUS_NONE) { requestAudioFocus(); } startAvrcpUpdates(); break; } // Otherwise, pause if we don't have focus if (mAudioFocus == AudioManager.AUDIOFOCUS_NONE) { sendAvrcpPause(); } else { startAvrcpUpdates(); } break; case SRC_PAUSE: // Remote pause command, stop avrcp updates. stopAvrcpUpdates(); break; case REQUEST_FOCUS: Loading @@ -176,7 +167,6 @@ public class A2dpSinkStreamHandler extends Handler { case DISCONNECT: // Remote device has disconnected, restore everything to default state. stopAvrcpUpdates(); mSentPause = false; break; Loading @@ -185,7 +175,6 @@ public class A2dpSinkStreamHandler extends Handler { switch ((int) message.obj) { case AudioManager.AUDIOFOCUS_GAIN: // Begin playing audio, if we paused the remote, send a play now. startAvrcpUpdates(); startFluorideStreaming(); if (mSentPause) { sendMessageDelayed(obtainMessage(DELAYED_RESUME), SETTLE_TIMEOUT); Loading Loading @@ -259,7 +248,6 @@ public class A2dpSinkStreamHandler extends Handler { int focusRequestStatus = mAudioManager.requestAudioFocus(focusRequest); // If the request is granted begin streaming immediately and schedule an upgrade. if (focusRequestStatus == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { startAvrcpUpdates(); startFluorideStreaming(); mAudioFocus = AudioManager.AUDIOFOCUS_GAIN; } Loading @@ -286,34 +274,6 @@ public class A2dpSinkStreamHandler extends Handler { mA2dpSinkSm.informAudioTrackGainNative(gain); } private void startAvrcpUpdates() { // Since AVRCP gets started after A2DP we may need to request it later in cycle. AvrcpControllerService avrcpService = AvrcpControllerService.getAvrcpControllerService(); if (DBG) { Log.d(TAG, "startAvrcpUpdates"); } if (avrcpService != null && avrcpService.getConnectedDevices().size() == 1) { avrcpService.startAvrcpUpdates(); } else { Log.e(TAG, "startAvrcpUpdates failed because of connection."); } } private void stopAvrcpUpdates() { // Since AVRCP gets started after A2DP we may need to request it later in cycle. AvrcpControllerService avrcpService = AvrcpControllerService.getAvrcpControllerService(); if (DBG) { Log.d(TAG, "stopAvrcpUpdates"); } if (avrcpService != null && avrcpService.getConnectedDevices().size() == 1) { avrcpService.stopAvrcpUpdates(); } else { Log.e(TAG, "stopAvrcpUpdates failed because of connection."); } } private void sendAvrcpPause() { // Since AVRCP gets started after A2DP we may need to request it later in cycle. AvrcpControllerService avrcpService = AvrcpControllerService.getAvrcpControllerService(); Loading
src/com/android/bluetooth/avrcpcontroller/AvrcpControllerService.java +0 −10 Original line number Diff line number Diff line Loading @@ -316,16 +316,6 @@ public class AvrcpControllerService extends ProfileService { mAvrcpCtSm.sendMessage(msg); } public void startAvrcpUpdates() { mAvrcpCtSm.obtainMessage(AvrcpControllerStateMachine.MESSAGE_START_METADATA_BROADCASTS) .sendToTarget(); } public void stopAvrcpUpdates() { mAvrcpCtSm.obtainMessage(AvrcpControllerStateMachine.MESSAGE_STOP_METADATA_BROADCASTS) .sendToTarget(); } public synchronized MediaMetadata getMetaData(BluetoothDevice device) { if (DBG) { Log.d(TAG, "getMetaData"); Loading
src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachine.java +0 −9 Original line number Diff line number Diff line Loading @@ -69,10 +69,6 @@ class AvrcpControllerStateMachine extends StateMachine { static final int MESSAGE_PROCESS_SET_ADDRESSED_PLAYER = 114; static final int MESSAGE_PROCESS_ADDRESSED_PLAYER_CHANGED = 115; // commands from A2DP sink static final int MESSAGE_STOP_METADATA_BROADCASTS = 201; static final int MESSAGE_START_METADATA_BROADCASTS = 202; // commands for connection static final int MESSAGE_PROCESS_RC_FEATURES = 301; static final int MESSAGE_PROCESS_CONNECTION_CHANGE = 302; Loading Loading @@ -381,7 +377,6 @@ class AvrcpControllerStateMachine extends StateMachine { case MESSAGE_PROCESS_PLAY_STATUS_CHANGED: int status = msg.arg1; mAddressedPlayer.setPlayStatus(status); broadcastPlayBackStateChanged(getCurrentPlayBackState()); if (status == PlaybackState.STATE_PLAYING) { a2dpSinkService.informTGStatePlaying(mRemoteDevice.mBTDevice, true); } else if (status == PlaybackState.STATE_PAUSED Loading Loading @@ -550,8 +545,6 @@ class AvrcpControllerStateMachine extends StateMachine { case MESSAGE_PROCESS_PLAY_POS_CHANGED: case MESSAGE_PROCESS_PLAY_STATUS_CHANGED: case MESSAGE_PROCESS_VOLUME_CHANGED_NOTIFICATION: case MESSAGE_STOP_METADATA_BROADCASTS: case MESSAGE_START_METADATA_BROADCASTS: case MESSAGE_PROCESS_CONNECTION_CHANGE: case MESSAGE_PROCESS_BROWSE_CONNECTION_CHANGE: // All of these messages should be handled by parent state immediately. Loading Loading @@ -687,8 +680,6 @@ class AvrcpControllerStateMachine extends StateMachine { case MESSAGE_PROCESS_PLAY_POS_CHANGED: case MESSAGE_PROCESS_PLAY_STATUS_CHANGED: case MESSAGE_PROCESS_VOLUME_CHANGED_NOTIFICATION: case MESSAGE_STOP_METADATA_BROADCASTS: case MESSAGE_START_METADATA_BROADCASTS: case MESSAGE_PROCESS_CONNECTION_CHANGE: case MESSAGE_PROCESS_BROWSE_CONNECTION_CHANGE: // All of these messages should be handled by parent state immediately. Loading
src/com/android/bluetooth/avrcpcontroller/BluetoothMediaBrowserService.java +0 −3 Original line number Diff line number Diff line Loading @@ -319,9 +319,6 @@ public class BluetoothMediaBrowserService extends MediaBrowserService { synchronized (BluetoothMediaBrowserService.this) { // Play the item if possible. mAvrcpCtrlSrvc.fetchAttrAndPlayItem(mA2dpDevice, mediaId); // Since we request explicit playback here we should start the updates to UI. mAvrcpCtrlSrvc.startAvrcpUpdates(); } // TRACK_EVENT should be fired eventually and the UI should be hence updated. Loading