diff options
Diffstat (limited to 'src/com/android/bluetooth/a2dp/A2dpStateMachine.java')
-rw-r--r-- | src/com/android/bluetooth/a2dp/A2dpStateMachine.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/bluetooth/a2dp/A2dpStateMachine.java b/src/com/android/bluetooth/a2dp/A2dpStateMachine.java index 7648acd90..dd70eb19b 100644 --- a/src/com/android/bluetooth/a2dp/A2dpStateMachine.java +++ b/src/com/android/bluetooth/a2dp/A2dpStateMachine.java @@ -188,6 +188,8 @@ final class A2dpStateMachine extends StateMachine { @Override public void enter() { log("Enter Disconnected: " + getCurrentMessage().what); + // Remove Timeout msg when moved to stable state + removeMessages(CONNECT_TIMEOUT); } @Override @@ -320,6 +322,7 @@ final class A2dpStateMachine extends StateMachine { deferMessage(message); break; case CONNECT_TIMEOUT: + disconnectA2dpNative(getByteAddress(mTargetDevice)); onConnectionStateChanged(CONNECTION_STATE_DISCONNECTED, getByteAddress(mTargetDevice)); break; @@ -342,7 +345,6 @@ final class A2dpStateMachine extends StateMachine { log("Stack Event: " + event.type); switch (event.type) { case EVENT_TYPE_CONNECTION_STATE_CHANGED: - removeMessages(CONNECT_TIMEOUT); processConnectionEvent(event.valueInt, event.device); break; default: @@ -509,6 +511,7 @@ final class A2dpStateMachine extends StateMachine { @Override public void enter() { log("Enter Connected: " + getCurrentMessage().what); + removeMessages(CONNECT_TIMEOUT); // Upon connected, the audio starts out as stopped broadcastAudioState(mCurrentDevice, BluetoothA2dp.STATE_NOT_PLAYING, BluetoothA2dp.STATE_PLAYING); @@ -663,6 +666,7 @@ final class A2dpStateMachine extends StateMachine { } break; case AUDIO_STATE_STOPPED: + case AUDIO_STATE_REMOTE_SUSPEND: if (mPlayingA2dpDevice != null) { mPlayingA2dpDevice = null; mService.setAvrcpAudioState(BluetoothA2dp.STATE_NOT_PLAYING); @@ -722,7 +726,8 @@ final class A2dpStateMachine extends StateMachine { List<BluetoothDevice> getConnectedDevices() { List<BluetoothDevice> devices = new ArrayList<BluetoothDevice>(); synchronized(this) { - if (getCurrentState() == mConnected) { + /* If connected and mCurrentDevice is not null*/ + if ((getCurrentState() == mConnected) && (mCurrentDevice != null)) { devices.add(mCurrentDevice); } } |